Eugen Konkov
Eugen Konkov

Reputation: 25113

How to apply patch hunk by hunk?

Is there a way to apply patch from stash hunk by hunk like that as add hunks from working directory into stage: git add -p?

I am looking for similar command:

git stash show -p | git apply --hunk-by-hunk

Upvotes: 9

Views: 4151

Answers (1)

jbu
jbu

Reputation: 16121

AFAIK there is no patch mode for apply. However, you can apply the patch, then interactively remove the hunks (hunk-by-hunk) in the patch you don't like:

git checkout -p

Upvotes: 6

Related Questions