git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: stupid git alias trick
Date: Thu, 21 Jul 2011 17:06:29 -0600	[thread overview]
Message-ID: <4E28B0F5.2090705@redhat.com> (raw)

Thought I'd share this one, in case anyone else finds it useful.

Every so often, I find myself typing "git ", then pausing while thinking 
of which command I meant to run (commit, rebase, push?), then realizing 
that I actually need to make more edits in my editor first.  On 
completion of that task, I come back to terminal and type "git 
blah<ENTER>" out of habit, not realizing that I'm not starting from an 
empty prompt.  Of course, "git git blah" is not a valid command, but if 
you have help.autocorrect configured, this ends up auto-correcting to 
"git init blah" instead, and while that often ends up failing due to 
unexpected arguments for 'git init', I've actually had scenarios where 
it succeeds at doing something, but certainly not the "blah" I had in mind.

But thanks to aliases, this is no longer a problem:

git config --global alias.git '!git'

and now, typing "git git blah" results in the execution of the git 
alias, which in turn runs "git blah" like I intended.  Yay for:

git git git git git git git git git git status

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

                 reply	other threads:[~2011-07-21 23:06 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=4E28B0F5.2090705@redhat.com \
    --to=eblake@redhat.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).