Amend Last Commit Message and Revert Changes from Remote

Learn to modify the commit message of the last commit we made in our repository.

Amend the recent commit message

Sometimes, we want to modify the last commit. We can change the last commit message using the following command (the commit ID is also updated after changing the commit message):

$ git commit --amend -m "message"

Note: This operation should be done before we push the code to any remote branch. When we perform undo in remote branches, it could lead to inconsistent code among team members.

Get hands-on with 1200+ tech skills courses.