I have a git svn repo. I have multiple release branches in here. I was preparing a new release and as part of it, I figured I'd do a "git rebase" from the previous release to pull over any changes that hadn't been merged.
So I set up my branches...
git branch new_release remotes/svn-branches/new_release
git branch old_release remotes/svn-branches/old_release
And then I did the rebase...
git checkout new_release
git rebase old_release
# watch it pull a bunch of commits
git svn dcommit
Committing to https://svn.mysvn.net/repo/releases/old_release ...
After I did the "svn dcommit" I almost crapped my pants. It was hosing my old release branch in Subversion!
Why did the remote tracking branch change as a result of doing the rebase?
How do I fix the situation I've gotten myself into?
EDIT: Okay, for getting myself out I believe I can do the following: http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo
Since there are only a handful of commits that were on the new_release branch that were pulled to old_release, I can revert them by hand individually on the SVN repo. I'm still confused at what happened here though.
EDITx2: Yep, here are some steps to verify.
git svn info
and observe the URL points to the correct location in SVNgit rebase <other_branch>
git svn info
again and observe the URL changed to point to the other branch location in SVNLooks like you've made a common mistake while working with git-svn.
There's no such thing as "tracking branches" in git-svn. It always determines URL of branch to dcommit to by first-parent history until the first commit with "git-svn-id:" signature is met. The URL near this signature is the URL where the commit will be pushed. But note, there's a double check: the URL and revision near the signature is compared with data structures in .git/svn/refs directory and if the URL and revision contradicts them (that is true for rebased commits because rebase doesn't touch those structures), it is not considered. So the old branch URL was the first URL of commit that wasn't rebased.
If you want pure Git experience, you might try SubGit as git-svn replacement. Since 2.0 it allows to create a writable pure Git mirror of your SVN repository, taking care about synchronization and concurrency. Run
$ subgit configure --svn-url <SVNURL> project.git
$ #adjust projectX.git/subgit/{config,authors.txt,passwd}
$ subgit install project.git
$ git clone project.git project/
After installation you may use it as a normal Git repository. So for you example you run:
$ git checkout new_release
$ git rebase old_release
$ git push origin new_release
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With