git list all available commands
Is there command which can show me list of all available commands in GIT? There is git help
but it shows:
usage: git [--version] [--exec-path[=<path>]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=<path>] [--work-tree=<path>]
[-c name=value] [--help]
<command> [<args>]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
See 'git help <command>' for more information on a specific command.
And I want just list without description.
Try:
git help -a
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!
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
To list git commands, inluding git commands available from elsewhere on your $PATH
git help -a
To list user-configured aliases use
git aliases