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
π§Ή To rename older commits (via rebase):
git rebase -i HEAD~5 # Change 5 to however many commits you want to edit
- Replace
pick
withreword
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
β οΈ 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?
Top comments (0)