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).
17 Comments