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. Rob wrote:


    I found your website via the STL Mobile Dev group and its meeting descriptions page.!forum/stl-mobile-dev and In January 2010 you took part in a Mobile Dev meeting and talked about the Palm Pre. At least, I assume that’s what you did. I wasn’t there, I’m just reading the meeting’s notes. Anyway, I was wondering if you’re still involved with webOS at all. If so, I’d like to invite you to a webOS Social held at The Tap Room on August 20. It’s the first webOS meeting in STL and I’m the ringleader. If you’d like more information please see our page:

    Or just email me.

    If you’ve been long-gone from webOS, I’m sorry to have bothered you. But if you’re still involved in webOS I think you’d have a nice time. In less than two months from now there will be a formal HP webOS Developer’s Meeting in STL, in case you’re interested.



    Thursday, August 11, 2011 at 5:42 pm | Permalink
  2. Website URL wrote:

    Good site you’ve got here.. It’s difficult to find good quality writing like yours these days.
    I truly appreciate people like you! Take care!!

    Friday, June 14, 2013 at 3:08 pm | Permalink
  3. I’m excited to discover this website. I want to to thank you for your time just for this fantastic read!! I definitely really liked every bit of it and i also have you book marked to see new stuff in your website.

    Saturday, July 13, 2013 at 2:38 am | Permalink
  4. Web Page wrote:

    Goοd article! We will be linkibɡ to this particularly great cpntent on our site.

    Keep up the great writing.

    Thursday, April 3, 2014 at 11:25 pm | Permalink
  5. Un impօsant гesmerciement à l’administrateur de ce blog

    Saturday, June 14, 2014 at 9:48 pm | Permalink
  6. http:// wrote:

    J’ai pas eu l’occasion de finir de lire mais je passe demain

    Saturday, June 21, 2014 at 7:56 am | Permalink
  7. Je peux te dire que ce n’est guère inexact ..

    Friday, June 27, 2014 at 7:59 am | Permalink
  8. Rashad wrote:

    Vachement captivant, je crois que ce post devrait intéresser une

    Saturday, June 28, 2014 at 9:20 am | Permalink
  9. J’ai trouvé ton poste par mégarde et puis je ne le regrette
    nullement !

    Monday, June 30, 2014 at 3:48 pm | Permalink
  10. Magnificent goods from you, man. I’ve take into accout your stuff previous to
    and you are simply extremely great. I really like what you have obtained
    right here, really like what you are saying and
    the best way wherein you assert it. You make it entertaining and you continue
    to care for to keep it sensible. I can not wait to learn far more from
    you. That is really a tremendous web site.

    Monday, August 18, 2014 at 10:06 pm | Permalink
  11. Thanks for sharing your thoughts on business. Regards

    Saturday, August 30, 2014 at 12:19 am | Permalink

Post a Comment

Your email is never published nor shared.