1

何かアイデアが得られることを願っていました。私は3つのブランチを持っています:

  • 主人
  • 明確な
  • 機能ブランチ

master汎用コード ベースが含まれているため、後で分岐して新しいタイプの実装を作成する場合でも、簡単に作成できます。しかし、今のところspecific私のメインの開発ブランチです。

そこで、新しい機能をテストするために に分岐specificfeature-branch、満足したら にマージしfeature-branch直しましたspecific

specificしかし、マスターにマージしたくない実装固有のコミットがいくつかあります。ほとんどのコードは一般的な変更であり、マージして元に戻したいと思っています。

からの約 30 の変更を にマージしfeature-branchましたspecificspecificそれらの 30 のうち、おそらく約 20 を からにマージしたいと考えていmasterます。

これを行うための最良の方法は何ですか?

マージしたい各コミットをチェリーピックするだけmasterですか?もしそうなら、時系列の逆順で行くべきですか(つまり、マージしたい最も古いコミットを取得し、次に2番目に古いコミットを取得し、master.

どんなアイデアでも大歓迎です。ありがとう

4

1 に答える 1

1

It is best (if you haven't pushed specific to any remote repo yet) to:

  • reorder your commits in the specific branch (the one for master, then the implementation-specific one), with an interactive rebase.
  • merge only the 20 first commits to master (that will be a fast-forward merge)
    You can create a temporary branch on the most recent of those 20 commits (git branch tmp SHA1), and merge that branch (git checkout master ; git merge tmp)

That way, no cherry-picking, meaning no duplication of commits.


If specific has been pushed, then cherry-picking can work, starting from the older to the newest commit.

In the "cherry-pick A..B" form, A should be older than B. If they're the wrong order the command will silently fail.

于 2014-10-31T06:49:11.243 に答える