无法拉取,因为使用 VS2015/Git 有未提交的更改

Cannot pull because there are uncommitted changes using VS2015/Git

想象一下以下场景:

Manager has created a team project and decided to use (latest) git as VCS for the project. Developer team will be working using (latest) VS2015 (Enterprise) IDE. Manager has created a new (origin) branch called "master" and then committed & pushed 2 files to that branch.

项目文件层次结构:

  Project (Root) Folder
    | notes.txt
    \ readme.md

由"Jym"和"Bennie"组成的开发团队已经拉动了origin/master分支(他们都在local/master分支上工作)。 Jym 已将第一个更改提交并推送到 "notes.txt" 文件(直接到 master 分支)。 Bennie 创建了一个名为 "todos.txt" 的新文件,并且还对 "notes.txt" 文件进行了一些更改。 现在,当 Bennie 尝试 sync/pull 更改(Jym 之前所做的更改)时,同步 window:

中会显示以下消息

Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details.

让团队的情况变得更糟的是,Bennie 也正经历着 same issue that was opened in late December last year。这意味着 Bennie 实际上无法 运行 任何 git 命令(但是,除了 "undo" 之外的所有功能似乎都可以与 Visual Studio Git/TFS 提供商一起使用 - 他发现真的很奇怪)。
也正因为如此,这个问题不是(可能)重复 another question

如何解决 Bennie 遇到的问题(根据上述场景)(当然只使用 Visual Studio)?

如果我可以提供更多详细信息,请 post 发表评论。

编辑 1(来自 for 的输出):
第一步的结果:那个答案不是错字吗,"nul"不应该是"nil"吗?

第二步的结果(设备管理器): 选中查看 -> "Show hidden devices" 选项后,任何设备名称中都没有带有小 "warning" 图标(unknown/unrecognized 设备)或 "null" 的设备。
Also, apparently "Non-Plug and Play Drivers" type is not even being listed (of course when View -> "Devices by type" is selected).

第三步的结果:%SystemRoot%\system32\drivers\null.sys文件已存在并已从磁盘中删除(从[=110复制并粘贴到null.sys文件中=] 10).
更多详细信息:一旦右键单击这些 sys 文件中的任何一个,上下文菜单中就没有 "Install" 或 "Uninstall" 选项,默认操作似乎是 "Open with..."(粗体)。

第四步的结果:尝试合并null.reg失败。重新分配了 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root 注册表项的所有者,还设置了适当的权限。
null.reg 文件在更新注册表项权限后已成功合并到注册表中。
重新启动计算机。
等待最终答案... 错误仍在显示!

编辑 2(测试 PATH 环境变量):
同样的错误仍然出现(即使在以管理员身份打开 git-cmd.exe 或 git-bash.exe 之后)。

编辑 3(电源选项,不使用 "Allow the Computer to Enter Away Mode" 设置):
Reference thread.

编辑 4:
Bennie 将他的机器从 Windows 8.1 升级到 10 后,问题就解决了。我们现在可以简单地得出操作系统已损坏的结论。

每当 GUI(这里是一个带有 Git 集成的 VS)走出标称路径(这里是 git 推送不可能立即),恢复到 git 命令行接口.

在你的情况下,伯尼需要 git pull --rebase.

打开一个 git bash,然后做(像伯尼一样)

cd /path/to/repo
git status # make sure everything is committed
git pull --rebase
git status # you see notes.txt as being in conflict
# edit notes.txt and resolve the conflict by removing merge markers
git add .
git rebase --continue

git push

注意,git pull --rebase可能很快就会得到 Visual Studio(关注 @gitforvs):

虽然还没有官方消息。


关于“Couldn't open /dev/null (or dup failed)”,看看是不是“" could help (issue with the null device).

如果错误仍然存​​在,如 git-for-windows/git issue 583,重新安装 Windows 仍然是摆脱困境的最可靠方法。

正如编辑4中的OP OmegaExtern所述,从win8升级到win10足以恢复设备并解决问题。