From: Gelonida N <gelonida@gmail.com>
To: git@vger.kernel.org
Subject: Re: git alias and --help
Date: Fri, 28 Oct 2011 02:24:07 +0200 [thread overview]
Message-ID: <j8csn7$v1u$1@dough.gmane.org> (raw)
In-Reply-To: <7v8vo6xd4u.fsf@alter.siamese.dyndns.org>
On 10/28/2011 12:50 AM, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Gelonida N <gelonida@gmail.com> writes:
>>
>>> Is there any trick to get the help text of git branch without
>>> having to type
>>>
>>> git branch --help
>>
>> How about "git help branch"?
>
> It was bad of me to write a tongue-in-cheek answer, get distracted and
> ended up sending it without the real answer.
No issues. At least I got an answer :-)
>
> The reason why we do not do what you seem to be suggesting is because
> giving the same behaviour to "git b --help" as "git branch --help" is
> wrong.
>
> To see why, imagine you have configured an alias that is not a simple and
> stupid substitution "b == branch", but something like "bt == branch -t",
> and then want to know what you should write after "git bt". Giving the
> manpage for branch without giving them any hint that they configured that
> alias to produce customized behaviour that is different from plain vanilla
> "branch" is not quite acceptable.
>
> I think you _could_ make a patch that special cases a simple and straight
> substitution and skip the "foo is aliased to bar" step, but I doubt it is
> worth it to lose consistency between "git b --help" vs "git bt --help"
> that way.
I understand the reasoning and agree, that as general case it might not
be a good idea to have the behaviour, taht I expected to be the default
behaviour
It's just, that I am lazy so I shortened my most common commands
For example:
co=checkout
ci=commit
b=branch
sm=submodule
However I'm not smart enough to remember all options for all commands
and so I have to ask git for occasional help.
It feels so 'unlazy' to have to type the full command 'just' to get help
What I wondered though is whether there couldn't be a way to be lazy and
avoid confusion.
1.) prompt for full help
-------------------------
One option would be to display what the command is aliased to and to
prompt whether one wants to see the full help of the base command.
`git b' is aliased to `branch'
pleaset press h if you want to see the full help for git branch
or press q to quit
2.) allow copy paste by displaying the command to be typed for help.
---------------------------------------------------------------------
display sometihing like:
`git b' is aliased to `branch'
for help about the branch command type: git --help
Then lazy people could copy paste the command instead of typing it.
3.) special alias syntax to allow 'forwarding' of --help
------------------------------------------------------------
some kind of special alias syntax, which explicitely forces that --help
is 'forwarded' to the alias and not treated by git
example:
b = branch # --help would have the current behaviour
I tried following to see whether '--help' is now being 'forwarded'
b = ! git branch
but also here --help is treated by git
A possibility could be another 'special' character. For the sake of the
example I used '?'
b = ?branch # 'the question mark would allow 'forwarding' the
# --help option to the alias'
b = ?! git branch
My workaround
------------
Fort the time being I might do something like
bhlp = branch --help
I would have prefered b_hlp or b_h, but it seems underscore isn't
allowed in an alias.
next prev parent reply other threads:[~2011-10-28 0:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-27 22:20 git alias and --help Gelonida N
2011-10-27 22:28 ` Junio C Hamano
2011-10-27 22:50 ` Junio C Hamano
2011-10-28 0:24 ` Gelonida N [this message]
2011-10-28 1:51 ` Miles Bader
2011-10-28 4:05 ` Junio C Hamano
2011-10-28 9:00 ` Michael J Gruber
2011-10-28 9:17 ` Gelonida N
2011-10-28 13:27 ` Jakub Narebski
2011-10-28 20:21 ` Gelonida N
2011-10-28 13:26 ` Jakub Narebski
2011-10-28 18:07 ` Junio C Hamano
2011-10-28 18:25 ` Miles Bader
2011-10-28 20:23 ` Gelonida N
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='j8csn7$v1u$1@dough.gmane.org' \
--to=gelonida@gmail.com \
--cc=git@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).