加入.gitignore的文件有什么办法恢复出来不?
伊谢尔伦
伊谢尔伦 2017-05-02 09:50:46
0
3
885

有木有人知道加入.gitignore的文件有什么办法恢复出来不?ignore里删掉了一个文件,但是在实体文件夹里并没有显示出来,而且也清理过缓存了,,,

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all (3)
迷茫

Generally, files added.gitignorewill 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..gitignoreThe specific method is:

  • To find the hash value of the submission where the file still exists (a bit hard to pronounce, but you can understand it), you can do this:

git log
  • Let’s say that commit’s hash is 31d3ea7a8 and switch to that commit (it’s a safe thing to do, don’t worry):

git checkout 31d3ea7a8
  • Now that you have

    temporarilytraveled 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
    伊谢尔伦

    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

      黄舟

      You can go to your Git repository and have a look.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!