记使用 VSCode 作为 Git 编辑器在 Rebase 时没有打开 GitLens Rebase Editor 的问题

设置默认Git编辑器 core.editorcommit message 编辑时) 和 序列编辑器 sequence.editor(比如 rebase 时)

git config --global core.editor "code --wait"
git config --global sequence.editor "code --wait"

GitLens Interactive Rebase Editor

长久以来,我一直都是用的 GitLens 来操作的 Git,特别是在 rebase 的时候,可视化的界面真的比原本的文本编辑好用太多。

最近因为 Github Copilot 高级请求限制的调整,计算了一下高级请求的用量,其实改版后的 Copilot 价格和 Cursor 已经持平。所以准备迁移到 Cursor 开发一段时间(Cursor 的辅助编程体验要好太多了)。

但由于太久没有调整过 VS Code 的配置项了,在同步配置项到 Cursor 之后发现 git rebase 时,没有按照预期打开 GitLens Interactive Rebase Editor 就是上边的动图中的交互编辑器。一直都是在 Cursor 里面以文本编辑的形式打开了 git-rebase-todo 的内容。

所以记录一下如何调整和启用。


当时单纯只是在设置里面勾选了 Gitlens > Terminal:Override Git Editor 这个配置项。

其实很简单,就是没有设置调整 Git 配置中的 sequence.editor,还是原本的 code,调整为 cursor 就好了 👇
git config --global sequence.editor "cursor --wait"

我还以为是没有启动 GitLens:Enable Interactive Rebase Editor 这个配置项反反复复的禁用/启用了好多回,也去 Gitlens 仓库 里面翻了好久。


顺便提一嘴,如果不知道怎么开打 Gitlens 设置面板的话,可以在 Ctrl + Shift + P 打开命令面板之后,键入 gitlens open settings 就可以打开了。


相关资源

Core Features | GitLens
How do I enable/disable the Interactive Rebase Editor? · gitkraken/vscode-gitlens · Discussion #1260