0

After using git clean -f -x I have lost some important files. Is there any way to get them back or at least can I check which files I have lost so that I can add them separately from other directories?

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
A 786
  • 488
  • 1
  • 6
  • 16
  • What did you run `git clean` in the first place if you knew you had some content you didn't want erased? – Tim Biegeleisen Oct 30 '18 at 02:18
  • @TimBiegeleisen I did it by mistake as most of the files were not important. I missed one which was important. – A 786 Oct 30 '18 at 02:26
  • Possible duplicate of [Can I undo a \`git clean -fdx\`?](https://stackoverflow.com/questions/6267180/can-i-undo-a-git-clean-fdx) – Kalle Richter Dec 05 '18 at 12:40

1 Answers1

2

git clean is similar to rm; it deletes the files from the file system. You can't undo the operation except by using a file system recovery utility of some kind.

Matt
  • 3,677
  • 1
  • 14
  • 24
  • thanks for your response. Can I check though which files I have lost? I have run that on a git local branch using command line. – A 786 Oct 30 '18 at 02:22
  • I don't know of a way, git doesn't write to a log when it performs an operation. I think you need to treat this the same way you would if you accidentally deleted a file (i.e. check a backup, or use some fancy software - not sure what operating system you're using but [example](https://www.linux.com/learn/get-your-data-back-linux-based-data-recovery-tools)) – Matt Oct 30 '18 at 02:33
  • It's Windows 10 OS – A 786 Oct 30 '18 at 02:34