Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 622 Bytes

cherry-pick.md

File metadata and controls

23 lines (19 loc) · 622 Bytes

Git Cherry-Pick

Made a commit on the wrong branch? Use git log to get the commit reference:

$ git log --graph --oneline
* dfa74cb (HEAD -> develop) Git - Cherry-Pick
* 91f1f59 (master) Git - Recover Dropped Stash

You can switch to the branch, and then use cherry-pick to apply the commit:

$ git checkout master
$ git cherry-pick dfa74cb

Which results in:

$ git log --graph --oneline
* 3301505 (HEAD -> master) Git - Cherry-Pick
* 91f1f59 Git - Recover Dropped Stash

If you don't want to commit the changes straight away, use git cherry-pick -n <ref> to just stage the changes instead.