Add patch to git, all hunks matching regular expression in file

Is there a way to add all the hunks to a file matching the regular expression?

I know that I can find this piece with /, but it only finds the first. I want to add all the matches.

+7
source share
1 answer

Unfortunately, the patch in July 2011 is nowhere to be released.
He would introduce the git add --hunks=magic option.

Now you will need to do the following:

  • extracting a patch based on your regular expression: see " Filtering diff with regular expression
  • git enter your changes
  • apply patch and git add
  • reset your index and apply your wallet ( git stash pop )

Pretty cumbersome process.

+6
source

All Articles