开发者

Branches transferred with svn2git

开发者 https://www.devze.com 2023-01-15 11:39 出处:网络
This question might be down to the fact I don\'t understand how branching works technically in SVN and Git.

This question might be down to the fact I don't understand how branching works technically in SVN and Git.

But when I use svn2git some of the branches are in refs/remotes/ and some are not. For instance trunk is /refs/remotes/trunk.

And when I check the master branch in the new git repo, it is not the svn trunk but some old branch from last year (and it looks like it's selected completely random). Tags are moved correctly.

If I look at the svn repo in Trac, it does look like the layout is correct (trunk, branches, tags) and the trunk points to where it should. It also looks like the branches that are shown correctly (no remotes) are in .git/config, the rest aren't.

What's going on here and what should I开发者_JAVA百科 do to convert the svn repo correctly? Should I just add defintions for the remote branches to .git/config as well? This wouldn't solve the trunk problem, however.

EDIT: I just realised something: thre remotes are exactly the same as the local branches with the difference that there is a local branch "master" and remote branch "remotes/trunk", all other 19 branches seem similar. Problem seems to be that master is not pointing to "remotes/trunk" but rather to some random commit.

Is this just a bug in svn2git?


It must be a bug. According to the readme in github for git2svn

and that the code checked into master ends up being what's currently in your svn trunk rather than whichever svn branch your last commit was in.

You could try manually specifying the branches manually to see if that will get more consistent results

 svn2git http://svn.example.com/path/to/repo --trunk trunk --tags tags --branches branches

If that doesn't work you could add an alliase to your .gitconfig file which you could run after the svn2git which would replace master with trunk

[alias]
  fixport = !sh -c 'git checkout remotes/trunk trunk && git checkout master && git reset --hard trunk'

then you do your svn2git ... as normal and when it is done run git fixport and it will checkout a local copy of remotes/trunk as trunk and reset master to equal that.

0

精彩评论

暂无评论...
验证码 换一张
取 消