git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ryan Govostes <rgovostes@gmail.com>
To: git@vger.kernel.org
Subject: Usability suggestion: Catch `git commit -amend`
Date: Thu, 16 Nov 2017 13:06:40 +0900	[thread overview]
Message-ID: <CAMtyXZYMU6fR4MTzRqOCgnqdhNhAVbLu7kUqGW6UXf9wq5P1zQ@mail.gmail.com> (raw)

Despite being a native English speaker, I've often typo'd when trying
to invoke `git commit --amend`. Recently I wrote `git commit -ammend`
which of course added everything to the commit and attached the commit
message "mend".

This doesn't seem to be an uncommon error, there are 64,000 commits
like this on GitHub:
https://github.com/search?utf8=✓&q=mend&type=Commits

The search for simply "end" (as in `-amend`) returns millions of hits
but it's hard to tell how many of those are false positives.

It might be reasonable to try to catch `-amend` (at least) and prevent
an errant commit. Trying to roll back a commit is a place where people
often get into trouble and get confused about the state of their
repository. (Of course, if they just cursor-up and fix the typo, now
they're editing the "end" commit and not the one they were trying to
amend in the first place.)

Git could suggest the user instead pass the commit message as a
separate argument, like `-am end` if they really want to do it.

I'm OK with getting an error if I type `--ammend`, but it is nice that
Git does do spell check on subcommand names. That would make it easier
to figure out which argument I mistyped. (In this case, there's
usually only one.)

Ryan

                 reply	other threads:[~2017-11-16  4: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

  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=CAMtyXZYMU6fR4MTzRqOCgnqdhNhAVbLu7kUqGW6UXf9wq5P1zQ@mail.gmail.com \
    --to=rgovostes@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.
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).