Accidentally Deleted (overwrote) Local Files in Git Repo

1.5k views Asked by At

I executed the command git checkout -f branchName on my terminal. That made all of the changes to files I have been working on for four days go away, as I have overwritten them.

The worst part is that I didn't save my files anywhere, nor did I commit previous changes. Is there any way out from this situation? Can I restore my lost files and changes?

1

There are 1 answers

3
nikitastrike On

I have no idea why you didn't push your changes, but you can try this solution. I also recommend using Sourcetree to manage your repo.

The last resort might be trying a file recovery program like Recuva.