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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With