{"thread":{"id":"12948","subject":"how do i re-add a file?","startedAt":"2008-04-01T11:10:12Z","lastAt":"2008-04-01T11:41:47Z","messageCount":3,"participants":["Ittay Dror","James Sadler","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"73495","messageId":"47F21814.6000705@tikalk.com","threadId":"12948","inReplyTo":null,"subject":"how do i re-add a file?","fromName":"Ittay Dror","fromEmail":"ittayd@tikalk.com","sentAt":"2008-04-01T11:10:12Z","receivedAt":"2008-04-01T11:10:12Z","isPatch":false,"sender":{"key":"ittayd@tikalk.com","avatar":null},"body":"I did git-rm on a file and committed. Made some changes to my sources \nand committed. Now I want the file back. How can I do that? Related to \nthat, how do I revert my files to some past commit state so that the \ncommits in between are kept in the history?\n\nThank you,\nIttay\n\n-- \nIttay Dror <ittayd@tikalk.com>\nTikal <http://www.tikalk.com>\nTikal Project <http://tikal.sourceforge.net>\n"},{"id":"73502","messageId":"e5e204700804010441r61d365d6se0f58c2f49d3058@mail.gmail.com","threadId":"12948","inReplyTo":"47F21814.6000705@tikalk.com","subject":"Re: how do i re-add a file?","fromName":"James Sadler","fromEmail":"freshtonic@gmail.com","sentAt":"2008-04-01T11:41:23Z","receivedAt":"2008-04-01T11:41:23Z","isPatch":false,"sender":{"key":"freshtonic@gmail.com","avatar":"https://gravatar.com/avatar/b6650ce4e0ec8d7169a964ef15255a74205599a33a9cb8295a6018db566c2fdc?d=mp&s=160"},"body":"There are at least a couple of ways to do this.\n\ngit show <revision>:<file_name>\n\ne.g. git show HEAD^:builtin-log.c\n\nThat will output the content to the console of the file\n'builtin-log.c' at the parent revision of the current commit.   You\ncan redirect it to a file if you want.\n\ngit checkout <rev> <file_name>\n\ne.g. git checkout HEAD^ builtin-log.c\n\nWorks the same as above, except the file will be written to your\nworking tree without you having to redirect the output to a file.\n\nTake a look at the help for 'checkout' and 'show'. (e.g. git checkout --help )\n\nIn the above examples, 'HEAD^' is just a shortcut for specifying a\nrevision without entering the entire SHA1 of the commit.  See\nhttp://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html for\nmore information on the various ways you can specify revisions.\n\nAnother way to look at file content at a particular revision is via\nthe 'gitk' GUI tool that comes with git.  Fire it up by entering\n'gitk' at the command line while inside your repo.  In the pane on the\nleft, select the revision that you are interested in.  On the\nbottom-right pane, select the radio button labeled 'tree' and navigate\nthrough that to find you file.  When you select it, the content of the\nfile will be displayed on the bottom-left pane.\n\n-- \n\nJames.\n\nOn 01/04/2008, Ittay Dror <ittayd@tikalk.com> wrote:\n> I did git-rm on a file and committed. Made some changes to my sources\n>  and committed. Now I want the file back. How can I do that? Related to\n>  that, how do I revert my files to some past commit state so that the\n>  commits in between are kept in the history?\n>\n>  Thank you,\n>  Ittay\n>\n>  --\n>  Ittay Dror <ittayd@tikalk.com>\n>  Tikal <http://www.tikalk.com>\n>  Tikal Project <http://tikal.sourceforge.net>\n>\n>\n>  --\n>  To unsubscribe from this list: send the line \"unsubscribe git\" in\n>  the body of a message to majordomo@vger.kernel.org\n>  More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\n\n-- \nJames\n"},{"id":"73503","messageId":"20080401114147.GH3264@genesis.frugalware.org","threadId":"12948","inReplyTo":"47F21814.6000705@tikalk.com","subject":"Re: how do i re-add a file?","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-04-01T11:41:47Z","receivedAt":"2008-04-01T11:41:47Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Tue, Apr 01, 2008 at 02:10:12PM +0300, Ittay Dror <ittayd@tikalk.com> wrote:\n> I did git-rm on a file and committed. Made some changes to my sources and \n> committed. Now I want the file back. How can I do that? Related to that, \n> how do I revert my files to some past commit state so that the commits in \n> between are kept in the history?\n\ngit checkout HEAD^ -- path/to/file\n"}]}