DEV Community

Kaleem Elahi
Kaleem Elahi

Posted on

๐Ÿง  2 Easy Ways to Rename a Git Commit Message (GUI or CLI)

Ever made a typo in your commit message ๐Ÿ˜… or forgot to follow proper commit message standards (like I did)? Donโ€™t worry โ€” renaming commits is easier than you think!

โœ… 1. Using Fork (Interactive Rebase โ€“ GUI method)

1๏ธโƒฃ Open the repository in Fork
2๏ธโƒฃ Right-click the commit you want to rename
3๏ธโƒฃ Select Interactive Rebase > "Reword Message.."
This will open a dialog to edit the message and select rework instead of pick.
4๏ธโƒฃ Save changes and push with --force if it was already pushed

โœจ Super simple โ€” perfect for visual thinkers, right?
Download: https://git-fork.com/

โœ… 2. Using Git commands (Terminal)

๐Ÿ”„ To rename the most recent commit:

git commit --amend

Enter fullscreen mode Exit fullscreen mode

๐Ÿงน To rename older commits (via rebase):

git rebase -i HEAD~5  # Change 5 to however many commits you want to edit
Enter fullscreen mode Exit fullscreen mode
  • Replace pick with reword for the commits you want to rename
  • Then press: Esc โ†’ :wq โ†’ Enter to save and exit
  • Git will then prompt you to edit each commit message
  • After you're done:
git push --force
Enter fullscreen mode Exit fullscreen mode

โš ๏ธ Donโ€™t forget the --force push โ€” if you skip this, your branch may get out of sync or duplicate commits may appear.

๐Ÿ’ฌ Have you tried the Fork method or the command line? Which one works better for you?

Git #GitTips #CommitMessages #ForkGit #CleanCode #100DaysOfCode #FrontendDev #DeveloperTools #Rebase

Top comments (0)