Why does git help add “git-” before every command name?

后端 未结 3 1803
猫巷女王i
猫巷女王i 2021-01-13 07:54

If I want help on the git status command, I can enter git help status, and a help page is returned that says the name is \"git-status\

3条回答
  •  被撕碎了的回忆
    2021-01-13 08:44

    The correct answer is "history".

    Back in the Dim Time (2005ish), each Git command was a single thing:

    $ git-init
    [initialized new repository ...]
    $ git-add Makefile README
    $ git-status
    ...
    $ git-commit
    

    People who use bash command completion, though, would soon type git-TAB and get 47,981 obscure git commands such as git-block-area and git-hammer-branch (these are made up, but I hope bring the point across fairly well :-) ). It was time to divide things up into user oriented commands, called porcelain, and low-level commands used internally, called plumbing.

    All the commands were renamed and Git added a single front-end command, git. For those using bash command completion, bash reads a "completions file", which lists only the user-oriented porcelain commands. So now gitTAB only lists 30 to 40 or so commands, instead of 100-plus.

    All the documentation, however, retains the historic format.

提交回复
热议问题