Selectively Apply Changes From Patch
This can be used to select the hunks you want to apply from a patch file.
-
Apply the patch using
git apply
-
Enter git add interactive mode using
git add --patch
. This will allow you to select the hunks to apply. See man page.
Once done, changes will be staged but not reflected in the working directory. To apply the staged changes to the working directory:
-
Stash them using
git stash save --keep-index --include-untracked
-
Then run
git stash drop