Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I cancel a git commit while VS Code is waiting for the commit message in an editor tab?

I'm testing the Visual Studio Code's source control, and I recklessly hit the "Commit" button; now it's waiting for me to enter the commit message:

Enter image description here

It is like a loading or waiting motion. It's waiting for me to enter the commit message.

Is there a way to cancel and terminate the whole commit process in this situation?

like image 294
Shayan Avatar asked Feb 04 '26 06:02

Shayan


1 Answers

Since 1.108

There should be buttons at the lower right of the editor now to commit or cancel drafting the commit message. See the release notes and docs.


I just want to point out that the message itself (the one in the editor, and which is shown in your screenshot) is pretty instructive, though maybe not obvious:

an empty message aborts the commit.

Close the editor tab with an empty message (no need to touch the commented lines). You can close the commit message editor tab using ctrl/cmd+w, or middle click the tab handle, or click the "x" button on the tab handle.

The same goes for any other commit message editor program other than VS Code. Ex. vim or whatever you've configured as your default commit editor. I'm pretty sure it's just how Git itself processes commit messages from a file- not specific to any editor like VS Code.


Related readings if you want to learn deeper: git commit --template, How to specify a git commit message template for a repository in a file at a relative path to the repository?, What is VS Code's "new git grammar" in the v1.76 release notes?.

like image 103
starball Avatar answered Feb 05 '26 23:02

starball



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!