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

Re: Restoring files from old commits

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jul 14, 2007, 14:32 UTC
Message-ID
<20070714143233.GC2544@steel.home>
In-Reply-To
<20070714123754.GA29622@piper.oerlikon.madduck.net>
martin f krafft, Sat, Jul 14, 2007 14:37:54 +0200:
Show 10 quoted lines
> also sprach Nikodemus Siivola <nikodemus@random-state.net> [2007.07.14.1409 +0200]:
> > What is the recommended way to restore individual files
> > (or directories) in the working tree to the content they
> > had in a given commit?
> 
> As per my comment on IRC, I think
> 
>   git checkout <tree-ish> <path>
> 
> is the way.
It does not work for directories, though. On can use
    $ git ls-tree -r -z <tree-ish> -- <path> | git update-index -z --index-info
    $ git ls-tree -r --name-only -z <tree-ish> -- <path> | git checkout-index -f -z --stdin
for a more generic way to do this.

P.S. Martin, would you please stop removing people from address lists and stop using that Mail-Followup-To? People miss their mails when they are not addressed to them anymore and you doing exactly that.

Previous: martin f krafftNext: Junio C Hamano
Message 3 of 8 in “Restoring files from old commits”
  1. Nikodemus SiivolaJul 14, 2007
  2. martin f krafftJul 14, 2007
  3. Alex RiesenJul 14, 2007
  4. Junio C HamanoJul 14, 2007
  5. Alex RiesenJul 15, 2007
  6. Nikodemus SiivolaAug 15, 2007
  7. Salikh ZakirovAug 15, 2007
  8. Uwe Kleine-KönigAug 15, 2007

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.