Monday, August 31, 2015

git recover deleted file where no commit was made after the delete

If you want to restore all of the files at once

Remember to use the period because it tells git to grab all of the files.

This command will reset the head and unstage all of the changes:

$ git reset HEAD .

Then run this to restore all of the files:

$ git checkout .

Then doing a git status, you'll get:

$ git status

On branch master
Your branch is up-to-date with 'origin/master'.

Reference:

http://stackoverflow.com/questions/11956710/git-recover-deleted-file-where-no-commit-was-made-after-the-delete

No comments: