Svn 在Subversion和Git之间的往返中丢失了什么?

Svn 在Subversion和Git之间的往返中丢失了什么?,svn,git,Svn,Git,我一直在考虑对我的Subversion存储库进行一些历史重写,但Subversion目前在这方面做得不是很好。一种选择是转换为Git(我认为这在这方面会更好),进行重写,然后再转换回Subversion。在这样的翻译中,有什么东西可能会丢失(除了应该丢失的历史部分) 万一有人想建议我永远改用Git,答案是:不,我不想这么做:-) 我使用的代码如下。这取决于是否已将$REPO_SVN和$REPO_SVN_CLONE设置为一组Subversion存储库,其中一个包含原始存储库,另一个(几乎)为空存储

我一直在考虑对我的Subversion存储库进行一些历史重写,但Subversion目前在这方面做得不是很好。一种选择是转换为Git(我认为这在这方面会更好),进行重写,然后再转换回Subversion。在这样的翻译中,有什么东西可能会丢失(除了应该丢失的历史部分)

万一有人想建议我永远改用Git,答案是:不,我不想这么做:-)

我使用的代码如下。这取决于是否已将$REPO_SVN和$REPO_SVN_CLONE设置为一组Subversion存储库,其中一个包含原始存储库,另一个(几乎)为空存储库以保存克隆。 (基于):


这听起来不是个好主意。在git中,您应该只重写尚未发布的历史。在subversion和其他客户机服务器SCM中,所有历史记录都已发布到中央服务器,因此没有可以安全重写的历史记录


你为什么要改写历史?你想达到什么目的?

这听起来不是个好主意。在git中,您应该只重写尚未发布的历史。在subversion和其他客户机服务器SCM中,所有历史记录都已发布到中央服务器,因此没有可以安全重写的历史记录


你为什么要改写历史?你想实现什么?

我的简单问题是:为什么要重写历史记录?主要是因为空间原因:我有一些不需要的大型文件的详细中间历史记录。所以我想清除一些中间提交。我的简单问题是:为什么要重写历史记录?主要是因为空间原因:我有一些不需要的大型文件的详细中间历史记录。因此,我想清除一些中间提交。更改的存储库将替换旧的存储库,所有工作副本将再次签出(就用户而言,这不是一个大型项目)。所以这里没有问题。关于你的第二个问题:我这样做主要是为了空间,正如我在另一篇评论中提到的。更改的存储库将替换旧的存储库,所有工作副本将再次签出(就用户而言,这不是一个大项目)。所以这里没有问题。关于你的第二个问题:正如我在另一篇评论中提到的,我这样做主要是为了空间。
# Create first git repository, containing all my data
git svn clone $REPO_SVN RepoGitA

# Create a svn repository to hold the end product
# It must hold one revision, according to Google Code
# svn propset svn:git:svn 1 WCSvnOut
# svnadmin create RepoSvnOut
# svn co file://`pwd`/RepoSvnOut WCSvnOut
# echo "placeholder" > WCSvnOut/placeholder.txt
# svn add WCSvnOut/placeholder.txt
# svn ci -m "Initial commit of svn-git-svn roundtrip" WCSvnOut

# Create second git repository, connected to the new svn repo
# git svn clone file://`pwd`/RepoSvnOut RepoGitB
git svn clone $REPO_SVN_CLONE RepoGitB

# FROM NOW ON, WORK HAPPENS IN THE SECOND GIT REPOSITORY
cd RepoGitB

# Fetch all the data from the first git repository
git fetch ../RepoGitA

# Create a temporary branch for the fetched repository, and tag its head
git branch tmp $(cut -b-40 .git/FETCH_HEAD)
git tag -a -m "Last fetch" last tmp

# Apply initial commit
# Unfortunately, Git treats the initial commit specially, 
# and in particular, cannot rebase it. Work around this as follows:
INIT_COMMIT=$(git log tmp --pretty=format:%H | tail -1)
git checkout $INIT_COMMIT .
git commit -C $INIT_COMMIT

# Rebase: 
# Apply all the other commits to the temporary branch,
# and make it the new master branch:
git rebase master tmp
git branch -M tmp master

# Here I could do some more work to rewrite the repo history

# Lastly, commit the changes to the fresh svn repo
git svn dcommit