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

Re: How do get a specific version of a particular file?

From
Christian MICHON <christian.michon@gmail.com>
Date
Feb 27, 2007, 12:43 UTC
Message-ID
<46d6db660702270443w22361619p8cfb624780ee5a57@mail.gmail.com>
In-Reply-To
<E1HM1XL-00071C-N5@candygram.thunk.org>
quoting Linus:
Well, you can just add
       [alias]
               cat=-p cat-file -p
to your ~/.gitconfig file, and you're there.
[ For all the non-git people here: the first "-p" is shorthand for
 "--paginate", and means that git will automatically start a pager for
 the output. The second "-p" is shorthand for "pretty" (there's no
 long-format command line switch for it, though), and means that git
 cat-file will show the result in a human-readable way, regardless of
 whether it's just a text-file, or a git directory ]
So then you can do just
       git cat todo:TODO
and you're done.
[ So for the non-git people, what that will actually _do_ is to show the
 TODO file in the "todo" branch - regardless of whether it is checked out
 or not, and start a pager for you. ]

I actually do this sometimes, but I've never done it for branches (and I do it seldom enough that I haven't added the alias). I do it for things like

       git cat v2.6.16:Makefile
-- 
Christian
Previous: Theodore Ts'oNext: Peter Baumann
Message 2 of 32 in “How do get a specific version of a particular file?”
  1. Theodore Ts'oFeb 27, 2007
  2. Christian MICHONFeb 27, 2007
  3. Peter BaumannFeb 27, 2007
  4. Alex RiesenFeb 27, 2007
  5. Alex RiesenFeb 27, 2007
  6. Johannes SchindelinFeb 27, 2007
  7. Theodore TsoFeb 27, 2007
  8. Johannes SchindelinFeb 27, 2007
  9. Theodore TsoFeb 27, 2007
  10. Randal L. SchwartzFeb 27, 2007
  11. Junio C HamanoFeb 27, 2007
  12. Linus TorvaldsFeb 28, 2007
  13. Junio C HamanoFeb 28, 2007
  14. Johannes SchindelinFeb 28, 2007
  15. Linus TorvaldsFeb 28, 2007
  16. Nicolas PitreFeb 28, 2007
  17. Linus TorvaldsFeb 28, 2007
  18. Nicolas PitreFeb 28, 2007
  19. Theodore TsoFeb 28, 2007
  20. Junio C HamanoFeb 28, 2007
  21. Theodore TsoFeb 28, 2007
  22. Junio C HamanoFeb 28, 2007
  23. Nicolas PitreFeb 28, 2007
  24. Johannes SchindelinFeb 28, 2007
  25. Linus TorvaldsFeb 28, 2007
  26. Junio C HamanoFeb 28, 2007
  27. Johannes SchindelinFeb 28, 2007
  28. Fix git-show man page formatting in the EXAMPLES sectionTheodore Tso, Feb 27, 2007
  29. Linus TorvaldsFeb 27, 2007
  30. Bill LearFeb 27, 2007
  31. Theodore TsoFeb 27, 2007
  32. Linus TorvaldsFeb 27, 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.