简体   繁体   English

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

[英]Cannot pull because there are uncommitted changes using VS2015/Git

Imagine the following scenario: 想象一下以下场景:

Manager has created a team project and decided to use (latest) git as VCS for the project. Manager创建了一个团队项目,并决定使用(最新的)git作为项目的VCS。 Developer team will be working using (latest) VS2015 (Enterprise) IDE. 开发人员团队将使用(最新)VS2015(企业)IDE。 Manager has created a new (origin) branch called "master" and then committed & pushed 2 files to that branch. Manager创建了一个名为“master”的新(origin)分支,然后将2个文件提交并推送到该分支。

Project file hierarchy: 项目文件层次:

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

Developer team made of "Jym" and "Bennie" has pulled origin/master branch (and both of them are working on local/master branch). 由“Jym”和“Bennie”组成的开发团队已经取消了origin / master分支(他们都在本地/主分支上工作)。 Jym has committed & pushed the first change to "notes.txt" file (directly to master branch). Jym已经承诺并将第一个更改推送到“notes.txt”文件(直接转到master分支)。 Bennie has created a new file called "todos.txt", and also was making some changes to "notes.txt" file. Bennie创建了一个名为“todos.txt”的新文件,并且还对“notes.txt”文件进行了一些更改。 Now when Bennie tries to sync/pull changes (that were made earlier by Jym), the following message is displayed in Synchronization window: 现在当Bennie尝试同步/拉出更改(由Jym早期做出)时,同步窗口中会显示以下消息:

Cannot pull because there are uncommitted changes. 无法拉动,因为有未提交的更改。 Commit or undo your changes before pulling again. 在再次拉动之前提交或撤消更改。 See the Output window for details. 有关详细信息,请参见输出窗口

To make things a whole lot worse for the team, Bennie is also experiencing the exact same issue that was opened in late December last year . 为了让团队变得更糟糕,Bennie也遇到了去年12月底开设的完全相同的问题 This means that Bennie is practically unable to run any git command (however, all features but "undo" seems to work fine with Visual Studio Git/TFS providers - which he have found really weird). 这意味着Bennie实际上无法运行任何git命令(但是,所有功能,但“撤消”似乎与Visual Studio Git / TFS提供程序一起使用 - 他发现这非常奇怪)。
Also because of that, this question is not (possible) duplicate of another question . 也正因为如此,这个问题不是(可能)与另一个问题重复。

How to solve the issue (from scenario described above) that Bennie is experiencing (using only Visual Studio of course)? 如何解决Bennie遇到的问题(来自上述场景)(当然只使用Visual Studio)?

If there are any more details I can provide, please just post a comment. 如果我能提供更多详细信息,请发表评论。

EDIT 1 (output from suggested answer for solving "null" device ): 编辑1解决“空”设备的 建议答案的输出):
Results from the first step : Isn't that a typo in that answer, shouldn't "nul" be "nil"? 第一步的结果:在那个答案中不是一个错字,不应该“nul”为“nil”吗?
见截图

Results from the second step (Device Manager): With View -> "Show hidden devices" option checked, there are no devices with small "warning" icon (unknown/unrecognized device) or "null" in any of devices' names. 第二步的结果(设备管理器):选中查看 - >“显示隐藏的设备”选项,没有任何设备名称中带有小“警告”图标(未知/无法识别的设备)或“空”的设备。
Also, apparently "Non-Plug and Play Drivers" type is not even being listed (of course when View -> "Devices by type" is selected). 此外,显然甚至没有列出“非即插即用驱动程序”类型(当然,当选择View - >“按类型设备”时)。

Results from the third step : %SystemRoot%\\system32\\drivers\\null.sys file had existed and was deleted from the disk (copied and pasted in null.sys file from Windows 10). 第三步的结果: %SystemRoot%\\system32\\drivers\\null.sys文件已存在并已从磁盘中删除(从Windows 10复制并粘贴到null.sys文件中)。
More details: Once right-clicked any of those sys files, there is no "Install" nor "Uninstall" option in context menu, default action seems to be "Open with..." (which is bolded). 更多细节:一旦右键单击任何这些sys文件,上下文菜单中没有“Install”或“Uninstall”选项,默认操作似乎是“Open with ...”(以粗体显示)。

Results from fourth step : Attempt to merge null.reg failed. 第四步的结果:尝试合并null.reg失败。 Reassigned owner of HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root registry key, also set up appropriate permissions. 重新分配HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root注册表项的所有者,还设置了相应的权限。
null.reg file was successfully merged into registry after updating registry key permissions. 更新注册表项权限后, null.reg文件已成功合并到注册表中。
Restarting a computer. 重新启动计算机。
Waiting for the final answer ... Error still on show! 等待最终答案...... 错误仍然显示!
见截图

EDIT 2 (testing PATH environment variable): 编辑2 (测试PATH环境变量):
见截图 Same error still occurs (even after opening git-cmd.exe or git-bash.exe as administrator). 仍然会出现相同的错误(即使以管理员身份打开git-cmd.exe或git-bash.exe)。

EDIT 3 (power options, not using "Allow the Computer to Enter Away Mode" setting): 编辑3 (电源选项,不使用“允许计算机进入离开模式”设置):
Reference thread . 参考线程
见截图

EDIT 4 : 编辑4
After Bennie has upgraded his machine from Windows 8.1 to 10, issue has been solved. Bennie将他的机器从Windows 8.1升级到10后,问题已经解决。 We can now simply conclude that operating system was corrupted. 我们现在可以简单地断定操作系统已损坏。

Whenever a GUI (here a VS with Git integration) steps out of the nominal path (here a git push not immediately possible), revert to the git command line interface. 每当GUI(这里是一个带有Git集成的VS)走出标称路径(这里不能立即进行git推送)时,请恢复到git命令行界面。

In your case, Bernie needs to aa git pull --rebase . 在你的情况下,伯尼需要一个git pull --rebase

Open a git bash, and do (as Bernie) 打开一个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

Note, git pull --rebase might come soon to Got for Visual Studio (follow @gitforvs ): 注意, git pull --rebase 可能很快就会出现在Visual Studio中(关注@gitforvs ):

g4vs

Nothing official yet though. 但是没有官方的话。


Regarding " Couldn't open /dev/null (or dup failed) ", see if " Getting errors when using GitHub for Windows " could help (issue with the null device ). 关于“ Couldn't open /dev/null (or dup failed) ”,看看“ 使用GitHub for Windows时获取错误 ”可能有所帮助( null设备问题 )。

IF the error persists though, as in git-for-windows/git issue 583 , re-installing Windows remains the surest way to get out of this predicament. 如果错误仍然存​​在,例如在git-for-windows / git问题583中 ,重新安装Windows仍然是摆脱这种困境的最可靠方法。

As mentioned by the OP OmegaExtern in Edit 4, upgrading from win8 to win10 was enough to restore the device and solve the issue. 正如编辑4中的OP OmegaExtern所提到的,从win8升级到win10足以恢复设备并解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM