Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git hangs with "hint: Waiting for your editor to close the file..." when closing a commit message file in VSCode

I'm running git commit --amend in the VSCode terminal and it pops up the commit message as a file in the VSCode editor window, and git says (in the terminal) hint: Waiting for your editor to close the file... but doesn't give input back yet.

I amend my changes, then save and close the file. Then git just sits there in the terminal like it didn't know the editor window closed. Does VSCode cling onto the file handle longer than it needs to?

It looks like it's not a path issue because I can start and finish the commit amend (note I'm using keyboard shortcuts to do my initial commits, so that doesn't open an editor - I only noticed this on an amend).

like image 598
AncientSwordRage Avatar asked Oct 25 '18 10:10

AncientSwordRage


People also ask

How do I exit a commit editor?

For closing the “vi” Git commit editor, type the “:wq” command, where “:” helps to enter in the command mode because “vi” is a mode-based editor, “w” is for writing and saving the added commit, and “q” is to exit. Press the “Enter” key after specifying the mentioned command.

What is the git commit command?

The git commit command captures a snapshot of the project's currently staged changes. Committed snapshots can be thought of as “safe” versions of a project—Git will never change them unless you explicitly ask it to.


2 Answers

Alternatively use a -m "your commit comment" argument do directly give the commit message and avoid git opening an editor.

like image 86
Deepak Selvakumar Avatar answered Oct 16 '22 21:10

Deepak Selvakumar


I see a similar issue here on Github.

  1. If you use editor = code --wait in .gitconfig, you have to close VS Code (not the .git/COMMIT_EDITMSG file) to correctly commit.

  2. Add editor = code --wait -n in your .gitconfig file. I think -n here means a new instance of VS Code.

  3. After finishing the config, you type git commit in VS Code terminal, a new VS Code windows will pop up. Just edit your message in COMMIT_EDITMSG in the new windows

like image 42
Devon Ge Avatar answered Oct 16 '22 22:10

Devon Ge