search

Home  >  Q&A  >  body text

github - Recover files deleted by git reset

After using the git add command to add files, git reset --hard accidentally deleted some files on the disk, but using git status you can see the files after git add. How to restore the files in the cache? The following is git Content displayed by status

phpcn_u1582phpcn_u15822741 days ago1085

reply all(3)I'll reply

  • 漂亮男人

    漂亮男人2017-06-22 11:54:45

    Commit failure means that your changes have not been indexed by git, and recovery is unlikely. Use the git refrog command to try to rescue it.

    reply
    0
  • 漂亮男人

    漂亮男人2017-06-22 11:54:45

    It feels like you can git checkout -- xxx to restore the files you want.

    Please take a screenshot of your current git status output, and explain specifically what you have done before.

    reply
    0
  • 代言

    代言2017-06-22 11:54:45

    Use the git fsck command to view the blob file, and then restore it based on the ID number. It is possible to restore it, but if there are many files to add, you have to do it one by one

    reply
    0
  • Cancelreply