How to Change the Most Recent Git Commit Message
September 10, 2022

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.

How to write git commit messages cover image by DevConnected.

How to write git commit messages cover image by DevConnected.


Development CLI

Share this post


Written by
Mario Awad

Founder of SOFTKUBE, lead developer, and getting things done addict. Passionate about open source, user interface design, business development, and the tech world.

More about Mario Awad


About
SOFTKUBE

A small team of experts developing simple, usable, and high-quality web solutions. We blog about business, entrepreneurship, web development, and technology.

More about us


Recent Posts

Custom Theme Migration from Drupal 9 to Drupal 10

How to Change the Most Recent Git Commit Message

How to Make Google Chrome Forget a Permanent HTTP 301 Redirect

Finding and Fixing Unintended Body Overflow to Remove Horizontal Scrollbars

View all posts


All Posts Categories

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