8

現在の様子を写真で。緑の枝はマスターです。マスターに触れずに、最後の 3 つのコミットをマスターからピンクのブランチにコピーする方法は?

ここに画像の説明を入力

4

2 に答える 2

13
git checkout <name of pink branch>
git merge master

masterあなたが望むことを正確に行います(からの3つのコミットをピンクのブランチにマージしますが、masterそれ自体はそのままにしておきます)。

于 2012-10-22T06:42:20.183 に答える
10

If you mean you wished you had waited to branch (and it's a personal project branch) you can (from branch "pink") use git rebase master. That will pop off the pink commits, move pink ahead to 29934b6 and then re-apply the patches.

Otherwise Amber's git merge is probably the best answer.

Another possibility is (again, from "pink") git cherry-pick 9a51fd2; ... for each of those changes. That will make individual new commits on pink. You can also name the branches as master, master^ and master^^.

于 2012-10-22T06:47:20.787 に答える