git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Help reverting a particular file

From
Alex Riesen <raa.lkml@gmail.com>
Date
Aug 12, 2008, 06:15 UTC
Message-ID
<20080812061538.GA3824@blimp.local>
In-Reply-To
<loom.20080811T232642-623@post.gmane.org>
Eric Raible, Tue, Aug 12, 2008 01:33:17 +0200:
Show 15 quoted lines
> 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
Previous: Eric Raible
Message 3 of 3 in “Help reverting a particular file”
  1. Bryan RichardsonAug 11, 2008
  2. Eric RaibleAug 11, 2008
  3. Alex RiesenAug 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.