How do I make git-svn use a particular svn branch as the remote repository?
I am using git-svn to track development by someone else on svn. I'm trying to figure out how to use gti-svn to switch from one svn branch to another. All the examples I have able to find talk about using svn switch as method to switch location instead of actual branches.
Essentially, I would like to start pulling from /svn/branch/1.3 instead of /svn/branch/1.2 using svn fetch.
When you svn switch your working copy to the branch, the local changes will remain. You can then test and commit them to the branch. You can , however, use svn switch with the --relocate switch if the URL of your server changes and you don't want to abandon an existing working copy.
In order to switch to a remote branch, make sure to fetch your remote branch with “git fetch” first. You can then switch to it by executing “git checkout” with the “-t” option and the name of the branch.
The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.
you can do git checkout -m <branch-name> to merge conflicts and checkout to the branch and resolve conflicts yourself, or git checkout -f <branch-name> to ignore changes.
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.
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.
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