{"thread":{"id":"12768","subject":"How to undo git-rm?","startedAt":"2008-03-18T23:04:41Z","lastAt":"2008-03-20T02:54:40Z","messageCount":5,"participants":["Neil Schemenauer","Junio C Hamano","Jakub Narebski","Elijah Newren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72448","messageId":"20080318230441.GA664@arctrix.com","threadId":"12768","inReplyTo":null,"subject":"How to undo git-rm?","fromName":"Neil Schemenauer","fromEmail":"nas@arctrix.com","sentAt":"2008-03-18T23:04:41Z","receivedAt":"2008-03-18T23:04:41Z","isPatch":false,"sender":{"key":"nas@arctrix.com","avatar":null},"body":"Hi,\n\nThis seemingly simple operation has me stumped.  I removed something\nfrom my try using \"git rm\" and now I want it back.  With SVN I would\nuse \"svn cat <path> > <path>\".  After some searching around, I\nthough git-cat-file would do the trick.  Alas, it appears as though\nit looks up the SHA for the path in the index and so it too fails.\n\n  Neil\n"},{"id":"72449","messageId":"7v63vi1bvj.fsf@gitster.siamese.dyndns.org","threadId":"12768","inReplyTo":"20080318230441.GA664@arctrix.com","subject":"Re: How to undo git-rm?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-20T00:24:00Z","receivedAt":"2008-03-20T00:24:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Neil Schemenauer <nas@arctrix.com> writes:\n\n> This seemingly simple operation has me stumped.  I removed something\n> from my try using \"git rm\" and now I want it back.  With SVN I would\n> use \"svn cat <path> > <path>\".  After some searching around, I\n> though git-cat-file would do the trick.  Alas, it appears as though\n> it looks up the SHA for the path in the index and so it too fails.\n\n\"git checkout HEAD -- that-path\"?\n"},{"id":"72459","messageId":"m31w66w76k.fsf@localhost.localdomain","threadId":"12768","inReplyTo":"20080318230441.GA664@arctrix.com","subject":"Re: How to undo git-rm?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-03-20T00:49:46Z","receivedAt":"2008-03-20T00:49:46Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Neil Schemenauer <nas@arctrix.com> writes:\n\n> Hi,\n> \n> This seemingly simple operation has me stumped.  I removed something\n> from my try using \"git rm\" and now I want it back.  With SVN I would\n> use \"svn cat <path> > <path>\".  After some searching around, I\n> though git-cat-file would do the trick.  Alas, it appears as though\n> it looks up the SHA for the path in the index and so it too fails.\n\nDirect equivalent would be\n\n  $ git show HEAD:<path> > <path>   # from last commit\n  $ git show :<path>     > <path>   # from index\n\nbut actually you would probably use\n\n  $ git checkout -- <path>\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"72471","messageId":"51419b2c0803191953y7842ddf8l7a6de37226cb12e2@mail.gmail.com","threadId":"12768","inReplyTo":"20080318230441.GA664@arctrix.com","subject":"Re: How to undo git-rm?","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2008-03-20T02:53:34Z","receivedAt":"2008-03-20T02:53:34Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Mar 18, 2008 at 5:04 PM, Neil Schemenauer <nas@arctrix.com> wrote:\n> Hi,\n>\n>  This seemingly simple operation has me stumped.  I removed something\n>  from my try using \"git rm\" and now I want it back.  With SVN I would\n>  use \"svn cat <path> > <path>\".  After some searching around, I\n>  though git-cat-file would do the trick.  Alas, it appears as though\n>  it looks up the SHA for the path in the index and so it too fails.\n\nTry\n  git checkout HEAD eg\nor\n  git show HEAD:<path> > <path>\n"},{"id":"72472","messageId":"51419b2c0803191954q1811c351jc65ff1ac541f07a2@mail.gmail.com","threadId":"12768","inReplyTo":"51419b2c0803191953y7842ddf8l7a6de37226cb12e2@mail.gmail.com","subject":"Re: How to undo git-rm?","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2008-03-20T02:54:40Z","receivedAt":"2008-03-20T02:54:40Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Mar 19, 2008 at 8:53 PM, Elijah Newren <newren@gmail.com> wrote:\n> On Tue, Mar 18, 2008 at 5:04 PM, Neil Schemenauer <nas@arctrix.com> wrote:\n>  > Hi,\n>  >\n>  >  This seemingly simple operation has me stumped.  I removed something\n>  >  from my try using \"git rm\" and now I want it back.  With SVN I would\n>  >  use \"svn cat <path> > <path>\".  After some searching around, I\n>  >  though git-cat-file would do the trick.  Alas, it appears as though\n>  >  it looks up the SHA for the path in the index and so it too fails.\n>\n>  Try\n>   git checkout HEAD eg\n\ndoh, that should be\n  git checkout HEAD <path>\nof course.\n\n>  or\n>   git show HEAD:<path> > <path>\n"}]}