3

I accidentally run the command "git clean -df", so I lost many directories and files, I want to recover them, I don't have backup in time machine. I tried some software to recover, but they don't work.

  • You can't recover files after deleting them. The only way would be to immediately shut down your Mac, WITHOUT modifying ANY part of the HD, then use a HD Recovery Program. You probably already lost your data, as it gets overwritten by new files. Let this be a lesson to use Time Machine or some other backup software, especially when using terminal commands that delete stuff. – At0mic Nov 10 '15 at 21:20
  • Are you sure that files have been deleted in the online repository? If you are working in the local repository and you have one up-to-dated online, you can download the last online version using git clone or git pull. – Mattia Nov 10 '15 at 21:45
  • @IronCraftMan thank you for your reply, do you know is there some good software for recovering files for mac OS X? I am almost try every method, but failed T.T – llyjy21 Nov 11 '15 at 7:52
  • @llyjy21 as I said, you probably already overwrote the data. By installing that other Software, and whatever else you did, OS X could have modified the HD. It's too late. Since every method has failed, I'd give up. Next time backup your data. – At0mic Nov 11 '15 at 16:06
  • Same question on SO: stackoverflow.com/questions/6267180/can-i-undo-a-git-clean-fdx – Flimm Dec 21 '16 at 17:00
1

If you are working with an online repository and you keep it up-to-date you can download all the file from the online repository using the following commands:

git pull                            # in the case the remote is set
git clone <address_of_repository>   # in the case the remote is not set

Using these commands you'll be able to restore your deleted files, obviously only if the online repository is up to date.

  • Nope, I mean it delete all my folders and files in my local machine, not related to git – llyjy21 Nov 11 '15 at 7:50
  • In this particular case the only solution is follow what IronCraftMan suggested to you. – Mattia Nov 11 '15 at 7:56
  • haha, thank you, but i prefer IronMan. haha – llyjy21 Nov 11 '15 at 11:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .