What is the correct way to convert SVN remote branches and tags into local Git branches/tags during SVN to Git migration

后端 未结 5 643
庸人自扰
庸人自扰 2020-12-30 15:00

What is the correct way to make the remote branches/tags that exist after a git-svn init/git-svn fetch into local Git branches/tags before pushing to my remote Git repo and

5条回答
  •  执笔经年
    2020-12-30 15:17

    There is no easy/straightforward way to convert SVN tag-branches to native git tags after git svn conversion. There are number of scripts out there to convert SVN tags but most of them merely tag-&-remove corresponding branches outside of "master" branch so new tags won't show up in commits history even if "master" have commits identical to the tagged ones.

    In order to solve this problem I ended up writing my own utility "git-svn-convert-tags" which finds and tags commits identical to SVN "tags" within "master" branch. The logic is simple: utility compares all commits in current branch (e.g. "master") to tag-branches' HEADs. When binary-identical commit is found new tag is assigned and SVN tag-branch is deleted. Using this approach I've managed to successfully convert tags in many git-svn imported repositories to perfect git tag layout.

提交回复
热议问题