git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Redirect "git" subcommand to itself?

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2015, 01:53 UTC
Message-ID
<xmqqoal5ii21.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAGZ79kZHa9wUrRsWfHgGdSdx+cN9VAirAAfu3YLVTuSmggcehg@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 22 quoted lines
> so I just run into this problem again (which happens to me maybe twice a week):
> I want to do a git operations, so I type "git " into my shell, and
> then I look around what
> exactly I want to do and usually I find it in the help text of a
> previous command such as
>     You are currently reverting commit 383c14b.
>       (fix conflicts and run "git revert --continue")
>       (use "git revert --abort" to cancel the revert operation)
>
> then I copy the whole operation "git revert --abort" in this case and
> paste it to the shell
> and let go.
> The result looks like
>     $ git git revert --abort
>     git: 'git' is not a git command. See 'git --help'.
>
>     Did you mean this?
>     init
>
> I wonder if we want to make a "git" subcommand, which behaves exactly
> the same as git itself?
> Then "git git git status" would just return the same as "git status".
A few unrelated thoughts.
 * Perhaps we should omit 'git' from these advice-texts?  E.g.
     use "revert --abort" to cancel
   I dunno.
 * While we bend over backwards to a certain degree to be helpful, I
   somehow feel making "git git" a synonym to "git" is going too
   far, akin to asking POSIX maintainers to define "act", "cta",
   "atc", "tca", and "tac" all as synonyms to "cat" because you
   often fat-finger when typing "cat" (yes, "tac" does something
   else that is more useful, I know).
 * You can help yourself with something like this, I suppose:
   [alias]
	git = "!sh -c 'exec git \"$@\"' -"
   but I personally feel that it is too ugly to live as part of our
   official suggestion, so please do not send a patch to add it as
   a built-in alias ;-).
Previous: Stefan BellerNext: Jeff King
Message 2 of 11 in “Redirect "git" subcommand to itself?”
  1. Stefan BellerMay 28, 2015
  2. Junio C HamanoMay 28, 2015
  3. Jeff KingMay 28, 2015
  4. Christian NeukirchenMay 29, 2015
  5. Aaron SchrabMay 29, 2015
  6. Junio C HamanoMay 29, 2015
  7. Stefan BellerMay 29, 2015
  8. Christian NeukirchenMay 29, 2015
  9. Junio C HamanoMay 29, 2015
  10. Konstantin KhomoutovMay 28, 2015
  11. Matthieu MoyMay 28, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.