top of page
index-1-1.jpg

Git: How to change most recent commit message?

You can edit commit message on Git in 3 ways.It's possible to change ONLY the most recent commit message simply by doing this:

1 - Git Amend Message:

git commit --amend

2 - Git Push/Pushing Message: (optional)

Lets assume you had pushed already and you want to push again; then do this:

git push --force

3 - Git Pull/Pulling Message: (optional)

Everyone in your team will have to pull again in case they have already pulled your commit (for which you have changed the message):

git fetch origin
git reset --hard origin/master # Loses all local commitsYou

You can also find information about editing past commit messages in history in our blogs.I hope above steps to edit recent incorrect commit message on Git would be helpful. Please share your experience.

25 views0 comments

Recent Posts

See All

Comments


bottom of page