これは私の現在のgitツリーです:
A - H (master)
|
\- B - C - D - E (feature)
|
\- F (new)
|
\- G (other)
H
そして、サイドブランチをリベースして、以下に依存するようにしたいと思いますA
:
A - H (master)
|
\- B'- C'- D'- E'(feature)
|
\- F'(new)
|
\- G'(other)
簡単なコンセプトですが、自動的に行うのは難しいようです。これはすでにこことここで尋ねられていますが、提案された解決策は私にとってはうまくいきません。
まず、前者で指摘したようgit branch
に、現在のブランチがそこにある場合 (前に追加されている場合)、出力を解析するのは簡単ではありません*
。しかし、それはストッパーではありません。私の場合、名前を簡単に提供でき、feature
手new
でother
、または現在のブランチが であることを確認できmaster
ます。
次に、これらのコマンドを試しました:
git rebase --committer-date-is-author-date --preserve-merges --onto master feature^ feature
git rebase --committer-date-is-author-date --preserve-merges --onto master feature^ new
git rebase --committer-date-is-author-date --preserve-merges --onto master feature^ other
そして私は次のようになります:
A - H (master)
|
\- E'(feature)
|
\- B' - C' - D' - F'(new)
|
\- B" - C" - D" - G'(other)
間違いなく私が欲しいものではありません!または、B^
代わりにを使用すると、ブランチの履歴feature^
も取得します。B - C - D
feature
それで、これを多かれ少なかれ自動的に行う方法について、さらに何か提案はありますか?
編集:これは次のように機能します:
git checkout feature
git merge other
git merge new
git rebase -p master feature
少なくともツリーは正しく見えるようになりました。マージの前に、ブランチ ヘッドを正しいコミットに移動する必要があります。これは次の方法で実行できます。
git checkout master
git branch -f new feature^2
git branch -f feature feature^1
git branch -f other feature^2
git branch -f feature feature^1