The title is not exact, but I can't express it better in a single line.
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.
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.
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?
You can change the most recent commit message using the git commit --amend command. In Git, the text of the commit message is part of the commit. Changing the commit message will change the commit ID--i.e., the SHA1 checksum that names the commit. Effectively, you are creating a new commit that replaces the old one.
There are many ways to rewrite history with git. Use git commit --amend to change your latest log message. Use git commit --amend to make modifications to the most recent commit. Use git rebase to combine commits and modify history of a branch.
Use the selected commit message without launching an editor. For example, git commit --amend --no-edit amends a commit without changing its commit message. Replace the tip of the current branch by creating a new commit.
git notes
is the only way to have a different git log message (different than the commit message) without changing the SHA1, as mentioned in the "Notes to Self" article (from the original Aug. 2010 article).
A few remarks though:
git notes
isn't working for you).refs/notes/*
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With