Re: Restoring files from old commits
- From
- Nikodemus Siivola <nikodemus@random-state.net>
- Date
- Aug 15, 2007, 17:22 UTC
- Message-ID
- <6bcc356f0708151022v6cb8c348nb19690c81e489c5d@mail.gmail.com>
- In-Reply-To
- <20070715084141.GA2568@steel.home>
Tangentially related to my previous question:
Every once and a while I want to examine an older version of a file in an editor.
(The typical case is first looking for the source of a change with git-blame, and then wanting to look at the original code and the diff side by side.)
My current (suboptimal, I hope!) way of doing getting the file is git-cat-file: first look at the commit, then look at the tree, ... till I find the SHA1 for the file I want.
git-checkout <sha1-of-commit> <path>, but that leaves the old version in both the index and the tree, which feels icky especially if I'm giving this treatment to multiple files at the same time.
So what I'd like is something like
git cat-path <commit> <path-in-the-tree-referenced-by-that-commit>
Does this exist, or is this scripting time?
Cheers,
-- Nikodemus