Question

I probably did a huge mistake.

relevant system info:

  • Windows XP SP2
  • i686 Cygwin 1.7.6 git
  • 1.7.1

I was trying to create an empty branch on a newly created git repository, here are the commands I just issued:

git init
git symbolic-ref HEAD refs/heads/klist 
rm .git/index   <---- this command failed obviously, there was no index. 
git clean -fdx  <---- this is my nightmare

problem is I was not aware the clean command really deletes the files that are in the current folder, and as this was a newly initialized git repository there is no old version to revert to.

Some of the files I have them uploaded on my home page but some are not. Any ideas on how to recover the files will be appreciated. I dont mind using any kind of recovery software, and I am aware that losing files on linux/cygwin is a pain if not impossible to recover, but hey lets give it a shot.

Was it helpful?

Solution

git clean removes untracked content, which by definition is something the repository knows nothing about. That's why it by default does nothing, requiring the -f option to do anything - it's essentially likecalling rm on everything untracked. You're pretty much stuck in desperate recovery territory at that point - as if you'd done rm -rf * yourself by accident. The files may still be on the disk, if you're lucky. Google around for "recover deleted files", or perhaps ask on superuser.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top