I have checked out a svn repository using git svn. Now I need to checkout one of the branches and track it. Which is the best way to do it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Standard Subversion layout
Create a git clone of that includes your Subversion trunk, tags, and branches with
The
--stdlayoutoption is a nice shortcut if your Subversion repository uses the typical structure:Make your git repository ignore everything the subversion repo does:
You should now be able to see all the Subversion branches on the git side:
Say the name of the branch in Subversion is
waldo. On the git side, you’d runThe -svn suffix is to avoid warnings of the form
To update the git branch
waldo-svn, runStarting from a trunk-only checkout
To add a Subversion branch to a trunk-only clone, modify your git repository’s
.git/configto contain[svn-remote "svn-mybranch"] url = http://svn.example.com/project/branches/mybranch fetch = :refs/remotes/mybranchYou’ll need to develop the habit of running
to update all of what
git svnthinks are separate remotes. At this point, you can create and track branches as above. For example, to create a git branch that corresponds to mybranch, runFor the branches from which you intend to
git svn dcommit, keep their histories linear!Further information
You may also be interested in reading an answer to a related question.