I am facing this problem since over a month and could not find a similar issue reported on Internet.
I have various editors configured in Git config. I use Notepad++ as editor (for editing commit messages and interactive rebase), WinMerge as the difftool and Visual Studio as mergetool. Earlier, when issuing commands such as git commit or git difftool, Git would wait for these editors to close. Now, the same commands have stopped waiting. Since the commands exited prematurely, the commit message edited in Notepad++ gets ignored, and the temporary files created for the difftool are deleted before it can diff the revisions.
I have reinstalled and upgraded Git and rebooted computer a couple of times so far. It is possible that the issue is caused when cleaning up a few files/folders on PC but I cannot say for sure as the Git installation was untouched. Can you suggest on where the issue might be? Also, if someone can share a method to debug this issue, that would be great.
For now, I have removed the configuration for editors so Git can open the default Vim editor in the console. Also, I am currently using Git explorer inside Visual Studio and Visual Studio Code for diff-operations, but I would like to switch back to the command line.
In case, it helps, sharing the relevant Git configuration below:
[core]
editor = notepad++.exe -multiInst -nosession -notabbar -noPlugin
longPaths = true
[diff]
tool = winmerge
[difftool]
prompt = true
[difftool "winmerge"]
cmd = WinMergeU.exe -e -u "$LOCAL" "$REMOTE"
keepBackup = false
EDIT: Just opened my old laptop and issued git commit
command. That too did not wait for Notepad++ to close, so this might be caused by a recent Windows update. Here’s the logging when GIT_TRACE
environment variable set to 1
.
> git commit
09:38:38.106555 exec-cmd.c:266 trace: resolved executable dir: C:/Users/username/scoop/apps/git/2.47.0/mingw64/bin
09:38:38.163388 git.c:479 trace: built-in: git commit
hint: Waiting for your editor to close the file...
09:38:38.229461 run-command.c:667 trace: run_command: GIT_INDEX_FILE=.git/index 'notepad++.exe -multiInst -nosession -notabbar -noPlugin' C:/myrepo/.git/COMMIT_EDITMSG
09:38:38.231049 run-command.c:928 trace: start_command: C:/Users/username/scoop/apps/git/2.47.0/usr/bin/sh.exe -c 'notepad++.exe -multiInst -nosession -notabbar -noPlugin "$@"' 'notepad++.exe -multiInst -nosession -notabbar -noPlugin' C:/myrepo/.git/COMMIT_EDITMSG
Aborting commit due to empty commit message.
I have switched to Visual Studio Code which lets the Git wait for the tabs to close. It is not clear why Git used to work properly with Notepad++ and WinMerge earlier. Below are the new Git configurations:
[core]
editor = "C:\Users\jasanghv\scoop\apps\vscode\current\bin\code" --disable-extensions --wait
longPaths = true
[diff]
tool = vscode
[difftool "vscode"]
cmd = "C:\Users\jasanghv\scoop\apps\vscode\current\bin\code" --diff "$LOCAL" "$REMOTE" --wait
keepBackup = false
[merge]
tool = vscode
[mergetool]
prompt = false
keepTemporaries = false
[mergetool "vscode"]
cmd = "C:\Users\jasanghv\scoop\apps\vscode\current\bin\code" --merge "$REMOTE" "$LOCAL" "$BASE" "$MERGED" --wait
keepBackup = false
trustExitCode = true
2
The issue could be due to how git interacts with external editors, especially when they are not blocking the process. Check if the editor configurations have background execution flags that prevent Git from waiting. For Notepad++, try adding -wait
to the command in the Git config: editor = notepad++.exe -multiInst -nosession -notabbar -noPlugin -wait
.
Additionally, ensure that WinMerge and Visual Studio are configured to block Git until the process is complete.
1