The title is not exact, but I can’t express it better in a single line.
- I actually know how to change git commit message like here.
- But I know it always changes the SHA-1 too, which I want to avoid.
I only want to see a different message in git-log. I thought it could be done somehow using git-notes, but I haven’t managed it.
Explanation:
I need it in order to fix errors in the commit messages. I always write there the name of a document containing my communication with the customer (it looks just like T1234 Replace foo by bar). The communication tends to be quite long, so I can loose a lot of time till I find out I was being mislead by wrong document name in the commit message.
Use of git-notes
It looks like git-notes in fact works as stated here. However I always use
git log --oneline
so I never see it. Concerning the comment about making git lie to the user: IMHO, this would be acceptable when this happened only when using a special switch like --replace-messages-by-notes, wouldn’t it? As I always use an alias instead of using git log directly, I’d get what I want without typing a lot.
Do you think it’s a reasonable feature request or would you recommend another workflow to me?
As various people have pointed out (e.g. in VonC’s very useful answer),
git notesreally is the mechanism you’re looking for. Is it not enough for you to change your alias to the following?Presumably it’s only occasionally that you’ll have to add a note to a commit, and the notes will visually stand out in the output of that command.
If you really want to replace the subject of each commit if notes exist, you could always create a script along the lines of:
… but that’s a lot uglier for little gain, in my opinion.