Skip to content

Bulk ammending commit messages in git

At my job I’m using git-p4 to work locally with some rails code in git and push to perforce. It’s working okay but one issue for me is that we require every commit to perforce to have a code review by someone, and we put the reviewer’s name at the bottom of each commit. For example:

Live changes to histograms
-commonized the histograms views & logic

CR: JamesM

Well when I’m working in the git repo, I don’t know who is going to code review it, so I end up having to add CR: JamesM to several commits. It can be done with rebase -i, but it is several steps per commit. I could use git-notes, but that doesn’t follow the format that we like (it puts Notes: in). Because this is a local repo only, changing the commit history is not a big deal. After some searching I found the way:

git filter-branch --msg-filter 'cat && echo "CR: REVIEWER"' p4/master~1..HEAD

This little beauty will append CR: REVIEWER to all of the commits from the master to the current head (all of the local commits).


  1. We could be just a few years from Tricorder-like diagnosis devices.
    It sells for $249 with a two year contract at Verizon, although you can get it through
    Wirefly. Certainly, the benefit of access these buttons provide to various features is worth a bit of self-training, I

    Monday, July 24, 2017 at 10:10 pm | Permalink
  2. X wrote:

    I was cᥙrious if you ever considered changing the layout of your
    blog? Its very well written; I love what youve got to say.
    But maybe you could a little more in thе way of content so
    people could connect with it better. Youve
    got an awful lot of text for only having 1 or two pictures.

    Maybе you could space it out better?

    Wednesday, July 26, 2017 at 9:12 am | Permalink

One Trackback/Pingback

  1. try here on Tuesday, July 25, 2017 at 11:34 pm

    try here

    confabulus › Bulk ammending commit messages in git

Post a Comment

Your email is never published nor shared.