Many thanks.

In short, to recover a file deleted by git rm, use git fsck --unreachable to 
show the files git is holding in limbo, and then use git show $sha1name > 
filename to save each one back to your filesystem (where $sha1name is the 
blob ID shown in git fsck, and filename is the desired name of the file to 
save it in).

Now I'm off to make that first commit...

 - Jonathan Graef

On Wednesday, September 11, 2013 2:14:19 PM UTC-5, Konstantin Khomoutov 
> On Wed, 11 Sep 2013 11:43:24 -0700 (PDT) 
> superjag < <javascript:>> wrote: 
> > Silly me, I thought this would remove the project directory from the 
> > staging area, but nooooo, it has to delete the entire project. I was 
> > still staging my first commit when my project got deleted, so I can't 
> > roll back. 
> > 
> > I found this: 
> >!topic/msysgit/TLmc2996nWY 
> > 
> > But while I can see my files in some kind of command-line editor, I 
> > can't save them. ESC:w just makes a beeping noise. Any ideas? 
> > 
> > I'm running git under Windows. 
> Uh... If "I can see my files in some kind of command-line editor, I 
> > can't save them. ESC:w just makes a beeping noise." means 
> "I have run `git show $sha1_name_as_shown_by_git_fsck` and this command 
> showed me the contents of my file in some kind of command-line editor" 
> then it's just Git spawned the so-called "pager" which, unless 
> reconfigured by the user (you) in one way or another defaults to the 
> program named "less" [1] which is distributed with Git for Windows. 
> A pager consumes what another program sends to its standard input 
> stream (this program is Git in our case) and allows the user to 
> conveniently (okay, let's not discuss this aspect for a moment) view 
> this input -- sort of read-only ad-hoc Notepad. 
> "less" is ubiquitous in the Unix world but is certainly able to capture 
> a Windows user by surprise.  To quit less just press the q key (for 
> *q*uit), and to move the viewport use the page up/page down and cursor 
> keys.  less is quite versatile -- hit the h key while in it to read its 
> online help page. 
> But back to your problem...  The final answer to the thread you 
> referred to assumed you're familiar with command line, and supposed 
> that you know about stream redirections supported by it.  Specifically, 
> if a program prints something to its output, you're able to save this 
> output by redirecting it to a file, like this: 
> git show $sha1name > filename 
> The "> filename" (also could be spelled without the white space -- 
> ">filename") is the crucial bit -- it would make `git show` to write 
> whatever it prints to the file "filename". 
> Git took your by surprise because it tries to be smart and if it 
> detects it was run on an interactive terminal and the output it's about 
> to print is larger than the height of this terminal, it spawns the 
> configured or default pager and sends its output there.  If it detects 
> its output is redirected by the shell (that "> filename" thing) it just 
> prints what it should print, and this output ends up being written into 
> that file. 
> See also [2]. 
> 1. 
> 2. 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to