Reputation: 11830
I wanted to change a commit in Git for which I googled and found this command:
git commit --amend
When I pass this command, I get a screen which look something like this:
When I start typing commit here, it just plays sound similar to one that sort of means that I am typing in a wrong place (invalid command).
Can someone please help me in figuring out how we can edit a commit message in Git?
Upvotes: 0
Views: 8517
Reputation: 1078
The shortest way to change the last commit do this is:
git commit -m "<new_message>" --amend
Upvotes: 2
Reputation: 6117
To edit a commit message in Git:
First as you have mentioned give the command:
git commit --amend
Then it will popup the screen you have given in your question.
Then press i which will make it possible to edit the commit message. Then move your cursor to the your previous commit message using arrow keys
Created Intial Schema
And edit it.
Next press Esc key on your keyboard.
Next type the command press Shift+; key on your keyboard
:
Then type wq
after the colon. And press Enter save and exit.
:wq
Upvotes: 9