How can I apply only some of a git stash?
git checkout stash@{0} -- <filename>
You can also do this with a list or a glob of filenames.
Apply the patch for only the files you want to change.
git show --first-parent stash@{0} -- <file(s) in question> | git apply
Looks like you can use git checkout -p
with a stash reference, like stash@{0}
. This will let you choose piece by piece what you want to apply to your work tree from the stash.
After you're done using git checkout -p
, the changes you accepted will have been applied to your work tree and added to the cache/index, ready to commit. You can use git checkout -p stash@{0}
multiple times, choosing the patches you want and committing however many times you want along the way.