Action stamps
Jonathan Wakely
jwakely.gcc@gmail.com
Tue Sep 1 14:31:00 GMT 2015
On 1 September 2015 at 10:21, Eric S. Raymond wrote:
> Jason Merrill <jason@redhat.com>:
>> Given git aliases:
>>
>> > stamp = show -s --format='%cI!%ce'
>> > scommit = "!f(){ d=${1%%!*}; a=${1##*!}; arg=\"--until=$d -1\"; if [ $a != $1 ]; then arg=\"$arg --committer=$a\"; fi; shift; git rev-list $arg ${1:+\"$@\"}; }; f"
>> > smaster = "!f(){ git scommit \"$1\" trunk --first-parent; }; f"
>> > shs = "!f(){ git show $(git smaster $1); }; f"
>> > slog = "!f(){ s=$1; shift; git log $(git smaster $s) $*; }; f"
>> > sco = "!f(){ git checkout $(git smaster $1); }; f"
>>
>> and an action stamp 2015-08-20T20:55:15Z!jason, then
>>
>> git sco 2015-08-20T20:55:15Z\!jason
>>
>> will check out the (most recent) commit with that stamp. It also works with
>> just the timestamp.
>
> This is a corner of git of which I knew not. How does one set this sort of
> alias? I Google...
>
> Will git config --global alias.stamp = show -s --format='%cI!%ce
>
> and analogous command lines work?
No. You don't want the = in there to set an alias, and you need to
quote the "show -s ..." string, and escape suitably. It's easier just
to add the lines directly to ~/.gitconfig, which also lets you add a
comment saying what it does.
More information about the Gcc
mailing list