git list all available commands
Try:
git help -a
If you are using linux (BASH). You can try
`$ git [TAB] [TAB]`
Then I got something like this:
$ git add fetch rebase am fetchavs reflog annotate filter-branch relink apply format-patch remote archive fsck repack bisect gc replace blame get-tar-commit-id request-pull br grep reset branch gui revert bundle help rm checkout imap-send shortlog cherry init show cherry-pick instaweb show-branch ci log st citool log1 stage clean merge stash clone mergetool status co mv submodule commit name-rev svn config notes tag describe pull whatchanged diff push difftool pushav
As @CharlesBailey already suggested, git help -a
is a great way to list all of the subcommands that git offers. However, if you want to remove some of the formatting that git prints, that can be done too:
The easiest way to get a list of all git subcommands is as follows:
git help -a | grep "^ [a-z]" | tr ' ' '\n' | grep -v "^$"
This takes the output of git help -a
, selects only the lines that are indented, converts spaces to newline characters, and then removes the empty lines.
Why would you want something like this? A common reason for wanting to list the subcommands of a command is to enable autocompletion in Bash:
complete -W "$(git help -a | grep "^ [a-z]")" git
Now, when you type git br
and press TAB
, it autocompletes to git branch
. Enjoy!