Present situation in the picture. Green branch is a master. How to copy last 3 commits from master to pink branch, but without touching a master ?
git checkout <name of pink branch>
git merge master
will do exactly what you want (merge the 3 commits from master
into the pink branch, but leave master
itself where it is).
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^^
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With