[英]`git stash apply` deleted a random dir from my working copy
I just tried git stash save
for the first time. 我只是第一次尝试
git stash save
。 It worked fine. 工作正常。 Then I tried
git stash apply
and while my uncommitted changes were restored, another effect was that a random dir from the root of my working copy was deleted. 然后,我尝试应用
git stash apply
并还原了我未提交的更改,但另一个效果是删除了工作副本根目录中的随机目录。 I don't know why it chose that exact dir, there's lots of other dirs like it in the root. 我不知道为什么它选择了这个确切的目录,在根目录中还有很多其他类似的目录。
git stash save
output: git stash save
输出:
Saved working directory and index state WIP on clipping: cfeac4b - applying the solution from http://stackoverflow.com/questions/40385482/why-cant-i-use-opengl-es-3-0-in-qt
HEAD is now at cfeac4b - applying the solution from http://stackoverflow.com/questions/40385482/why-cant-i-use-opengl-es-3-0-in-qt
Shortened git stash apply
output: 缩短
git stash apply
输出:
Removing debug_stencil_not_working/textureandlight.js
Removing debug_stencil_not_working/qtlogo.png
[... more removes here ...]
On branch clipping
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: documentation/textureSize_missing.txt
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: ../debug_stencil_not_working/qtlogo.png
deleted: ../debug_stencil_not_working/textureandlight.js
[... more deleted files here ...]
modified: main.cpp
modified: main.qml
[... more modified files here ...]
Untracked files:
(use "git add <file>..." to include in what will be committed)
../dbg_repeater/dbg_repeater.pro.user
debug_stencil_not_working/
[... more files and dirs here ...]
Note: The dir that got deleted was a committed and pushed dir. 注意:被删除的目录是已提交并推送的目录。 It had no uncommitted local changes.
它没有未提交的本地更改。
Any idea why this random dir got deleted? 知道为什么这个随机目录被删除了吗?
Also, how to restore this dir? 另外,如何还原该目录? When I browse to the root in the github web interface, it's there.
当我浏览到github Web界面中的根目录时,它就在那里。 But I tried
git pull origin clipping
and it didn't pull that dir back into the my working copy. 但是我尝试了
git pull origin clipping
,但并没有将该目录拉回到我的工作副本中。
Edit: I figured out how to restore it. 编辑:我想出了如何还原它。 In the TortoiseGit context menu I selected "Diff", and in the list the deleted files were listed as "missing".
在TortoiseGit上下文菜单中,我选择“差异”,在列表中,已删除的文件被列为“缺失”。 I selected them all, right clicked them, and selected "revert".
我全部选中了它们,右键单击它们,然后选择“还原”。 Still don't know why the dir got deleted in the first place.
仍然不知道为什么目录首先被删除。
I had the same problem, and I found out by coincident, that in one of the .gitignore files there was an entry with that directory which was deleted on the form: directory/* or directory/** It is only causes when the directory is followed by the wild card char. 我遇到了同样的问题,巧合的是,我发现一个.gitignore文件中存在一个带有该目录的条目,该条目以以下形式删除:directory / *或directory / **这仅是由于当目录其次是通配符char。
Removing that line in my case resolved the problem (it should not have been there anyway) 在我的情况下,删除该行解决了问题(无论如何都不应该存在)
I am sorry, but I cannot explain why git does this, maybe someone else can. 抱歉,但是我无法解释git为什么这样做,也许其他人也可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.