Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.