Git - Change commit message

Asked

Viewed 713 times

2

How do I change the message I made in a particular commit?

Example:

Primeira Mensagem             1212121
Segunda Mensagem              8989898

I’ve tried with:

git rebase -i HEAD~2
git commit --force

but it didn’t work... Not from the bug but also doesn’t update.

1 answer

1


Dude, I suggest you read the Git tutorial provided itself here.

But basically, you will do the command git rebase -i HEAD~2 in the same way that you are currently doing, indicating that you wish to perform an iterative rebase. After that, a message containing the commits and some options will be shown, among them the option r, reword which corresponds to using the same commit but rewriting your message.

You will then enter edit mode on the terminal and replace pick that precedes the commit hash by r. After that, you exit edit mode, save and continue. Then the commits that you want to change the message will be shown, you change the messages by entering the edit mode, and after changing, saving and continuing. Finally you perform the command git commit --amend. Ready, you changed the commit messages.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.