Why it exists
Git, it seems, has nothing like svn cat. Svn cat is a great tool that displays a file as it existed in a particular revision of the source tree.
I needed to see a previous version of a file, because git diff wouldn't have provided enough context, so I needed this tool.
It's probably easiest to clone this repository somewhere then create a symlink on your path with the proper naming convention.
$ git clone https://github.com/rwilcox/git-cat.git $ ln -s `pwd`/git-cat/git-cat ~/bin/git-cat
Assuming of course that you have
~/bin/ in your $PATH this will allow a workflow like:
$ git cat README.markdown 1cba2d72
I suggest a symlink under the assumption that you have
~/bin under some kind of version control already, and/or don't want to put the git-cat repository directly on your $PATH.
On the shoulders of giants
Before I built this tool I did some Google searching. Some of this searching found good information, some found... stuff that didn't work.
Got me 25% of the way there. But, of course, I wanted to be able to specify arbitrary commits too
Made me realize that what I wanted to do wasn't built into git
Useful information on git log, although I didn't end up using much of this info
Seems to solve the problem, but gives me an odd error I couldn't figure out how to fix on Git 1.6.2. Stupid git.
If you want to help here are some things I'd like to do but lack time:
- Extract help documentation from the
git-catfile and make it something that can be translated into a manpage.
- Installation script to install a
git-catsymbolic link to somewhere nice on $PATH, and also install said manpage.
- Ryan Wilcox, Wilcox Development Solutions. http://www.wilcoxd.com