I want to rewrite all of my commit messages in a repository. The repository is large and has over 10k commits. I want to replace all text that matches one of the following patterns with Issue
"(?i)conn-\d{1,4}[abcdi]"
"(?i)conn-\d{1,4}"
"(?i)connect-\d{1,4}"
"(?i)gateway-\d{1,4}[ab]"
"(?i)gateway-\d{1,4}"
I attempted to use the top answer to "What's the fastest way to edit hundreds of Git commit messages?" But using git format-patch -10000
then editing all the patches then doing git am *.patch
I get tons of errors error: file/name.txt does not not exist in index the file/name.txt
.
I know I can do it with git filter-branch -f --msg-filter "sed 's/<old>/<new>/'"
But how can I do it with all the patterns in one go rather than one time for each pattern? Each time I execute git filter-branch
the process takes 1 hour. So I would ideally just execute it one time.