# Help reverting a particular file

3 messages from 2008-08-11 to 2008-08-12. Participants: Bryan Richardson, Eric Raible, Alex Riesen.
Thread: https://gitlist.dev/t/14945

## Bryan Richardson, 2008-08-11 23:00

Subject: Help reverting a particular file
Message-ID: <3f81a4240808111600u78c5eeefu588a6b1250a0dd02@mail.gmail.com>
URL: https://gitlist.dev/e/3f81a4240808111600u78c5eeefu588a6b1250a0dd02%40mail.gmail.com

```
Hello all,

Can anyone tell me how to revert a particular file using git?  I
executed a commit, then froze my Rails application to the latest Rails
version.  This caused my custom config/boot.rb file to be overwritten
and I would like to restore it without rolling back to the previous
commit (which would roll back the rails freeze).  In general I need to
know how to do this anyway. :)

Please help!

--
Thanks!
Bryan

```

## Eric Raible, 2008-08-11 23:33

Subject: Re: Help reverting a particular file
Message-ID: <loom.20080811T232642-623@post.gmane.org>
URL: https://gitlist.dev/e/loom.20080811T232642-623%40post.gmane.org
In-Reply-To: <3f81a4240808111600u78c5eeefu588a6b1250a0dd02@mail.gmail.com>

```
Bryan Richardson <btricha <at> gmail.com> writes:

> 
> Hello all,
> 
> Can anyone tell me how to revert a particular file using git?  I
> executed a commit, then froze my Rails application to the latest Rails
> version.  This caused my custom config/boot.rb file to be overwritten
> and I would like to restore it without rolling back to the previous
> commit (which would roll back the rails freeze).  In general I need to
> know how to do this anyway. :)
> 
> Please help!
> 
> --
> Thanks!
> Bryan
> 

See corresponding man page for full details, but briefly:

# Updates index as well
git checkout HEAD^ -- config/boot.rb

or

# Output can be redirected
git show HEAD^:config/boot.rb

- Eric

```

## Alex Riesen, 2008-08-12 06:15

Subject: Re: Help reverting a particular file
Message-ID: <20080812061538.GA3824@blimp.local>
URL: https://gitlist.dev/e/20080812061538.GA3824%40blimp.local
In-Reply-To: <loom.20080811T232642-623@post.gmane.org>

```
Eric Raible, Tue, Aug 12, 2008 01:33:17 +0200:
> Bryan Richardson <btricha <at> gmail.com> writes:
> > 
> > Can anyone tell me how to revert a particular file using git?  I
> > executed a commit, then froze my Rails application to the latest Rails
> > version.  This caused my custom config/boot.rb file to be overwritten
> > and I would like to restore it without rolling back to the previous
> > commit (which would roll back the rails freeze).  In general I need to
> > know how to do this anyway. :)
> > 
> 
> See corresponding man page for full details, but briefly:
> 
> # Updates index as well
> git checkout HEAD^ -- config/boot.rb
> 

That'd revert it to the _previous_ commit, not the current, while he
seems to need the recently committed state in his working tree:

  git checkout HEAD -- config/boot.rb

```
