Table of contents
No headings in the article.
If you have stagged your changes with git and you find that you want to change the commit message to a certain commit here is the easiest way to do that.
Displays a list of the last 3 commits on the current branch
Type in terminal :
$ git rebase -i HEAD~3
This will show the list of the staged commit messages like ths, DONT COPY THIS
pick e499d89 Delete CNAME
pick 0c39034 Better README
pick f7fde4a Change the commit message but push the same commit.
# Rebase 9fdb3bd..f7fde4a onto 9fdb3bd
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
Change the word pick to reword for the commit message you want to change. if your default terminal program is vim do this to change;
- Press I on the keyword
- Edit the text pick to reword
- Press the ESC key on the keyboard and type:wq (write and quit).
- A new vim window will open to edit the commit
Press I on the keyword to edit the text (Commit message) and the press esc key and type :wq to write and quit. you now have your updated commit message.
Thank you, let me know if this has been helpful, in case you need any assistsance please contact me here.