# Multiple ways to undo changes to a file in the tip commit

1 messages from 2017-10-18 to 2017-10-18. Participants: Robert Dailey.
Thread: https://gitlist.dev/t/46992

## Robert Dailey, 2017-10-18 13:57

Subject: Multiple ways to undo changes to a file in the tip commit
Message-ID: <CAHd499BYsDwHRttBKxSbJS452-+VYPLnJ38z5yyHv=KkvHV0UA@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd499BYsDwHRttBKxSbJS452-%2BVYPLnJ38z5yyHv%3DKkvHV0UA%40mail.gmail.com

```
Suppose the tip commit of my branch contains changes to multiple
files. If I want to revert all changes in one file from that commit, I
have two options that I know of:

$ git reset @^ -- foo.txt
$ git commit --amend --no-edit
$ git checkout -- foo.txt

Or:

$ git checkout @^ -- foo.txt
$ git commit --amend --no-edit

For simpler steps, I normally use the latter option. However, is there
value in the former option (using reset)? When would you use one or
the other?

Disclaimer: I just typed up the above commands, I might have some
details wrong, but hopefully you get the gist of it.

Thanks in advance.

```
