2010-01-29 79 views
0

我想从Git内部跟踪SVN上的远程分支。我可以看到如何与混帐svn的命令做到这一点的基础,我希望做一些这样的:如何使用git跟踪颠覆单个分支

Git branch | SVN branch 
----------------------- 
master  | Trunk 
feature1 | <not mapped> 
feature2 | <not mapped> 

所以,一旦我融入混帐/主,然后做dcommit,树干只会在最后的svn commit和git/HEAD之间进行更新。

这可能吗?我会怎么做?

回答

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