1

I have two branches tracked in a Git repository from SVN. Branch B was created in r6 in SVN by copying r5 of Branch A. When I added Branch B to git-svn it only tracks back to r6. I was expecting it to wire the Git commit of r6 on Branch B to the Git commit of r5 on Branch A.

I attempted git rebase $(git svn find-rev r6 git-svn-BranchA) master-BranchB, but it didn't work for me in this scenario since it breaks subsequent git svn rebase attempts. It thinks it needs to merge and appears like it is attempting to rebase from git-svn-BranchA instead of git-svn-BranchB.

How do I add an SVN created descendent branch in git-svn?

1 Answer 1

0

Through hacking and re-hacking I had a breakthrough :)

  1. Rebase the remote to the branch-point in SVN:

    git rebase $(git svn find-rev r5 git-svn-BranchA) git-svn-BranchB
    
  2. Directly rewrite the SHA of the git-svn remote for Branch B:

    git rev-parse HEAD > .git/refs/remotes/git-svn-BranchB
    
  3. Delete the branch tracking BranchB from SVN:

    git branch -D BranchB
    
  4. Get a new tracking branch for BranchB from SVN:

    git checkout -b BranchB git-svn-BranchB
    
  5. Rebuild the tracking information:

    git svn rebase
    

    You should see output like:

    Partial-rebuilding .git/svn/refs/remotes/git-svn-BranchB/.rev_map.########-####-####-####-############ ...
    Currently at 9 = ########################################
    r6 = ########################################
    r7 = ########################################
    r8 = ########################################
    r9 = ########################################
    Done rebuilding .git/svn/refs/remotes/git-svn-BranchB/.rev_map.########-####-####-####-############
    Current branch BranchB is up to date.
    

I really hope someone has a much less ugly version of step 2. It seems like a grotesque hack to me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .