23

Up until now, I can commit all my changes without any complications in VS Code. Now, when I try to commit my changes by clicking the little 'tick' on the top right corner of the 'Source Control' tab, a file named 'COMMIT_EDITMSG' shows up on the editor, and the Source Control panel remains in the loading state and nothing happens.

I don't know why this suddenly happened but I didn't do anything.

Is there a solution for this issue?

This is the file content:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
#   modified:   pages/support-topics.vue
#
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
caliskanata
  • 488
  • 1
  • 2
  • 14

4 Answers4

29

I just started getting this as well. Something surely changed in the default settings with a recent update.

The solution seems to be to turn off this setting

git.useEditorAsCommitInput

nickc
  • 412
  • 3
  • 7
25

When you make a commit, Git needs a commit message. In order to get that commit message, Git will invoke your editor with a file called COMMIT_EDITMSG, which is where you write the message, saving the file and closing it. Once you've done that, Git will take that message, strip out the comments, and use it as the commit message for your commit.

In that context, this is working as designed, and you just need to enter the commit message for your commit.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • 4
    Thanks it worked. But it didin't showed me the file before, i was entering the commit message on the command palette. – caliskanata Jul 08 '22 at 18:11
  • 10
    Thank you for providing the true answer to this question: (make any necessary edits to the commit message and) **just close the file**. – Trevortni Jul 22 '22 at 19:21
  • 4
    What a bizarre interface. It actually locked me out of editing the input where I forgot to add the commit message initially, and expected me to know I was supposed to edit, save, and close this strange file instead? Had to find this answer just to know what to do! – Roobot Jul 27 '22 at 21:21
  • I was hoping maybe this feature would allow you to use the same commit message as last commit or something, but nope. Always gives you a new file. Is there any way to do that in VS Code? Show a history of commit messages and/or choose the same one as last time? Edit: sorry, should have googled first: https://stackoverflow.com/questions/39445199/how-to-make-visual-studio-code-remember-previous-commit-messages – Dr. Kickass Oct 13 '22 at 18:09
  • You can do that with `git commit -C HEAD --reset-author` if you want. If you want to edit it as well, then use `--edit` in addition. – bk2204 Oct 14 '22 at 19:51
  • I was really frustrated with this and for the changes to take effect I just had to close the file – Ahmad ghoneim Jul 08 '23 at 17:46
  • @bk2204 Thank you for your reply. Was this information in the corresponding Release notes? – Ben Q Aug 28 '23 at 21:23
  • This is the way Git has worked for at least a decade and the way it works with every other editor. If VS Code has ever done anything different, then that would be up to them to document, and a departure from normal Git behaviour. I don't use VS Code (instead I use Vim), so I can't say either way. – bk2204 Aug 28 '23 at 21:33
3

Try finding the Git settings within VS Code's settings:

-> Git: Use Editor As Commit Input

You just need to turn this off to avoid that pop up.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
0

It only does that if you do not type in a comment for your commit.

Priit
  • 31
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 02 '22 at 01:30