0

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.

RaptorX
  • 331
  • 1
  • 9
  • 19

1 Answers1

3

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.

Cascabel
  • 479,068
  • 72
  • 370
  • 318
  • thanks, will do. Cool to note that my rm is aliased to a move command to a .trash folder, i went looking for the files there and i didnt see any, so the git command really deleted the files using its own 'rm' command. Also I was following directions from github and the only warning i got was: 'The following operation will lose any uncommitted changes!' there is no mention of physically removing existing files. – RaptorX Sep 10 '10 at 00:28
  • It was just an analogy. It's definitely not using your rm alias/substitute; I was just trying to emphasize how permanent it was. And... yes, that warning on github should've been much clearer and harsher. It's given in the context of a repository which already has an initial commit, but still, should read "this will permanently delete all untracked and ignored files and directories." – Cascabel Sep 10 '10 at 01:14