有木有人知道加入.gitignore的文件有什么办法恢复出来不?ignore里删掉了一个文件,但是在实体文件夹里并没有显示出来,而且也清理过缓存了,,,
迷茫2017-05-02 09:52:46
Generally, files added .gitignore
will not be deleted locally. If you have not deleted them locally, you can definitely get them back. But I don’t quite understand some of the poster’s descriptions. What is meant by:
A file was deleted in ignore, but it is not displayed in the physical folder
Did you delete that file manually? If this is the case, git cannot indeed retrieve it, because it was not deleted through git operations, and git is not responsible for this. If you want to get it back, don't rely on git, but look for other file recovery software. Some software can help find accidentally deleted files.
In addition, if that file has been included in git management before, it is also possible to find it. For example, if you have submitted certain files before and then added them later, this will work. You can also get them back by switching to a previous commit. .gitignore
The specific method is:
git log
git checkout 31d3ea7a8
temporarily traveled to that point in time, just find the file and copy it. Finally, just switch back, assuming you were just on the master branch:
git checkout master
伊谢尔伦2017-05-02 09:52:46
First remove that file from the ignore file, and then git checkout there is a commit of the file before. Then perform recovery and other operations