eaidy
eaidy

Reputation: 600

Why does the COMMIT_EDITMSG open when I try to commit in vscode?

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
#

Upvotes: 33

Views: 52540

Answers (5)

I got this as well... but it's simple: just write your comments on the bottom of the file and save it, and the commit will be done! :)

Upvotes: -1

bk2204
bk2204

Reputation: 76539

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.

See git commit man page

Upvotes: 32

Priit
Priit

Reputation: 31

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

If you're executing the commit in the terminal use:

git commit -m "[commit comment here]"

to add a commit comment and avoid the EDITMSG from popping up

Upvotes: 0

nickchomey
nickchomey

Reputation: 526

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

To change this, go to:

File > Preferences > Settings > search "git.useEditorAsCommitInput" then untick

Upvotes: 40

Bhagath Reddy
Bhagath Reddy

Reputation: 49

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.

Upvotes: 4

Related Questions