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.
If you want to copy few commits from branch A to master you can use cherry-pick that is the cousin of
rebase --onto
, withcherry-pick
you need to specify the commits id you want to copy and withrebase --onto
you can specify a range of commits.Usage
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