问题描述
我喜欢使用 git worktree
在多个工作树中签出存储库,以便轻松地同时在不同的分支上工作.然而,当 git 位于 git worktree 文件夹中时,VS 代码似乎无法将 git 识别为 scm.
I like to keep on repository checked out in several worktrees with git worktree
to easily work on different branches simultaneously.Yet VS code does not seem to recognize git as scm when it is in a git worktree folder.
我在文档中找不到关于此或扩展的任何内容.关于如何让 VS 代码支持外部工作树中的 git 功能有什么想法吗?
I couldn't find anything in the docs about this or an extension.Are there any ideas on how I could get VS code to support git features in an external worktree?
推荐答案
我认为这无关紧要,但事实证明...我在 Windows 上运行我的 git 命令行在 Windows Subsystem for Linux 中.但是很明显,Windows 上的 Git 在 /mnt/d...
中找不到绝对的 linux 路径.
I didn't think this would matter, but it turns out... I'm on Windows and run my git command line in Windows Subsystem for Linux. But obviously, Git on Windows couldn't find the absolute linux path in /mnt/d...
.
我用相对路径替换了它,现在 Linux 上的 Git 和 Windows 上的 Git 都将工作树报告为在 git 目录中.它也适用于 VS 代码!
I replaced it with a relative path and now Git on Linux and Git on Windows both report the worktree as being in a git directory. And it works with VS code as well!
这篇关于有没有办法让 VS 代码与 git worktree 一起工作?(带有 WSL 的 Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!