niekname
niekname

Reputation: 2616

git commit not saving after :Wq

Sometimes when I'm committing something in git, I accidentally hit :Wq to save my changes. (note the capital letter W) Then vim complains that :Wq 'is not an editor command'

Then I correctly use :wq to save and quit. Then it does quit, but no commit is made and I have to redo the commit process. I also have to rewrite my commit message as it is also lost.

Also, when I do :w and :q separately after I made the capital :Wq mistake, the outcome is the same. Although vim does say that the changes have been written when using the :w command.

Any ideas?

Upvotes: 0

Views: 1433

Answers (1)

the_storyteller
the_storyteller

Reputation: 2497

This is a known issue. To solve it, run the following command.

git config --global core.editor $(which vim)

Upvotes: 3

Related Questions