# Create a branch to throw away, on which we'll do the cherry-pick:git checkout -b to-discard
# Do the cherry-pick:git cherry-pick stuff
# Switch back to the branch you were previously on:git checkout -
# Update the working tree and the index with the versions of A and B# from the to-discard branch:git checkout to-discard -- A B
# Commit those changes:git commit -m "Cherry-picked changes to A and B from [stuff]"
# Delete the temporary branch:git branch -D to-discard
git cherry-pick -n <commit>
# unstage modifications you don't want to keep, and remove the# modifications from the work tree as well.# this does work recursively!git checkout HEAD <path>
# commit; the message will have been stored for you by cherry-pickgit commit
# unstage everythinggit reset HEAD
# stage the modifications you do wantgit add <path>
# make the work tree match the index# (do this from the top level of the repo)git checkout .