Re: Simple problem
- From
Björn Steinbrink <b.steinbrink@gmx.de>
- Date
- Apr 28, 2008, 16:49 UTC
- Message-ID
- <20080428164945.GA14445@atjola.homenet>
- In-Reply-To
- <18453.64747.540905.586259@lisa.zopyra.com>
On 2008.04.28 11:35:55 -0500, Bill Lear wrote:
Show 21 quoted lines
> On Monday, April 28, 2008 at 16:31:05 (+0000) Kenneth P. Turvey writes: > >I ran into an issue earlier today that I didn't know how to easily solve > >in git. I'm sure it is easy to handle, but I wasn't sure how. > > > >I removed a file and then realized I'd hit the wrong one. So all I > >wanted to do was to get the file back the way it was in the last commit. > > > >Basically I wanted something similar to: > > > >svn update myfile > > > >in subversion. > > > >I got it back by using a diff and just deleting all the minus signs at > >the beginning of the lines, but I'm sure this isn't the way to handle > >this. Strangely this simple case wasn't covered by any of the tutorials > >I looked at. > > % rm file > [oops] > % git checkout file
That restores the version from the index, so it will fail if you did "git rm file". To get the file from HEAD use "git checkout HEAD -- file".
Björn