When programming and working with your preferred version control system, Git of course, you might find yourself committing a change with a misspelled or wrong message.
Luckily for us developers, there is a simple Git command to change the most recent local commit which is usually the one you want to modify. Just run the below command in your repo's directory.
git commit --amend -m "New commit message"
If you need to modify a commit that has been pushed online or older or multiple commits then check the GitHub Docs on Changing a Commit Message or this article by Linuxize on How to Change a Git Commit Message.
As a bonus, you might want to look into this excellent article by DevConnected on How To Write Good Git Commit Messages.
Good luck and have fun programming.
Founder of SOFTKUBE, lead developer, and getting things done addict. Passionate about open source, user interface design, business development, and the tech world.
A small team of experts developing simple, usable, and high-quality web solutions. We blog about business, entrepreneurship, web development, and technology.
How to Change the Most Recent Git Commit Message
Business Cheat Sheets CLI Design Development Downloads Drupal Email Google Apps HID Keyboards Multilingualism Open Source Philosophy PHP Pointing Devices Productivity Quotes Science Security SEO Technology Thoughts Windows Zend Framework