Reputation: 1986
I had a folder with ROR code lets call it "subfolder" under main folder call it "mainfolder" I made a mistake and ran "git init subfolder" from the "main folder" That command deleted most of the code there except the tmp, log and empty app directory
I further pulled from the git remote from the subfolder without realizing that the files got deleted
then touch readme
then add . then commit -m "first commit" that's when I got files a message like
master 34f2e90] first commit 42 files changed, 84328 insertions(+) create mode 100644 README create mode 100644 log/development.log create mode 100644 tmp/cache/assets/C7A/6A0/sprockets%2F442a717507a3dde80b7d59671208324c create mode 100644 tmp/cache/assets/C9F/560/sprockets%2F8e5a9738e9bc15478e026d98335454f9 create mode 100644 tmp/cache/assets/CBF/380/sprockets%2F4f4c8476962893413bc66624ebedc372
Then
git push origin master
Counting objects: 127, done. Delta compression using up to 2 threads. Compressing objects: 100% (85/85), done. Writing objects: 100% (126/126), 389.53 KiB, done. Total 126 (delta 14), reused 0 (delta 0)
Is there any way to recover those deleted files?
Thanks
Upvotes: 0
Views: 167
Reputation: 13763
Git init does not delete files. It only adds a .git directory.
You must have accidentally run another command to delete those files. Can you show the output of your shell "history" command for the commands surrounding this event?
Upvotes: 1