I am trying to change all commit messages and need to replace a specific string with an empty space. How can I do that?
I tried:
git filter-branch --msg-filter 'sed "s/SOMESTR-/ /g"' -- --all
But I got this message:
WARNING: You said to rewrite tagged commits, but not the corresponding tag.
WARNING: Perhaps use '--tag-name-filter cat' to rewrite the tag.
Does this mean it worked?
And once I replace all commits, do I need to push again to remote to update all the commits?
EDIT: I did git log, and it seems the commit messages updated,
so I suppose I just need to git push -f?
UPDATE:
I was able to remove the SOMESTR- prefix on the commit messages. I then forced pushed to master and I can see all the commit messages got updated. However I also need to update the other branches and replace the same prefix with a blank space.
When I switched to my other branch, I ran the same command
git filter-branch --msg-filter 'sed "s/SOMESTR-/ /g"' -- --all
and it said something about doing a force. I added the -f in the filter-branch then did another force push to that branch.
Cannot create a new backup.
A previous backup already exists in refs/original/
Force overwriting the backup with -f
The pull request shows that commit messages still have the prefix SOMESTR-/ but when I do git log I can see two version of the same commit, one without the prefix and the other with it. Is it okay to squash and merge the pull request even though it still shows the unwatned prefix in commit message?
It means exactly what it said. You had tags pointing at the rewritten commits. Those tags still point at the rewritten commits, not the rewrites. Sometimes that's what you want, sometimes it's not. If you wanted to move the tags as well, do what it says, or maybe use a different name filter to give new names to the new tags.