git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to undo git-rm?
@ 2008-03-18 23:04 Neil Schemenauer
  2008-03-20  0:24 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Neil Schemenauer @ 2008-03-18 23:04 UTC (permalink / raw)
  To: git

Hi,

This seemingly simple operation has me stumped.  I removed something
from my try using "git rm" and now I want it back.  With SVN I would
use "svn cat <path> > <path>".  After some searching around, I
though git-cat-file would do the trick.  Alas, it appears as though
it looks up the SHA for the path in the index and so it too fails.

  Neil

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to undo git-rm?
  2008-03-18 23:04 How to undo git-rm? Neil Schemenauer
@ 2008-03-20  0:24 ` Junio C Hamano
  2008-03-20  0:49 ` Jakub Narebski
  2008-03-20  2:53 ` Elijah Newren
  2 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2008-03-20  0:24 UTC (permalink / raw)
  To: Neil Schemenauer; +Cc: git

Neil Schemenauer <nas@arctrix.com> writes:

> This seemingly simple operation has me stumped.  I removed something
> from my try using "git rm" and now I want it back.  With SVN I would
> use "svn cat <path> > <path>".  After some searching around, I
> though git-cat-file would do the trick.  Alas, it appears as though
> it looks up the SHA for the path in the index and so it too fails.

"git checkout HEAD -- that-path"?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to undo git-rm?
  2008-03-18 23:04 How to undo git-rm? Neil Schemenauer
  2008-03-20  0:24 ` Junio C Hamano
@ 2008-03-20  0:49 ` Jakub Narebski
  2008-03-20  2:53 ` Elijah Newren
  2 siblings, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2008-03-20  0:49 UTC (permalink / raw)
  To: Neil Schemenauer; +Cc: git

Neil Schemenauer <nas@arctrix.com> writes:

> Hi,
> 
> This seemingly simple operation has me stumped.  I removed something
> from my try using "git rm" and now I want it back.  With SVN I would
> use "svn cat <path> > <path>".  After some searching around, I
> though git-cat-file would do the trick.  Alas, it appears as though
> it looks up the SHA for the path in the index and so it too fails.

Direct equivalent would be

  $ git show HEAD:<path> > <path>   # from last commit
  $ git show :<path>     > <path>   # from index

but actually you would probably use

  $ git checkout -- <path>

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to undo git-rm?
  2008-03-18 23:04 How to undo git-rm? Neil Schemenauer
  2008-03-20  0:24 ` Junio C Hamano
  2008-03-20  0:49 ` Jakub Narebski
@ 2008-03-20  2:53 ` Elijah Newren
  2008-03-20  2:54   ` Elijah Newren
  2 siblings, 1 reply; 5+ messages in thread
From: Elijah Newren @ 2008-03-20  2:53 UTC (permalink / raw)
  To: Neil Schemenauer; +Cc: git

On Tue, Mar 18, 2008 at 5:04 PM, Neil Schemenauer <nas@arctrix.com> wrote:
> Hi,
>
>  This seemingly simple operation has me stumped.  I removed something
>  from my try using "git rm" and now I want it back.  With SVN I would
>  use "svn cat <path> > <path>".  After some searching around, I
>  though git-cat-file would do the trick.  Alas, it appears as though
>  it looks up the SHA for the path in the index and so it too fails.

Try
  git checkout HEAD eg
or
  git show HEAD:<path> > <path>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to undo git-rm?
  2008-03-20  2:53 ` Elijah Newren
@ 2008-03-20  2:54   ` Elijah Newren
  0 siblings, 0 replies; 5+ messages in thread
From: Elijah Newren @ 2008-03-20  2:54 UTC (permalink / raw)
  To: Neil Schemenauer; +Cc: git

On Wed, Mar 19, 2008 at 8:53 PM, Elijah Newren <newren@gmail.com> wrote:
> On Tue, Mar 18, 2008 at 5:04 PM, Neil Schemenauer <nas@arctrix.com> wrote:
>  > Hi,
>  >
>  >  This seemingly simple operation has me stumped.  I removed something
>  >  from my try using "git rm" and now I want it back.  With SVN I would
>  >  use "svn cat <path> > <path>".  After some searching around, I
>  >  though git-cat-file would do the trick.  Alas, it appears as though
>  >  it looks up the SHA for the path in the index and so it too fails.
>
>  Try
>   git checkout HEAD eg

doh, that should be
  git checkout HEAD <path>
of course.

>  or
>   git show HEAD:<path> > <path>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-20  2:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18 23:04 How to undo git-rm? Neil Schemenauer
2008-03-20  0:24 ` Junio C Hamano
2008-03-20  0:49 ` Jakub Narebski
2008-03-20  2:53 ` Elijah Newren
2008-03-20  2:54   ` Elijah Newren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).