tonilopezmr / tonilopezmr.github.io

My web portfolio.
https://tonilopezmr-github-io.vercel.app
Other
4 stars 1 forks source link

Copy commits between branches #13

Open tonilopezmr opened 6 years ago

tonilopezmr commented 6 years ago

If you want to copy few commits from branch A to master you can use cherry-pick that is the cousin of rebase --onto, with cherry-pick you need to specify the commits id you want to copy and with rebase --onto you can specify a range of commits.

Usage

> git branch
master
* A
> git log
commit y
commit x
commit z
> git checkout master
> git cherry-pick y x z
> git log
commit y
commit x
commit z
commit a

You need to go to the branch you want to copy the commits of the another branch, cherry-pick will searches your commits in HEAD.


17/04/2018 - thanks to @serchinastico