From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Using '--help' for aliases
Date: Sat, 24 Jun 2017 17:20:11 +0000 [thread overview]
Message-ID: <20170624172011.5afp3qhrec5ovynl@genre.crustytoothpaste.net> (raw)
In-Reply-To: <1498070489.32360.14.camel@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]
On Thu, Jun 22, 2017 at 12:11:29AM +0530, Kaartic Sivaraam wrote:
> I am yet another user of 'git alias' (who wouldn't ?). It has become so
> natural to me to use the aliased version that at some point of time I
> tried the following,
>
> > $ git co --help
> > `git co' is aliased to `checkout'
>
> That made me wonder. Git is able to inform the user that 'co' is
> aliased to 'checkout' but isn't it possible for it to take one step
> more to display help ? Just wondering if there were any reason for not
> doing it.
It's possible to do if "co" is an alias for "checkout", but it works
less well when co is the following[0]:
co = "!f() { if git checkout -h | grep -qs recurse-submodules; \
then git checkout --recurse-submodules \"$@\"; \
else git checkout \"$@\" && git sui; \
fi; };f"
If this alias were to run on a Git with that option but without checkout
--recurse-submodules, then it would print help and then update
submodles, which isn't what I want.
[0] sui is an alias for submodule update --init.
--
brian m. carlson / brian with sandals: Houston, Texas, US
https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]
prev parent reply other threads:[~2017-06-24 17:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 18:41 Using '--help' for aliases Kaartic Sivaraam
2017-06-21 18:55 ` Jeff King
2017-06-21 19:14 ` Kaartic Sivaraam
2017-06-22 5:39 ` Samuel Lijin
2017-06-24 17:20 ` brian m. carlson [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170624172011.5afp3qhrec5ovynl@genre.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=git@vger.kernel.org \
--cc=kaarticsivaraam91196@gmail.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).