I’m using git-svn to leverage the power of git while the rest of the company prefers the simplicity of svn.
I have created a local branch, intending to merge it in the trunk/master when I’m done, but it turns out it’s much more complicated than expected. So, I want to commit it on svn.
I already have checked out the full repository.
The most simple solution I have found; all other solutions fiddle with the git config files, and I don’t like it:
- Checkout the branch: git checkout mybranch
- Rename the local branch: git branch -m mybranch-temp
- Create a remote branch “mybranch” in SVN using Tortoise SVN
- Fetch the SVN repository to get the new branch: git svn fetch
- Check that the new SVN branch has been fetched: git branch -r (or git branch -avv )
- Get back to the master branch: git checkout master
- Checkout the remote branch: git checkout -b mybranch-svn origin/mybranch
- Rebase my local branch into the local svn branch: git rebase mybranch-temp
- Commit the branch in svn: git svn dcommit ; use --dry-run to check the branch it will commit to, because sometimes it still commits to the trunk (I haven’t found out why).