8

masterデバッグする必要があるバグのあるブランチがあります。そのためには、一連のデバッグ手順 (変数の出力など) を挿入し、バグを特定して修正を適用したいと考えています。後で、修正をmasterブランチにマージしたいのですが、デバッグの変更をスキップしたくありません。

# create debug branch
git checkout -b debug

# ...
# edit sources and add debug prints
# ...

# commit debug changes
git commit --all

# create branch for the fix
git checkout -b fix

適切な修正を行い、コミットします

git commit --all

支店に行くmaster...

git checkout master

...そして、デバッグを変更せずに修正とマージします

git merge fix # <-- wrong, will merge debug changes as well

fixなしでマージする方法はdebug?

4

1 に答える 1

11

探しているのは、「gitrebase」の「onto」オプションです(「githelprebase」を参照)。あなたが説明したことから、それは次のようになります:

git rebase --onto master debug fix

これは実際にマスターで('fix'から'debug'へ)コミットを再ルートします。まだ修正ブランチがあります。やり直しを完了するには、次のフォローアップを行います。

git checkout master
git merge fix
于 2013-03-14T22:31:44.020 に答える