Restore files removed by Git checkout

I have accidentally forgot to "git add ." a bunch of files that I have created before creating a new branch using "git checkout -b name" and all my un-staged files have been replaced by the files from the head.

Is there any way of retrieving these files? They are not in stash nor they have been commited. Also I am not using an IDE which keeps a history of files.

I have read about "git fsck --lost-found", but before I try that, is there any other way I can revert the un-staged files back onto the filesystem?


Unfortunately there is no way (not that I have found). Once I did something like that, but I was using Aptana Studio and could recover all the files.

Anyway, a good practice is to maintain your commits small. When you do that you'll never loose more than 30 minutes even with accidents like that.

链接地址: http://www.djcxy.com/p/4026.html

上一篇: git add + git reset硬删除工作拷贝文件

下一篇: 恢复由Git结帐移除的文件