Git - revert deleted untracked files

2k views Asked by At

By accident i deleted PHP files with:

git clean -xfd

There is any good files recover tool for Windown PC to recover those files? Or any other good solution?

Thanks!

1

There are 1 answers

0
Jona Santana On

wish its not late for this... but... if you didn't change the remote branch yet, you can make this:

git fetch --all // make you localrepo match with remoteRepo

(you can use -- if you want to fetch just 1 branch)

git reset --hard origin/<remote_branch>

With those commands you will have your local branch as the remote branch.

Example:

File = index.html

Remote branch(dev) = <html>... a lot of stuff ... </html>

Local Branch(dev) = <html><html><html><html>Bugged or deleted<html><html>

After git fetch --dev && git reset --hard origin/dev you local branch will be like the remote one.