Skip to content

Instantly share code, notes, and snippets.

@waliurjs
Last active November 8, 2022 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waliurjs/d04760f957efe2445790386ba9d3885c to your computer and use it in GitHub Desktop.
Save waliurjs/d04760f957efe2445790386ba9d3885c to your computer and use it in GitHub Desktop.
How to change local commit message (not yet pushed)
`git rebase -i HEAD~3` (here 3 means just bring up last 3 commits. Can be any number.)
Find the commit that you are interested in.
Press `i` to activate INSERT MODE in the editor.
Move the cursor to the begining of the commit you are interested in.
Change the first word from "pick" to r. (r for reword)
Ex:
pick 68dab9a7 chore(button): Datepicker fix
to
r 68dab9a7 chore(button): Datepicker fix
Press Esc to deactivate INSERT MODE
Press colon then wq like this -> :wq
Press Enter
This will bring up a new editor view with just the commit message.
Press `i` to activate INSERT MODE in the editor.
Write the commit message that you wanted.
Press Esc to deactivate INSERT MODE
Press :wq
Press Enter
YOU ARE DONE!
Be sure by checking `git log` then q to quit.
In case of fuck up press colon q like this -> :q then Enter
In case of fuck up outside of editor type:
`git rebase --abort`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment