I recently got asked if there is a way to change the commit message we just entered in git.
If a commit message contains unclear, incorrect, or sensitive information, you can amend it locally and push a new commit with a new message to GitHub. You can also change a commit message to add missing information.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hello,
I will recommend everyone to navigate to github official docs and change the following article:
There are several cases which are all covered in the official document page.
An example is to amend a message that has not been pushed online yet. You need to navigate to you local repository that contains the commit you want to change. In your terminal client type the following command:
git commit --amend
You can now edit the commit message in the text editor and save the commit.
The other scenario is to edit the most recent commit message. You can achieve that using the exact same command:
git commit --amend
Changing the commit message will create a new commit to replace the old one.
Hope that this helps! Regards, Alex
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.