In the lesson “Amending an earlier commit”, when I run git rebase -i VSCode opens with the error “The editor could not be opened due to an unexpected error: Assertion Failed: argument is undefined or null”
As far as I can see it is trying to open the file .git/rebase-merge/git-rebase-todo
I can locate that file and open it with notepad and edit it as the lesson suggests, save it and close it, close VSCode and continue with the lesson, but why do I have to do that? Why doesn’t VSCode do something simple like open a file?
Might want to check your global configurations.
Global configuration is as below, set up as suggested in the first module of the course. What do you suggest?
[core]
editor = code --wait
autocrlf = true
[diff]
tool = vscode
[difftool “vscode”]
cmd = “code --wait --diff $LOCAL $REMOTE”
[merge]
tool = p4merge
[merge.tool.p4merge]
path = C:\Program Files\Perforce\p4merge.exe
[credential]
helper = manager
do you know if the ‘code’ command is added to your PATH variable? This is a common issue and probably the first place I would check, if not then these commands will fail:
editor = code --wait
cmd = “code --wait --diff $LOCAL $REMOTE”
You can check by opening your terminal and typing in code . or code --version and if it fails then you need to add it to your PATH
I have been using ‘code’ to open VScode all the way through the course. It has worked fine up unil this point. It is only when I use ‘git rebase -i ’ that it happens.
Can you check if you have a local config and share it if there is?
You can check it out with:
git config --list --local
Also, please verify that there are no invisible characters or unintended spaces in your configs.
If git rebase -i <number>
isn’t opening the git-rebase-todo
file, try the following:
1. Check Commit Range: Ensure <number>
is a valid commit reference. It should be the number of commits to rebase, not a commit hash.
2. Verify Git Configuration: Confirm your Git editor is set up correctly. You can check this with git config --global core.editor
.
3. Update Git: Make sure you’re using the latest version of Git.
4. Check for Errors: Look for any error messages in the terminal that might indicate what’s wrong.
If the problem continues, please provide more details about your setup for further assistance.And remember you can also enjoy your favourit songs on SpotiflyerApp.
I also got the same issue and uninstalling the GitLens extension seemed to work (Interactive rebase editor fails when opened in a VS Code window that doesn't have the repository opened · Issue #1361 · gitkraken/vscode-gitlens · GitHub)