# default aliases (ci, di, st, co)

19 messages from 2009-07-08 to 2009-07-13. Participants: Ondrej Certik, Jakub Narebski, Andreas Ericsson, Michael J Gruber, Luciano Miguel Ferreira Rocha, Graeme Geldenhuys, Matthieu Moy, Junio C Hamano, Larry D'Anna, Paolo Bonzini, Jeff King.
Thread: https://gitlist.dev/t/20060

## Ondrej Certik, 2009-07-08 23:49

Subject: default aliases (ci, di, st, co)
Message-ID: <85b5c3130907081649s37f726f7id1a64f2fdbe609f@mail.gmail.com>
URL: https://gitlist.dev/e/85b5c3130907081649s37f726f7id1a64f2fdbe609f%40mail.gmail.com

```
Hi,

coming to git from mercurial and svn, here is the alias part of my .gitconfig:

[alias]
    ci = commit
    di = diff --color-words
    st = status
    co = checkout


And all is fine until I share commands to checkout my branch (for
example) with other people, then basically I have to write those
commands in full (e.g. commit, checkout, ...), since I cannot assume
they have their .gitconfig setup the same way I do. Especially for
people who are new to git.

What is the view on this in the git community? Do most of you write

git checkout -b branch ...

(possibly with TAB completion) or do most of you write

git co -b branch ...

(like I do all the time, except when sharing my commands with other people)?

Could in principle those aliases be even made default by git? Or is
this not a good idea.

Ondrej

```

## Jakub Narebski, 2009-07-09 00:13

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <m3my7evhky.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3my7evhky.fsf%40localhost.localdomain
In-Reply-To: <85b5c3130907081649s37f726f7id1a64f2fdbe609f@mail.gmail.com>

```
Ondrej Certik <ondrej@certik.cz> writes:

> coming to git from mercurial and svn, here is the alias part of my
> .gitconfig:
> 
> [alias]
>     ci = commit
>     di = diff --color-words
>     st = status
>     co = checkout
> 
> 
> And all is fine until I share commands to checkout my branch (for
> example) with other people, then basically I have to write those
> commands in full (e.g. commit, checkout, ...), since I cannot assume
> they have their .gitconfig setup the same way I do. Especially for
> people who are new to git.

If you have admin rights on the machine, you can do that either using
system git config file (git config --system) i.e. $(prefix)/etc/gitconfig
or rather $(sysconfdir)/gitconfig, or by providing 'config' template
(copied as default repository config on init) in some place like
/usr/share/git-core/templates/config .

> 
> What is the view on this in the git community? Do most of you write
> 
> git checkout -b branch ...
> 
> (possibly with TAB completion) or do most of you write
> 
> git co -b branch ...
> 
> (like I do all the time, except when sharing my commands with other
> people)?

I use tab completion for commands like "git commit", "git show", "git
checkout" etc. (most important part is branch completion, not command
completion IMVHO).

But I do have few aliases:

[alias]
        cat  =    cat-file -p
        less = -p cat-file -p
        alias = config --get-regexp ^alias\\.
        lg = log --pretty=oneline --abbrev-commit
        one = show -s --pretty='format:%h (%s)'
        llog = log --date=local
        who = "!sh -c 'git log -1 --pretty=\"format:%an <%ae>\" --author=\"$1\"' -"
        lb = for-each-ref --format='%(refname)' \
             --sort=-authordate --count=8 refs/heads/
        rllog = log -g --date=relative
        rlg   = reflog show @{now}
        sed = !git ls-files --stage | grep ^100 | awk '{print $4}' | xargs sed

I use most often "git one" aliase (hmmm... I have just noticed that
"git lg" alias is now superfluous with new '--oneline' option).

> Could in principle those aliases be even made default by git? Or is
> this not a good idea.

The "default/built-in aliases" idea was discussed on git mailing list
a few times in the past...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Andreas Ericsson, 2009-07-09 07:00

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <4A55958E.1050401@op5.se>
URL: https://gitlist.dev/e/4A55958E.1050401%40op5.se
In-Reply-To: <85b5c3130907081649s37f726f7id1a64f2fdbe609f@mail.gmail.com>

```
Ondrej Certik wrote:
> Hi,
> 
> coming to git from mercurial and svn, here is the alias part of my .gitconfig:
> 
> [alias]
>     ci = commit
>     di = diff --color-words
>     st = status
>     co = checkout
> 
> 
> And all is fine until I share commands to checkout my branch (for
> example) with other people, then basically I have to write those
> commands in full (e.g. commit, checkout, ...), since I cannot assume
> they have their .gitconfig setup the same way I do. Especially for
> people who are new to git.
> 
> What is the view on this in the git community?


Personally I think "plain" aliases like you use above are evil.
git is not svn or mercurial. If you use it like svn you'll be
surprised sooner or later and your workflow will feel awkward or
just plain wrong. hg and git are very similar, but the fact that
hg assumed the svn shorthands implies to me that they've tried
to retain a compatibility that does not, in fact, exist. DVCS
systems are enormously different from centralized ones. Borrowing
from centralized ones to a DVCS one feels utterly backwards.


> Do most of you write
> 
> git checkout -b branch ...
> 
> (possibly with TAB completion) or do most of you write
> 
> git co -b branch ...
> 
> (like I do all the time, except when sharing my commands with other people)?
> 

I have no simple aliases for any of the commands. There's just no reason
for them since tab completion works so well.

I do have one alias, which is "wsfix". It fixes whitespace fsckups I've
added to the index but not yet committed to the worktree. It's not a
particularly complex one, but not exactly simple either.


> Could in principle those aliases be even made default by git? Or is
> this not a good idea.
> 

I see no reason to add default aliases. It will make a mess of things
when trying to explain workflows to people who have older versions of
git where those default aliases aren't available. It'll add complexity
to explanations, which is never a good thing.

If I have a vote, I vote no.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

```

## Michael J Gruber, 2009-07-09 08:50

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <4A55AF45.4040700@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4A55AF45.4040700%40drmicha.warpmail.net
In-Reply-To: <4A55958E.1050401@op5.se>

```
Andreas Ericsson venit, vidit, dixit 09.07.2009 09:00:
> Ondrej Certik wrote:
>> Hi,
>>
>> coming to git from mercurial and svn, here is the alias part of my .gitconfig:
>>
>> [alias]
>>     ci = commit
>>     di = diff --color-words
>>     st = status
>>     co = checkout
>>
>>
>> And all is fine until I share commands to checkout my branch (for
>> example) with other people, then basically I have to write those
>> commands in full (e.g. commit, checkout, ...), since I cannot assume
>> they have their .gitconfig setup the same way I do. Especially for
>> people who are new to git.
>>
>> What is the view on this in the git community?
> 
> 
> Personally I think "plain" aliases like you use above are evil.
> git is not svn or mercurial. If you use it like svn you'll be
> surprised sooner or later and your workflow will feel awkward or
> just plain wrong. hg and git are very similar, but the fact that
> hg assumed the svn shorthands implies to me that they've tried
> to retain a compatibility that does not, in fact, exist. DVCS
> systems are enormously different from centralized ones. Borrowing
> from centralized ones to a DVCS one feels utterly backwards.
> 
> 
>> Do most of you write
>>
>> git checkout -b branch ...
>>
>> (possibly with TAB completion) or do most of you write
>>
>> git co -b branch ...
>>
>> (like I do all the time, except when sharing my commands with other people)?
>>
> 
> I have no simple aliases for any of the commands. There's just no reason
> for them since tab completion works so well.
> 
> I do have one alias, which is "wsfix". It fixes whitespace fsckups I've
> added to the index but not yet committed to the worktree. It's not a
> particularly complex one, but not exactly simple either.
> 
> 
>> Could in principle those aliases be even made default by git? Or is
>> this not a good idea.
>>
> 
> I see no reason to add default aliases. It will make a mess of things
> when trying to explain workflows to people who have older versions of
> git where those default aliases aren't available. It'll add complexity
> to explanations, which is never a good thing.
> 
> If I have a vote, I vote no.
> 

Adding my no-vote to that, too.

Aliases are great, but default aliases are a problem. We saw this when
we introduced "git stage", and I don't think we're happy in retrorespect.

Having said that, collecting useful aliases (e.g. one, who, ...) in
contrib/ or in the wiki would be helpful.

Michael

```

## Graeme Geldenhuys, 2009-07-09 08:58

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <h34bgf$7s4$1@ger.gmane.org>
URL: https://gitlist.dev/e/h34bgf%247s4%241%40ger.gmane.org
In-Reply-To: <m3my7evhky.fsf@localhost.localdomain>

```
Jakub Narebski wrote:
>         one = show -s --pretty='format:%h (%s)'

I like that one. It's going to be very handy for when I post commit 
messages to my project newsgroup, as a subject title.


> I use most often "git one" aliase (hmmm... I have just noticed that
> "git lg" alias is now superfluous with new '--oneline' option).

:-)  I only learned about --oneline yesterday myself and was going to 
mention that to you. You beat me to it.


Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

```

## Luciano Miguel Ferreira Rocha, 2009-07-09 08:58

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <20090709085837.GA12348@bit.office.eurotux.com>
URL: https://gitlist.dev/e/20090709085837.GA12348%40bit.office.eurotux.com
In-Reply-To: <4A55958E.1050401@op5.se>

```
On Thu, Jul 09, 2009 at 09:00:30AM +0200, Andreas Ericsson wrote:
>  Ondrej Certik wrote:
> > Hi,
> > coming to git from mercurial and svn, here is the alias part of my 
> > .gitconfig:
> > [alias]
> >     ci = commit
> >     di = diff --color-words
> >     st = status
> >     co = checkout
> > And all is fine until I share commands to checkout my branch (for
> > example) with other people, then basically I have to write those
> > commands in full (e.g. commit, checkout, ...), since I cannot assume
> > they have their .gitconfig setup the same way I do. Especially for
> > people who are new to git.
> > What is the view on this in the git community?
> 
> 
>  Personally I think "plain" aliases like you use above are evil.
>  git is not svn or mercurial. If you use it like svn you'll be
>  surprised sooner or later and your workflow will feel awkward or
>  just plain wrong. hg and git are very similar, but the fact that
>  hg assumed the svn shorthands implies to me that they've tried
>  to retain a compatibility that does not, in fact, exist.

No, it just means that shorting common commands is useful and common.

>  I have no simple aliases for any of the commands. There's just no reason
>  for them since tab completion works so well.

"Intelligent" bash completion always gets in my way, so I can't use it.

I vote yes.

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

```

## Graeme Geldenhuys, 2009-07-09 09:01

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <h34bms$8to$1@ger.gmane.org>
URL: https://gitlist.dev/e/h34bms%248to%241%40ger.gmane.org
In-Reply-To: <85b5c3130907081649s37f726f7id1a64f2fdbe609f@mail.gmail.com>

```
Ondrej Certik wrote:
> [alias]
>     ci = commit
>     di = diff --color-words
>     st = status
>     co = checkout
> 

I also gave from SVN and I must admit, I did create co, st, ci aliases, 
but basically never used them, so removed them since. Git is not SVN, so 
why treat it as such.

Alternatively, you can put your alias somewhere on a wiki or personal 
web page and just refer user to look at your alias list, instead of 
having to explain to them every time why your git commands are 
non-standard. It might save you some time and effort - in the long run.

Or just learn the full git commands. ;-)


Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

```

## Graeme Geldenhuys, 2009-07-09 09:04

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <h34br8$8to$2@ger.gmane.org>
URL: https://gitlist.dev/e/h34br8%248to%242%40ger.gmane.org
In-Reply-To: <4A55AF45.4040700@drmicha.warpmail.net>

```
Michael J Gruber wrote:
> 
> Having said that, collecting useful aliases (e.g. one, who, ...) in
> contrib/ or in the wiki would be helpful.

+1 to that. I only spotted the 'one' alias now. So simple yet very 
handy. :-)



Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

```

## Matthieu Moy, 2009-07-09 09:12

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <vpqy6qycj9l.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqy6qycj9l.fsf%40bauges.imag.fr
In-Reply-To: <h34bms$8to$1@ger.gmane.org>

```
Graeme Geldenhuys <graemeg@gmail.com> writes:

> Ondrej Certik wrote:
>> [alias]
>>     ci = commit
>>     di = diff --color-words
>>     st = status
>>     co = checkout
>>
>
> I also gave from SVN and I must admit, I did create co, st, ci
> aliases, but basically never used them, so removed them since. Git is
> not SVN, so why treat it as such.

co is indeed particularly nasty. Yes, it's common for cvs/svn
old-timers, but "co" is a prefix of "COmmit", and means "CheckOut".
That's really misleading.

And the problem with aliases is that although they are good for
personnal use, they become bad when people use them publicly : either
in mail messages or in scripts. Ask about something that requires "git
commit" on the Git mailing list, everybody will be talking about "git
commit", not one about "git ci", the other about "git checkin" and the
last one about "git commit". That's far less misleading (yes, the
example is oversimplified, but if I advise someone to use "git diff
--color-words", he/she understands what I'm talking about immediately,
while if I advise "git di", it requires more time).

One thing I'd like to see is a wizard that creates a ~/.gitconfig with
this section commented out when it does not exist, like

[alias]
# Aliases, uncomment the lines to use them.
# ci = commit
# di = diff --color-words

To reduce the effort of people willing to use aliases, without making
them totally official.

-- 
Matthieu

```

## Jakub Narebski, 2009-07-09 09:40

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <200907091140.16651.jnareb@gmail.com>
URL: https://gitlist.dev/e/200907091140.16651.jnareb%40gmail.com
In-Reply-To: <4A55AF45.4040700@drmicha.warpmail.net>

```
On Thu, 9 July 2009, Michael J Gruber wrote:

[...]
> Aliases are great, but default aliases are a problem. We saw this when
> we introduced "git stage", and I don't think we're happy in
> retrorespect. 
> 
> Having said that, collecting useful aliases (e.g. one, who, ...) in
> contrib/ or in the wiki would be helpful.

http://git.or.cz/gitwiki/Aliases

-- 
Jakub Narebski
Poland

```

## Michael J Gruber, 2009-07-09 09:48

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <4A55BD07.9010907@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4A55BD07.9010907%40drmicha.warpmail.net
In-Reply-To: <200907091140.16651.jnareb@gmail.com>

```
Jakub Narebski venit, vidit, dixit 09.07.2009 11:40:
> On Thu, 9 July 2009, Michael J Gruber wrote:
> 
> [...]
>> Aliases are great, but default aliases are a problem. We saw this when
>> we introduced "git stage", and I don't think we're happy in
>> retrorespect. 
>>
>> Having said that, collecting useful aliases (e.g. one, who, ...) in
>> contrib/ or in the wiki would be helpful.
> 
> http://git.or.cz/gitwiki/Aliases
> 

Thanks, I know, I added "git serve" a long time ago. I guess my use of
"would" was quite misleading.

Michael

```

## Junio C Hamano, 2009-07-09 16:43

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <7vskh53iyt.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vskh53iyt.fsf%40alter.siamese.dyndns.org
In-Reply-To: <m3my7evhky.fsf@localhost.localdomain>

```
Jakub Narebski <jnareb@gmail.com> writes:

>         one = show -s --pretty='format:%h (%s)'

If you use "git one" for quoting a commit in the log message, please use a
format that shows the date as well (I think I posted mine to the list in
the past).

```

## Andreas Ericsson, 2009-07-09 20:54

Subject: wsfix alias
Message-ID: <4A56590F.9050206@op5.se>
URL: https://gitlist.dev/e/4A56590F.9050206%40op5.se
In-Reply-To: <20090709160249.GA12830@cthulhu>

```
Larry D'Anna wrote:
> * Andreas Ericsson (ae@op5.se) [090709 03:04]:
>> I do have one alias, which is "wsfix". It fixes whitespace fsckups I've
>> added to the index but not yet committed to the worktree. It's not a
>> particularly complex one, but not exactly simple either.
> 
> oooh, i can has?
> 
>       --larry

These are quite stupid and can lose data for you. Please use with some care.
Oh, and I lied. I have two aliases. wsfixi is the one that applies staged
stuff. wsfix fixes all whitespace errors since the last commit and stages
all changes in the index. Again, use with care, and don't hang me if they
break your day ;-)

Mind the wrapping if your mua does things like that.

[alias]
  wsfix = !git diff HEAD >P.diff && git reset --hard && git apply --whitespace=fix P.diff && rm -f P.diff
  wsfixi = !git diff --cached >P.diff && git reset && git apply --whitespace=fix P.diff && rm -f P.diff

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

```

## Larry D'Anna, 2009-07-09 21:30

Subject: Re: wsfix alias
Message-ID: <20090709213028.GA28293@cthulhu>
URL: https://gitlist.dev/e/20090709213028.GA28293%40cthulhu
In-Reply-To: <4A56590F.9050206@op5.se>

```
* Andreas Ericsson (ae@op5.se) [090709 16:54]:
> Larry D'Anna wrote:
>> * Andreas Ericsson (ae@op5.se) [090709 03:04]:
>>> I do have one alias, which is "wsfix". It fixes whitespace fsckups I've
>>> added to the index but not yet committed to the worktree. It's not a
>>> particularly complex one, but not exactly simple either.
>>
>> oooh, i can has?
>>
>>       --larry
>
> These are quite stupid and can lose data for you. Please use with some care.
> Oh, and I lied. I have two aliases. wsfixi is the one that applies staged
> stuff. wsfix fixes all whitespace errors since the last commit and stages
> all changes in the index. Again, use with care, and don't hang me if they
> break your day ;-)
>
> Mind the wrapping if your mua does things like that.
>
> [alias]
>  wsfix = !git diff HEAD >P.diff && git reset --hard && git apply --whitespace=fix P.diff && rm -f P.diff
>  wsfixi = !git diff --cached >P.diff && git reset && git apply --whitespace=fix P.diff && rm -f P.diff

a safer one: 

xargs -0 -I: <<'EOF' git config --file ~/.gitconfig alias.wsfix :
!
. "$(git --exec-path)"/git-sh-setup
if git-diff --quiet --exit-code; then
    if git diff --cached --check >/dev/null; then
        exit 0;
    fi
    echo fixing
    git diff --cached > $GIT_DIR/wsfix.diff
    git apply -R $GIT_DIR/wsfix.diff
    git apply --whitespace=fix $GIT_DIR/wsfix.diff
    rm -f $GIT_DIR/wsfix.diff
else
    echo wokring tree is dirty\!
fi
EOF


        --larry

```

## Paolo Bonzini, 2009-07-09 23:08

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <4A56786B.7040904@gnu.org>
URL: https://gitlist.dev/e/4A56786B.7040904%40gnu.org
In-Reply-To: <7vskh53iyt.fsf@alter.siamese.dyndns.org>

```
On 07/09/2009 06:43 PM, Junio C Hamano wrote:
> Jakub Narebski<jnareb@gmail.com>  writes:
>
>>          one = show -s --pretty='format:%h (%s)'
>
> If you use "git one" for quoting a commit in the log message, please use a
> format that shows the date as well (I think I posted mine to the list in
> the past).

Yes, it's in the wiki and in my .gitconfig:

         whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\" 
\"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9] 
[-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -"

BTW, the wiki shows a nice trick to avoid the extra ' quotation:

         whatis = "!f() { git show -s --pretty='format:%h (%s, %ai' 
\"$@\" | sed -e 's/ [012][0-9]:[0-5][0-9]:[0-5][0-9] 
[-+][0-9][0-9][0-9][0-9]$/)\\n/'; }; f"


Paolo

```

## Ondrej Certik, 2009-07-12 05:07

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <85b5c3130907112207x74449b12qcff25b96711c42e1@mail.gmail.com>
URL: https://gitlist.dev/e/85b5c3130907112207x74449b12qcff25b96711c42e1%40mail.gmail.com
In-Reply-To: <20090709085837.GA12348@bit.office.eurotux.com>

```
On Thu, Jul 9, 2009 at 2:58 AM, Luciano Miguel Ferreira
Rocha<luciano@eurotux.com> wrote:
> On Thu, Jul 09, 2009 at 09:00:30AM +0200, Andreas Ericsson wrote:
>>  Ondrej Certik wrote:
>> > Hi,
>> > coming to git from mercurial and svn, here is the alias part of my
>> > .gitconfig:
>> > [alias]
>> >     ci = commit
>> >     di = diff --color-words
>> >     st = status
>> >     co = checkout
>> > And all is fine until I share commands to checkout my branch (for
>> > example) with other people, then basically I have to write those
>> > commands in full (e.g. commit, checkout, ...), since I cannot assume
>> > they have their .gitconfig setup the same way I do. Especially for
>> > people who are new to git.
>> > What is the view on this in the git community?
>>
>>
>>  Personally I think "plain" aliases like you use above are evil.
>>  git is not svn or mercurial. If you use it like svn you'll be
>>  surprised sooner or later and your workflow will feel awkward or
>>  just plain wrong. hg and git are very similar, but the fact that
>>  hg assumed the svn shorthands implies to me that they've tried
>>  to retain a compatibility that does not, in fact, exist.
>
> No, it just means that shorting common commands is useful and common.
>
>>  I have no simple aliases for any of the commands. There's just no reason
>>  for them since tab completion works so well.
>
> "Intelligent" bash completion always gets in my way, so I can't use it.
>
> I vote yes.



Thanks everyone for contributing to the discussion. So it seems that
most people are against such aliases.

I only want to correct one thing --- I use git exactly because it's
not svn and exactly because it's not mercurial, things like git
branches, git remote branches, rebase -i, are still truly unique, and
in my experience once one tries it, he never wants to come back.

That said, I do use "git ci" and "git st" very often and I don't think
it infers any kind of workflow. TAB completion doesn't help, because I
need to write "git stat<TAB>", e.g. I save exactly one letter., commit
is better, there I just need "git com<TAB>", but I am still faster
with my aliases. Maybe "git co" is nasty, but I never had any problems
with that either.

Ondrej

```

## Jeff King, 2009-07-13 06:40

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <20090713064027.GA10300@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090713064027.GA10300%40coredump.intra.peff.net
In-Reply-To: <4A56786B.7040904@gnu.org>

```
On Fri, Jul 10, 2009 at 01:08:27AM +0200, Paolo Bonzini wrote:

> Yes, it's in the wiki and in my .gitconfig:
> 
>         whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\"
> \"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9]
> [-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -"

Is there a reason not to simply use:

  whatis = "show -s --pretty='format:%h (%s, %ad)' --date=short"

these days?

-Peff

P.S. Actually, I use --no-pager in my version, so I use 'tformat' to
explicitly end it with a newline, which is nicer for actually showing
the output on the terminal.

```

## Jeff King, 2009-07-13 06:43

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <20090713064309.GB10300@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20090713064309.GB10300%40coredump.intra.peff.net
In-Reply-To: <20090713064027.GA10300@coredump.intra.peff.net>

```
On Mon, Jul 13, 2009 at 02:40:27AM -0400, Jeff King wrote:

> On Fri, Jul 10, 2009 at 01:08:27AM +0200, Paolo Bonzini wrote:
> 
> > Yes, it's in the wiki and in my .gitconfig:
> > 
> >         whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\"
> > \"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9]
> > [-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -"
> 
> Is there a reason not to simply use:
> 
>   whatis = "show -s --pretty='format:%h (%s, %ad)' --date=short"
> 
> these days?
> 
> -Peff
> 
> P.S. Actually, I use --no-pager in my version, so I use 'tformat' to
> explicitly end it with a newline, which is nicer for actually showing
> the output on the terminal.

Er, actually, I see yours adds the newline explicitly in the sed
invocation, so it would definitely be 'tformat' to match what yours
does.

-Peff

```

## Paolo Bonzini, 2009-07-13 09:15

Subject: Re: default aliases (ci, di, st, co)
Message-ID: <4A5AFB20.6010403@gnu.org>
URL: https://gitlist.dev/e/4A5AFB20.6010403%40gnu.org
In-Reply-To: <20090713064027.GA10300@coredump.intra.peff.net>

```
On 07/13/2009 08:40 AM, Jeff King wrote:
> On Fri, Jul 10, 2009 at 01:08:27AM +0200, Paolo Bonzini wrote:
>
>> Yes, it's in the wiki and in my .gitconfig:
>>
>>          whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\"
>> \"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9]
>> [-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -"
>
> Is there a reason not to simply use:
>
>    whatis = "show -s --pretty='format:%h (%s, %ad)' --date=short"
>
> these days?

With s/format/tformat, which I just learnt about, no, there is no reason.

Thanks!

Paolo

```
