{"thread":{"id":"19616","subject":"Resetting working files","startedAt":"2009-05-31T13:09:09Z","lastAt":"2009-05-31T21:30:10Z","messageCount":8,"participants":["Aaron Gray","Dirk Süsserott","Peter Baumann","Nicolas Sebrecht","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"115131","messageId":"DA26600008CE404B831978F6EBB31C6B@HPLAPTOP","threadId":"19616","inReplyTo":null,"subject":"Resetting working files","fromName":"Aaron Gray","fromEmail":"aaronngray.lists@googlemail.com","sentAt":"2009-05-31T13:09:09Z","receivedAt":"2009-05-31T13:09:09Z","isPatch":false,"sender":{"key":"aaronngray.lists@googlemail.com","avatar":null},"body":"Hi,\n\nHow do I reset the working files back to HEAD ?\n\nMany thanks,\n\nAaron\n"},{"id":"115135","messageId":"4A229B9A.6060807@dirk.my1.cc","threadId":"19616","inReplyTo":"DA26600008CE404B831978F6EBB31C6B@HPLAPTOP","subject":"Re: Resetting working files","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2009-05-31T15:00:42Z","receivedAt":"2009-05-31T15:00:42Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Am 31.05.2009 15:09 schrieb Aaron Gray:\n> Hi,\n> \n> How do I reset the working files back to HEAD ?\n> \n> Many thanks,\n> \n> Aaron\n> \n\n$ git reset --hard\n\nThis will revert all changes you made in your working tree back to the \nHEAD. It will delete your changes made so far. To revert only a single \nfile, use\n\n$ git checkout -- path/to/file\n"},{"id":"115139","messageId":"D457E686769D44D8BE5DDC26FEEA4AE3@HPLAPTOP","threadId":"19616","inReplyTo":"4A229B9A.6060807@dirk.my1.cc","subject":"Re: Resetting working files","fromName":"Aaron Gray","fromEmail":"aaronngray.lists@googlemail.com","sentAt":"2009-05-31T15:57:48Z","receivedAt":"2009-05-31T15:57:48Z","isPatch":false,"sender":{"key":"aaronngray.lists@googlemail.com","avatar":null},"body":"> Am 31.05.2009 15:09 schrieb Aaron Gray:\n>> Hi,\n>> \n>> How do I reset the working files back to HEAD ?\n>> \n>> Many thanks,\n>> \n>> Aaron\n>> \n> \n> $ git reset --hard\n> \n> This will revert all changes you made in your working tree back to the \n> HEAD. It will delete your changes made so far. To revert only a single \n> file, use\n> \n> $ git checkout -- path/to/file\n\nGreat thanks alot Dirk, you anticipated my second question too :)\n\nCheers,\n\nAaron\n"},{"id":"115149","messageId":"20090531162515.GB8129@m62s10.vlinux.de","threadId":"19616","inReplyTo":"4A229B9A.6060807@dirk.my1.cc","subject":"Re: Resetting working files","fromName":"Peter Baumann","fromEmail":"waste.manager@gmx.de","sentAt":"2009-05-31T16:25:15Z","receivedAt":"2009-05-31T16:25:15Z","isPatch":false,"sender":{"key":"waste.manager@gmx.de","avatar":null},"body":"On Sun, May 31, 2009 at 05:00:42PM +0200, Dirk Süsserott wrote:\n> Am 31.05.2009 15:09 schrieb Aaron Gray:\n>> Hi,\n>>\n>> How do I reset the working files back to HEAD ?\n>>\n>> Many thanks,\n>>\n>> Aaron\n>>\n\n[...]\n\n> To revert only a single file, use\n>\n> $ git checkout -- path/to/file\n>\n\nThis will only reset the file content to the version in the index.\nE.g. \n\n\techo modified >> a.txt\n\tgit add a.txt\n\tgit checkout -- a.txt           (1)\n\n\tgit checkout HEAD -- a.txt\t(2)\n\n\n(1) This will do nothing to your file 'a.txt' in your workdir because\n    the index and the workdir are identical\n\n(2) This will reset your file to the state before you run that bogus\n    echo modified >> a.txt   comand\n\nGreetings,\nPeter\n"},{"id":"115154","messageId":"9719867c0905310950x153db8efw179a8a10ac3f4640@mail.gmail.com","threadId":"19616","inReplyTo":"20090531163225.GE3674@debian.b2j","subject":"Re: Resetting working files","fromName":"Aaron Gray","fromEmail":"aaronngray.lists@googlemail.com","sentAt":"2009-05-31T16:50:35Z","receivedAt":"2009-05-31T16:50:35Z","isPatch":false,"sender":{"key":"aaronngray.lists@googlemail.com","avatar":null},"body":"2009/5/31 bill lam <cbill.lam@gmail.com>\n>\n> On Sun, 31 May 2009, Peter Baumann wrote:\n> >       echo modified >> a.txt\n> >       git add a.txt\n> >       git checkout -- a.txt           (1)\n> >\n> >       git checkout HEAD -- a.txt      (2)\n> >\n> >\n> > (1) This will do nothing to your file 'a.txt' in your workdir because\n> >     the index and the workdir are identical\n> >\n> > (2) This will reset your file to the state before you run that bogus\n> >     echo modified >> a.txt   comand\n>\n> I still do not understand what index is.\n> 1. is index an replica of the committed tree\n> 2. is index only transient in that its content will be reset once\n>   committed?\n> 3. or other ?\n\nI think index is HEAD or a revision hash. Am I correct ?\n\nAaron\n"},{"id":"115155","messageId":"20090531173932.GA13856@vidovic","threadId":"19616","inReplyTo":"9719867c0905310950x153db8efw179a8a10ac3f4640@mail.gmail.com","subject":"Re: Resetting working files","fromName":"Nicolas Sebrecht","fromEmail":"nicolas.s.dev@gmx.fr","sentAt":"2009-05-31T17:39:32Z","receivedAt":"2009-05-31T17:39:32Z","isPatch":false,"sender":{"key":"nicolas.s.dev@gmx.fr","avatar":null},"body":"The 31/05/09, Aaron Gray wrote:\n\n> > I still do not understand what index is.\n> > 1. is index an replica of the committed tree\n> > 2. is index only transient in that its content will be reset once\n> >   committed?\n> > 3. or other ?\n> \n> I think index is HEAD or a revision hash. Am I correct ?\n\nHEAD is a reference to a branch name:\n$ cat .git/HEAD\nref: refs/heads/master\n$\n\nThe branch name is a reference to a commit:\n$ cat .git/refs/heads/master\na80aad7b85fc560451e07792d64ab6cb15a39914\n$\n\nThe index is what will be committed by 'git commit'.\n\n-- \nNicolas Sebrecht\n"},{"id":"115158","messageId":"34D6982455BA4A7E9F5D2D467DC4A55C@HPLAPTOP","threadId":"19616","inReplyTo":"20090531173932.GA13856@vidovic","subject":"Re: Resetting working files","fromName":"Aaron Gray","fromEmail":"aaronngray.lists@googlemail.com","sentAt":"2009-05-31T19:31:50Z","receivedAt":"2009-05-31T19:31:50Z","isPatch":false,"sender":{"key":"aaronngray.lists@googlemail.com","avatar":null},"body":"> The 31/05/09, Aaron Gray wrote:\n>\n>> > I still do not understand what index is.\n>> > 1. is index an replica of the committed tree\n>> > 2. is index only transient in that its content will be reset once\n>> > committed?\n>> > 3. or other ?\n>>\n>> I think index is HEAD or a revision hash. Am I correct ?\n>\n> HEAD is a reference to a branch name:\n> $ cat .git/HEAD\n> ref: refs/heads/master\n> $\n>\n> The branch name is a reference to a commit:\n> $ cat .git/refs/heads/master\n> a80aad7b85fc560451e07792d64ab6cb15a39914\n> $\n>\n> The index is what will be committed by 'git commit'.\n\nObviously alot more to learn about GIT, hopefully the O'Reilly book will \nclue me up as I am still getting problems with using GIT properly.\n\nThanks Nicolas,\n\nAaron\n"},{"id":"115165","messageId":"81b0412b0905311430v7874013cm6db84bd12d749134@mail.gmail.com","threadId":"19616","inReplyTo":"20090531173932.GA13856@vidovic","subject":"Re: Resetting working files","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-05-31T21:30:10Z","receivedAt":"2009-05-31T21:30:10Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2009/5/31 Nicolas Sebrecht <nicolas.s.dev@gmx.fr>:\n> The 31/05/09, Aaron Gray wrote:\n>>\n>> I think index is HEAD or a revision hash. Am I correct ?\n>\n> HEAD is a reference to a branch name:\n\nNot really. Try \"git checkout HEAD^\" and run cat .git/HEAD\n\nIt is more a pointer to a commit. The pointers to a commit\nin git are allowed to be indirect by referencing other pointers.\n"}]}