VS Code 不显示更改并且暂存文件显示为空白

发布于 2025-01-11 09:12:12 字数 1245 浏览 0 评论 0原文

在某些时候,我的 VS Code 开始出现一个问题,即查看更改时将以前的版本显示为空白 - 就像您会看到它是否是一个新的未跟踪文件一样。这以前总是显示正确的信息。如果我运行 git diff那么它会显示正确的数据,但 VS Code 将其显示为:

以前版本的 VS Code 更改为空白

除此之外,当我暂存更改时(s),然后单击文件来查看更改,然后两个窗格上都不会显示任何内容:

当前版本和以前版本的 VS 代码更改都是空白

据我所知,我没有更改任何内容(除了一些 Windows 更新)我的电脑。

我最近做的唯一一件事就是安装 Ruby 和另一个 Git 插件,但这比这些问题要晚得多。

我尝试过:

我无法访问另一个存储库,否则我接下来会尝试这样做。我完全被难住了,感谢您提供的任何帮助。提前致谢。

编辑: 我仅使用 Microsoft 登录名(而不是我们的域凭据)在计算机上创建了一个新的本地管理员帐户,然后从 GitHub 克隆了一个存储库。它显示了所有更改并按预期运行。所以我不确定这是否是我的用户帐户或存储库的问题。如果有任何关于我还可以尝试的建议,我将不胜感激!

编辑:我已经在本地、映射的网络驱动器上创建了一个新存储库,也直接通过 UNC 创建了一个新存储库,所有这些都运行良好(从我的域登录帐户)。据我所知,目前这似乎是回购协议的一个问题。

At some point my VS Code started having an issue where viewing the changes shows the previous version as blank - like you would see if it were a new untracked file. This has always shown the correct information previously. If I run git diff <filename> then it shows the correct data, but VS Code shows it as:

VS Code changes are blank for previous versions

Along with that, when I stage the change(s) and then click on the file to view the changes, then nothing shows up on either pane:

VS Code changes are blank for both the current and previous versions

To the best of my knowledge I haven't changed a single thing (except some Windows updates) to my computer.

The only thing that I have done recently was to install Ruby and another Git addon for that, but this was much more recent than these problems.

I've tried:

  • Disabling & reenabling the built-in Git extensions
  • Opening files from both a mapped (S:) drive and the UNC path
  • Disabling/removing/reinstalling all extensions
  • Creating new files & directories
  • Checking/unchecking diff & SCM settings
  • Uninstalled & reinstalled VS Code and all other folders that don't get deleted after uninstallation per How to uninstall VS Code completely

I don't have access to another repository otherwise I would try that next. I am utterly stumped and appreciate any help you might have. Thanks in advance.

Edit:
I created a new local admin account on my computer with just my Microsoft login (as opposed to our domain credentials) and then cloned a repository from GitHub. It is showing all of the changes and behaving as expected. So I'm unsure if this is an issue with my user account now or with the repository. I'd appreciate any suggestions on what else I can try!

Edit: I have created a new repository locally, on a mapped network drive, and also via UNC directly and all of that works just fine (from my domain-logged-in account). It seems to be an issue with the repo directly at this point as far as I can tell.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

囍孤女 2025-01-18 09:12:12

此问题应通过 VSCode 1.70(2022 年 7 月)和问题 142842 修复,修复者为公关154342

// On Windows, there are cases in which the normalized path for a mapped folder contains a trailing `\`
// character (ex: \\server\folder\) due to the implementation of `path.normalize()`. This behaviour is
// by design as documented in https://github.com/nodejs/node/issues/1765.

该修复引用“Windows:fs.realpathSync() 添加尾部斜杠Windows 共享”。

这是今天在 VSCode Insider 中发布的。

This should be fixed with VSCode 1.70 (July 2022), and issue 142842, fixed by PR 154342.

// On Windows, there are cases in which the normalized path for a mapped folder contains a trailing `\`
// character (ex: \\server\folder\) due to the implementation of `path.normalize()`. This behaviour is
// by design as documented in https://github.com/nodejs/node/issues/1765.

The fix references "Windows: fs.realpathSync() adds trailing slash for windows share".

This is released in VSCode insider today.

绝影如岚 2025-01-18 09:12:12

对于任何为此苦苦挣扎的人 - 当您在 VS Code 中右键单击时,似乎有 2 个源代码管理菜单。我取消选择带有快捷方式的菜单并选择不带快捷方式的菜单,现在所需的菜单又回来了!

在此处输入图像描述

For anyone struggling with this - there appears to be 2 source control menus when you right click in VS Code. I deselected the one with the shortcut and selected the one without the shortcut and now the required menu is back!

enter image description here

静若繁花 2025-01-18 09:12:12

奇怪的是我必须设置

git config --global user.name "Your Name"

git config --global user.email [email protected]

瞧!它开始显现出变化。

Weirdly enough I had to set

git config --global user.name "Your Name"

git config --global user.email [email protected]

And voila! it started to show the changes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文