Git development
 help / color / mirror / Atom feed
From: Eric James Michael Ritz <Eric@cybersprocket.com>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] Documentation: explain how to write aliases that use other aliases
Date: Fri, 15 Jan 2010 20:42:34 -0500	[thread overview]
Message-ID: <4B51198A.3010504@cybersprocket.com> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Users who try to define aliases in terms of other aliases will receive
an error about an unrecognized command.  This is because Git only
applies alias expansion once.  However, users can write aliases with
the exclamation point prefix to achieve this effect.  Teach users how
to do this by building off the example of using aliases to call shell
commands.

Signed-off-by: Eric James Michael Ritz <Eric@cybersprocket.com>
- ---
I ran into this issue try to define some aliases, and then after an
hour of hacking on alias.c a light-bulb went off in my head, and I
realized I could just use the '!' prefix to write aliases that call
other aliases.  Much simplier than the alias code I was changing, lol.
So I thought it would be useful to mention this in the manual, for
users like myself who like to build aliases from other aliases.

 Documentation/config.txt |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 8acb613..0874a0d 100644
- --- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -524,7 +524,12 @@ If the alias expansion is prefixed with an exclamation point,
 it will be treated as a shell command.  For example, defining
 "alias.new = !gitk --all --not ORIG_HEAD", the invocation
 "git new" is equivalent to running the shell command
- -"gitk --all --not ORIG_HEAD".  Note that shell commands will be
+"gitk --all --not ORIG_HEAD".  Git will not expand aliases which
+call other aliases,  but you can use the exclamation point prefix to
+achieve this effect.  For example, defining "alias.today =
+!git new --since=yesterday" will cause "git today"
+to expand to "gitk --all --not ORIG_HEAD --since=yesterday".
+Note that shell commands will be
 executed from the top-level directory of a repository, which may
 not necessarily be the current directory.

- --
1.6.6.159.g8802c



- -- 
Eric Ritz
Cyber Sprocket Labs
(843) 225-3830
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJLURmKAAoJEEHUZXw5hMWsCZoIALh+tvIJHNVVQtPr1xOEtuYg
fGh4GUdDOwzsWekbxoUpzFwaE0zteawIlG7QYrLKkuFtR4E3bziM86HpIZ4nIy8b
wnZzFVSEGfhAIkhxICsSWFDZp1R0tUN5+i5NOhIrMC0nnQ0aM36Ruzyt1GbntkH1
uBsO9NYpoP+a4HQRGtafXNg2jBC1PoWy3UWTpETsIUHlV3CTrAr17uVbSDt0QSK+
lfhD717w88mvfewJaNwqnrXskADmE+bYbQBr2dvUAutbcRKx0+HREz3ju+/oTtfN
nGaSOX/kLUfTIR4+aGz6u2bkfaGt8WDBibGnC1d0l/c9jxvlodOBZxWcFscxZ4A=
=Divy
-----END PGP SIGNATURE-----

                 reply	other threads:[~2010-01-16  1:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B51198A.3010504@cybersprocket.com \
    --to=eric@cybersprocket.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox