DEV Community

Cover image for Edit your commit messages in GIT
vasubabu
vasubabu

Posted on

2 3

Edit your commit messages in GIT

Sometimes intentionally or unintentionally you may have given a wrong commit message due to various reasons.

But don't worry...

You can change your commit messages with GIT rebase command.

Step 1: Checkout Branch

checkout your branch where you want to change your commit messages

   git checkout <branch>

Step2: Pull last N commits

Rebase will help you modify your commit messages, squash and merge all your commits into one, but this tutorial is mainly to edit your messages. I will talk more about rebase in another tutorial.

   git rebase -i HEAD~N

display a list of the lastNcommits in your default text editor.

Alt Text

Step3: Long live Reword

Replace pick with reword before each commit message you want to change.
Alt Text

Step 4: Use force sometimes

git push -f origin <branch>

Step 5: Have a break !!!!

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more