How to Modify Existing Unpushed Commit Messages


Scenario A: Long New Commit Message
1
$ git commit --amend

The above command will:

  • open your editor
  • allow you to change the commit message of the most recent commit
Scenario B: Short New Commit Message
1
$ git commit --amend -m "New commit message"

The above command will:

  • update the commit message of the most recent commit




Related Posts

What is the Difference Between Git Pull and Git Fetch

Short answers to the question what is the difference between...

How to Revert a Git Repository to a Previous Commit

Short answers to the question how to revert a git...

How to Modify Existing Unpushed Commit Messages

Short answers to the question how to modify existing unpushed...

How to Undo a Git Add Before Commit

Short answers to the question how to undo a git...

How to Rename a Local Git Branch

Short answers to the question how to rename a local...

How to Delete a Git Branch Locally and Remotely

Short answers to the question how to delete a git...