The switches are all the parameters passed before any Git actual command: see docs/git
git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[--super-prefix=<path>]
<command> [<args>]
You can see all the possible switches before <command> [<args>]
--global
is a switch for the git config
command as seen here, not for "git
" alone.
The term "switch" was introduced in commit 0a8365a; May 2005, Git v0.99
diff-tree
: fix and extend argument parsing
We use "--
" to mark end of command line switches, not "-
".
This is inline with the double-hyphen command-line convention, which is, as I explained here, useful if a non-option argument starts with a hyphen.
-- optional separator, followed by arguments
v
git -p config --global -- user.name
^^ ^^^^^^^^
| |_ switch for the git config subcommand.
|
switch for the git command