Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editor automatically closes when running interactive rebase

I'm trying to squash 40+ commits together in a branch I'm working on using interactive rebase. My chosen editor in git is vscode. When I run the command:

git rebase -i <commit>

I briefly see the file to edit appear in vscode, but then it automatically closes. It renames the file from "git-rebase-todo" to "git-rebase-todo (deleted from disk)" and then closes the tab.

Why is this happening? What are my options?

like image 255
user-is-here Avatar asked May 06 '26 16:05

user-is-here


1 Answers

The vscode forks (spawns) a new process. The original one exits and confuses git, as for git exiting editor means that job is done. rebase tmp file git-rebase-todo is deleted by git,what is indicated by vscode.

To fix that, update git config to use start vscode in the wait mode:

git config --global core.editor "code --wait"
like image 188
kofemann Avatar answered May 11 '26 07:05

kofemann