2

I ran the following command and it was a disaster.

$ git clean -xfd
=>
Removing config/application.yml
Removing config/honeybadger.yml
Removing log/development.log
Removing log/production.log
Removing notes.rb
Removing public/assets/global/plugins/angularjs/plugins/angular-file-upload/uploads/
Removing public/assets/global/plugins/icheck/demo/css/custom.styl
Removing public/assets/global/plugins/icheck/demo/js/custom.js
Removing test/controllers/calculators/
Removing tmp/

It promptly removed all the files that were not tracked by git (desired). But it also removed all files that were important, but ignored in my .gitignore. How would I get those files back?

thedanotto
  • 6,895
  • 5
  • 45
  • 43

2 Answers2

0

Unless you have other safeguards in place (like Time Machine or some other hard-drive backup system), it would be impossible to restore said deleted files normally.

If that is indeed the case, I'd turn the computer off as soon as possible, and send the hard-drive to a restoration lab to restore the files (they can do it if you haven't rewrote the drive space with other data). Of course, it depends on how badly you want those files.

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
0

git checkout -- .gitignore

If you have deleted the file before adding it to the index or committing it, it is unfortunately lost and you'll have to recreate it (using your favorite text editor).

Logeshkumar
  • 131
  • 2
  • 9