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

Re: Moving a file back to an earlier revision.

From
Petr Baudis <pasky@suse.cz>
Date
Apr 1, 2006, 23:01 UTC
Message-ID
<20060401230144.GL27689@pasky.or.cz>
In-Reply-To
<4dd15d180603311332p60fa1867nc303bd92d515b4e0@mail.gmail.com>

Dear diary, on Fri, Mar 31, 2006 at 11:32:16PM CEST, I got a letter where David Ho <davidkwho@gmail.com> said that...

Show 8 quoted lines
> Sorry I might already have found it.
> 
> File revisions
> 
> +----+----+
> 1    2    3
> 
> git diff commit(3)..commit(1) filename | git-apply

Note that it might be more convenient to just say "restore the file to the contents as of commit X" - in pure Git this would involve dances with git-ls-tree and git-cat-file, I'm not sure if the core Git porcelain has an interface for doing this easily.

In Cogito, you can just do:
	cg-restore -f -r commitid filename
-- 
				Petr "Pasky on a dialup" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.
Previous: Karl Hasselström
Message 8 of 8 in “Moving a file back to an earlier revision.”
  1. David HoMar 31, 2006
  2. Linus TorvaldsMar 31, 2006
  3. David HoMar 31, 2006
  4. David HoMar 31, 2006
  5. Junio C HamanoMar 31, 2006
  6. David HoMar 31, 2006
  7. Karl HasselströmApr 3, 2006
  8. Petr BaudisApr 1, 2006

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.