[PATCH] Documentation: explain how to write aliases that use other aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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@xxxxxxxxxxxxxxxxx>
- ---
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-----
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]