How can I track a single branch on subversion with git
I'd like to track a remote bran开发者_运维问答ch on SVN from within Git. I can see the basics of how to do this with the git-svn command, I was hoping to do something like the following:
Git branch | SVN branch
-----------------------
master | Trunk
feature1 | <not mapped>
feature2 | <not mapped>
so that once I merge into git/master, and then do dcommit, Trunk would be updated with only changes between the last svn commit and the git/HEAD.
Is this possible? how would I do it?
The git svn
documentation describes working with Subversion's trunk, but with a dirty master:
# Clone a repo (like git clone): git svn clone http://svn.example.com/project/trunk # Enter the newly cloned directory: cd trunk # You should be on master branch, double-check with 'git branch' git branch # Do some work and commit locally to git: git commit ... # Something is committed to SVN, rebase your local changes against the # latest changes in SVN: git svn rebase # Now commit your changes (that were committed previously using git) to SVN, # as well as automatically updating your working HEAD: git svn dcommit # Append svn:ignore settings to the default git exclude file: git svn show-ignore >> .git/info/exclude
To do your work on feature branches instead of master
git checkout -b feature1
hack ...
git add ...
git commit ...
When you're ready to get your work back into Subversion, be sure to keep your history linear:
git checkout master
git svn rebase
git rebase master feature1
git checkout master
git merge feature1
Ship it!
git svn dcommit
精彩评论