Git add lines to index by grep/regex
patchutils has a command grepdiff that can be use to achieve this. # check that the regex search correctly matches the changes you want. git diff -U0 | grepdiff ‘regex search’ –output-matching=hunk # then apply the changes to the index git diff -U0 | grepdiff ‘regex search’ –output-matching=hunk | git apply –cached –unidiff-zero I use … Read more