{"thread":{"id":"46992","subject":"Multiple ways to undo changes to a file in the tip commit","startedAt":"2017-10-18T13:57:33Z","lastAt":"2017-10-18T13:57:33Z","messageCount":1,"participants":["Robert Dailey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"330600","messageId":"CAHd499BYsDwHRttBKxSbJS452-+VYPLnJ38z5yyHv=KkvHV0UA@mail.gmail.com","threadId":"46992","inReplyTo":null,"subject":"Multiple ways to undo changes to a file in the tip commit","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2017-10-18T13:57:26Z","receivedAt":"2017-10-18T13:57:33Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"Suppose the tip commit of my branch contains changes to multiple\nfiles. If I want to revert all changes in one file from that commit, I\nhave two options that I know of:\n\n$ git reset @^ -- foo.txt\n$ git commit --amend --no-edit\n$ git checkout -- foo.txt\n\nOr:\n\n$ git checkout @^ -- foo.txt\n$ git commit --amend --no-edit\n\nFor simpler steps, I normally use the latter option. However, is there\nvalue in the former option (using reset)? When would you use one or\nthe other?\n\nDisclaimer: I just typed up the above commands, I might have some\ndetails wrong, but hopefully you get the gist of it.\n\nThanks in advance.\n"}]}