Converting svn to git, how to get the branches not to be just remote in the svn repo?

前端 未结 4 1664
太阳男子
太阳男子 2021-02-04 04:28

I\'m quite new to git and I\'m trying to move a svn repository to git. I followed the guide below so now I have a git repo on my server
http://pauldowman.com/2008/07/26/how-

4条回答
  •  不要未来只要你来
    2021-02-04 05:07

    Scott's solution didn't work for me. I suspect something may have changed in a recent version of git-svn since he posted that (and since the linked book was written), as it seems to aggressively garbage-collect as soon as the clone is complete. But this is just a guess as to why it didn't work. I'm using git 1.6.5.6.

    Specifically, my .git/refs/remotes directory was completely empty except for a tags directory, which was also empty. So there is nothing I can copy to make it right.

    After some poking around, I was able to fix this by checking the file .git/packed-refs and doing search-and-replace on the following (in this order):

    refs/remotes/tags => refs/tags
    refs/remotes => refs/heads
    

    If your editor is vim, you can do it with these two commands:

    :%s/refs\/remotes\/tags/refs\/tags/g
    :%s/refs\/remotes/refs\/heads/g
    

    svn2git 1.3.1 also did not produce a usable result for me (did not import any commits after a certain point several months ago, and branches all showed the same commits). For now I have given up on svn2git and have had the most success using git-svn combined with the above.

    Wishful thinking: sure would be nice if git-svn simply added a command like 'abandon' or 'migrate' that would automate this process in a future-proof way.

提交回复
热议问题