[Toybox] Hello, I would like to carve out a project

idunham at lavabit.com idunham at lavabit.com
Sat May 25 01:26:48 PDT 2013


On Fri, May 24, 2013 at 03:51:46PM -0600, Terrel Shumway wrote:
> On Fri, May 24, 2013 at 11:44 AM, Rob Landley <rob at landley.net> wrote:
> > I've been using git reasonably heavily for several years, and I _still_ find
> > its user interface obnoxious and confusing and waste ten minutes looking up
> > how to do something obvious that I did last week but I'm getting some subtle
> > detail wrong. (And that's _after_ they rewrote it in 1.5.)
> 
> I am new to git. I never had the privilege of using the old UI :-)
> 
> > I still don't know how to do "hg cat -r 1234 filename" in git.
> 
> git show <revspec>:<path>
> 
> e.g.
> 
> git show  aafeaf731701e5:config.def.h
> 
> gIt will even pipe it through $PAGER if it's too long.  I'll admit that is not
> as intuitive as hg cat. I'm not even sure how to do it as an alias. :(

A git alias won't do what you want, but iff you add an arbitrary script or
binary named git-<command> then git <command> will invoke it.
IE, to use something like hg-cat put this in ~/bin/git-cat:
#!/bin/sh
REV=$2
shift 2
{
for f in $@
do git show $REV:$f
done
} |cat

Obviously, you can use $PAGER instead of cat, but that's more-or-less
the equivalent of hg cat...for a very limited subset of cases.
A proper implementation would take a few more minutes thinking, but not
much. (If anyone wants, I can write one that supports an arbitrary
number of revisions and files...or I might do it for fun anyhow.)

HTH,
Isaac Dunham


 1369470408.0


More information about the Toybox mailing list