How to modify git message
modify the last commit comment:
git commit --amend --message="message" --author="my_name <name@email.com>"
modify historical commit comment:
view your commit history:
git log
rebase:
git rebase -i <commmit id>
orgit rebase -i HEAD~n
- note: you have to rebase to the commit before the one you want to modify.
change the flag:
- pick: use commit (do nothing)
- reword: use commit, but edit the commit message
- edit: use commit, but stop for amending (u can modify files)
- squash: use commit, but meld into previous commit
- fixup: like "squash", but discard this commit's log message
- exec: run command (the rest of the line) using shell
- drop: remove commit
If you just want to edit the commit message, choose reword.
modify the message
push
git push <origin> <branch> -f
. You have to use the flag-f
to push the commit by force.