git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Morton <admin@game-point.net>
To: git@vger.kernel.org
Subject: Allow git alias to override existing Git commands
Date: Tue, 10 Nov 2015 16:31:21 +0000	[thread overview]
Message-ID: <56421BD9.5060501@game-point.net> (raw)

It's recently come to my attention that the "git alias" config 
functionality ignores all aliases that would override existing Git 
commands.  This seems like a bad idea to me.

For example, I wanted to setup "git clone" to automatically act as 
"git clone --recursive".  Sure I could do it in the shell, but it's 
more of a pain - any tutorial I set up about doing it would have to 
worry about what shell the user was using - and if you're going to 
make that argument, why have "git alias" at all?  It can all be done 
from the shell.

Obviously I could also use a different alias that wasn't an existing 
Git command for this behaviour, but that would rather defeat the 
point: I want "git clone" to have different functionality.  If I 
remembered to use a different Git command, I might as well remember to 
type "git clone --recursive".  Also, if a future Git command were 
introduced with the same name as my alias, my alias's functionality 
would suddenly be ignored, giving unexpected behaviour.

The reasoning behind this that it's "to avoid confusion and troubles 
with script usage" seems to be at odds with the general Git mentality 
that the user is given lots of power, and if they screw it up it's 
basically just user error.  For example, Git doesn't *have* to allow 
you to rebase.  It's a potentially dangerous operation, so why is it 
allowed?  It might "cause confusion and troubles".

On the other hand, by disallowing the overriding of existing Git 
commands through aliases you are preventing a lot of useful 
functionality that those aliases might be used for.

So I think you should either allow Git aliases to override existing 
Git commands by default, or at least provide a config option that 
allows the user to say that this should happen.

-- 
Best regards,
Jeremy Morton (Jez)

             reply	other threads:[~2015-11-10 16:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 16:31 Jeremy Morton [this message]
2015-11-10 18:12 ` Allow git alias to override existing Git commands Stefan Beller
2015-11-10 20:04   ` Jeremy Morton
2015-11-10 20:22     ` Stefan Beller
2015-11-11  4:48     ` Sitaram Chamarty
2015-11-11  9:28       ` Jeremy Morton
2015-11-11  9:51         ` Sitaram Chamarty
2015-11-11 10:12           ` Jeremy Morton
2015-11-11 10:45             ` Sitaram Chamarty
2015-11-11 17:42         ` Stefan Beller
2015-11-10 21:57   ` Jens Lehmann
2015-11-10 22:49     ` Stefan Beller
2015-11-11 19:44       ` Jens Lehmann

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=56421BD9.5060501@game-point.net \
    --to=admin@game-point.net \
    --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).