How do I make git-svn use a particular svn branch as the remote repository?
I am using git-svn to track development by s
If you've cloned the SVN repository properly (using -T -b -t
or -s
), you should be able to use the git branch commands like:
git reset --hard remotes/branch
git checkout branch
etc.
From my experience, it works fine doing just
git checkout -b RELEASE-0.12 RELEASE-0.12
The local/
prefix is not needed, and it is less confusing to me to leave it out. The old RELEASE-0.12
branch is already a remote branch, so git will not confuse it with the new branch.
The command above will not create a tracking branch relationship. But that is not needed, git svn rebase
works as expected anyway.
These commands have been incredibly useful for me when working on svn branches via git-svn:
#create local Git branch that mirrors remote svn branch
git checkout -b local/RELEASE-0.12 RELEASE-0.12
#will connect with a remote svn branch named ‘RELEASE-0.12′
# -n will show which svn branch you will commit into:
git svn dcommit --dry-run
See full explanation in my article on justaddwater.dk.