git 找回被误删的文件
滿天的星座
滿天的星座 2017-04-28 09:05:55
0
4
611

今天发现github 中某个文件丢失了,只记得些文件名的一些关键词,搜索了下,使用

git ls-files --deleted

没有效果。

请问下 是否可以通过一些关键词找到被删除的文件,然后恢复。

我的git version 是 1.9.4-preview20140929.

感谢。

滿天的星座
滿天的星座

reply all (4)
漂亮男人

git checkout to try an earlier version?

    PHPzhong

    This software is called Git, not GitHub!

    git log -S字符串或者git log -G正则可以搜索。具体功能和用法请见手册(man git-log).

      仅有的幸福

      Gitk gives it a try, brings up the visualization window, and uses the search function to search for the file.

        为情所困

        Just checkout the file directly from the local server. There is no need to pull it from the remote server
        Because all historical versions are available locally.

        git checkout file

        Recover multiple deleted files at the same time:
        git ls-files -d | xargs -i git checkout {}

        Reference: How to restore locally deleted files with git

          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!