How to recover files from command "git clean -df"

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.


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.