Cherry picking is a way to copy a single commit from any local or remote branch to your current local branch. You can even add any remote repository you want to your local clone to cherry-pick from.

git cherry-pick <original-commit>

When cherry picking between stable and unstable branches, always use the following form:

git cherry-pick -e -x <original-commit>

Common Options:

-e will allow you to edit the commit message to add any extra details and to change the BUG/CCBUG/FIXED-IN messages.

-x will automatically add the original commit number to the end of the commit message to enable better tracing and to simplify merging. Only do this if the original commit was already published in a public repository, e.g. your are forward porting or back porting the patch.

-n will cherry-pick the changes but not commit them to the new branch. This is very useful if you need to do further work on a commit.

If you have changes you don't wish to commit but don't want to lose either while you do something else, you can temporarily 'stash' the changes away. This could be some frequently used debug code,or just some work in progress you need to move to another branch without committing. If the code is just WIP for the current branch we recommend using an interim commit instead.

The stash is a temporary store that holds a stack of uncommitted changes at a repository level. Commands given below work by default with the stash at the top of the stack, or you can optionally provide the stack reference.