“git rebase <branch>” on git svn repo changed remote tracking destination?

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 push: username, password, how to avoid?
  • Ruby on rails Xero integration with Xeroizer
  • How do you resolve git conflicts in yarn.lock
  • How to make an existing subdir as subtree for another git repo, with squashed commit?
  • GitPython create and push tags
  • Mac OSX | Bash .bash_profile not updating PS1
  • 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.

    1. Set up two git branches tracking remotely to SVN branches
    2. Check out one of the branches
    3. Run git svn info and observe the URL points to the correct location in SVN
    4. Run git rebase <other_branch>
    5. Run git svn info again and observe the URL changed to point to the other branch location in SVN

  • Git says Automatic merge failed but when i check the file or run the mergetool there are no conflicts they were resolved correctly
  • Working with repos
  • Can the instance of Git that's installed with Xcode 4 be used for web development?
  • Creating a new minor version between two releases
  • .gitignore ignore all files then recursively allow *.foo
  • EGit push operation giving error: “Error occurred during unpacking the remote end”
  • One Solution collect form web for ““git rebase <branch>” on git svn repo changed remote tracking destination?”

    Looks 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
    Git Baby is a git and github fan, let's start git clone.