我想在Git中跟踪SVN上的远程分支。我可以通过git-svn命令看到如何执行此操作的基础知识,我希望能够执行以下操作:
Git branch | SVN branch
-----------------------
master | Trunk
feature1 | <not mapped>
feature2 | <not mapped>
这样一旦我合并到git / master,然后进行dcommit,Trunk将只更新最后一个svn提交和git / HEAD之间的更改。
这可能吗?我该怎么做?
答案 0 :(得分:1)
git svn
documentation描述了使用Subversion的主干,但是有一个脏主人:
# 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
开始使用功能分支而不是主分支
git checkout -b feature1
hack ...
git add ...
git commit ...
当您准备好重新开始使用Subversion时,请务必保持历史记录线性:
git checkout master
git svn rebase
git rebase master feature1
git checkout master
git merge feature1
发货!
git svn dcommit