{"thread":{"id":"18028","subject":"checkout vs reset","startedAt":"2009-02-26T07:08:36Z","lastAt":"2009-02-26T09:15:20Z","messageCount":3,"participants":["Jay Soffian","Sitaram Chamarty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"106297","messageId":"76718490902252308r474b193yba21b14e14a3baa@mail.gmail.com","threadId":"18028","inReplyTo":null,"subject":"checkout vs reset","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-02-26T07:08:36Z","receivedAt":"2009-02-26T07:08:36Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Is there any different between the following two commands?\n\ngit reset <commit> -- <paths>...\ngit checkout <commit> -- <paths>...\n\nAs far as I can tell from the man pages, they are equivalent. To wit:\nboth update the index and working copy for the given paths to the\nstate that they were in in <commit>.\n\nj.\n"},{"id":"106298","messageId":"76718490902252312h6a08f5a6x972523e7c7e4af16@mail.gmail.com","threadId":"18028","inReplyTo":"76718490902252308r474b193yba21b14e14a3baa@mail.gmail.com","subject":"Re: checkout vs reset","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-02-26T07:12:27Z","receivedAt":"2009-02-26T07:12:27Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Thu, Feb 26, 2009 at 2:08 AM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> Is there any different between the following two commands?\n>\n> git reset <commit> -- <paths>...\n> git checkout <commit> -- <paths>...\n>\n> As far as I can tell from the man pages, they are equivalent. To wit:\n> both update the index and working copy for the given paths to the\n> state that they were in in <commit>.\n\nDoh, answering my own question. reset only touches the index, not the\nworking copy. checkout updates both.\n\nj.\n"},{"id":"106305","messageId":"slrngqcnd8.t1u.sitaramc@sitaramc.homelinux.net","threadId":"18028","inReplyTo":"76718490902252312h6a08f5a6x972523e7c7e4af16@mail.gmail.com","subject":"Re: checkout vs reset","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-02-26T09:15:20Z","receivedAt":"2009-02-26T09:15:20Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-02-26, Jay Soffian <jaysoffian@gmail.com> wrote:\n> On Thu, Feb 26, 2009 at 2:08 AM, Jay Soffian <jaysoffian@gmail.com> wrote:\n>> Is there any different between the following two commands?\n>>\n>> git reset <commit> -- <paths>...\n>> git checkout <commit> -- <paths>...\n>>\n>> As far as I can tell from the man pages, they are equivalent. To wit:\n>> both update the index and working copy for the given paths to the\n>> state that they were in in <commit>.\n>\n> Doh, answering my own question. reset only touches the index, not the\n> working copy. checkout updates both.\n\nHowever, if the <commit> doesn't even _have_ the <path> in\nquestion, it leaves the index alone (doesn't remove it, for\ninstance):\n\nUsing HEAD as the <commit> in question for this example:\n\n    echo hi > abc       # new file, untracked so far\n    git add abc\n    git status          # it's staged\n    git reset HEAD -- abc\n    git status          # untracked\n\n    # now with checkout\n    git add abc\n    git status          # staged\n    git checkout HEAD -- abc\n    git status          # still staged\n"}]}