0

Git内からSVNのリモートブランチを追跡したいと思います。git-svnコマンドでこれを行う方法の基本を見ることができます。私は次のようなことをしたいと思っていました。

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

そのため、git / masterにマージしてからdcommitを実行すると、最後のsvncommitとgit/HEADの間の変更のみでトランクが更新されます。

これは可能ですか?どうすればいいですか?

4

1 に答える 1

1

git svnドキュメントでは、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
于 2010-01-29T14:27:30.993 に答える