Subject: Re: Objects deleted before first commit

From: Tomas Carnecky <[email-masked]>
Date: Thu, 16 Jun 2011 22:38:17 +0200

On 6/14/11 4:44 PM, PJ Weisberg wrote:
> On Tuesday, June 14, 2011, David Barr<[email-masked]>  wrote:
>> On Tue, Jun 14, 2011 at 11:00 PM, Edmondo Porcu
>> <[email-masked]>  wrote:
>>> dangling blob 43cb00bb9f23b73afc874c4105b136f8c426e4a5
>>> dangling blob 48ef642adb1549ee1d4040ec9337d3a47c19d422
>> [...]
>>
>> Was it 'rm -rf' or 'git rm -rf'?
>> If just the non-git command, maybe 'git checkout --<missing paths>'?
> Not if it was never checked in, unfortunately.

You don't need to commit the file. If you add files with `git add` and 
then delete them with plain `rm`, you can recover them with a simple 
`git checkout`, just like David suggested. See this transcript:

$ git init tmp
Initialized empty Git repository in <snip>/tmp/.git/
$ cd tmp
$ touch file
$ git add file
$ rm file
$ ls file
ls: file: No such file or directory
$ git checkout -- file
$ ls file
file
$