Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn trying to commit to wrong branch

Tags:

git

git-svn

git-svn dcommit is trying to push to the wrong SVN branch. Here's what I did:

git checkout -b branch_a svn/branch_a  # git-svn clone prepended all remote SVN branches with svn/
git svn branch -m "a message" branch_b
git checkout -b branch_b svn/branch_b

<make some commits>

git svn dcommit
git checkout branch_a
git svn rebase
git checkout branch_b
git rebase branch_a

This is the "correct" branching/merging strategy I interpret from this StackOverflow question.

Now I'm in a pickle. git svn dcommit from branch_b attempts to push to the SVN URL for svn/branch_a. This is confirmed by the output of git svn info. This is also not what I want or expect.

Interestingly, git log --grep='^git-svn-id:' --first-parent -1 shows the correct SVN branch, the URL for svn/branch_b. I've read that this command is supposed to reveal where git-svn will dcommit to.

So:

  1. What did I do wrong?
  2. How can I fix it (i.e., push branch_b to svn/branch_b
like image 746
spiffytech Avatar asked Nov 13 '22 10:11

spiffytech


1 Answers

Looking over your checkout commands, it seems you may not have instructed git svn to track the remote SVN branches correctly. Try these commands:

git checkout -b branch_a -t svn/branch_a
git checkout -b branch_b -t svn/branch_b

and then verify the branch you are tracking after each with:

git svn info

Each branch should then be tracking the correct remote branch.

like image 121
Peter Bratton Avatar answered Nov 16 '22 01:11

Peter Bratton