Skip to main content

NAME

git - the stupid content tracker

SYNOPSIS

git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch] [--no-optional-locks] [--no-advice] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] [--config-env=<name>=<envvar>] <command> [<args>]

DESCRIPTION

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

See gittutorial[7] to get started, then see giteveryday[7] for a useful minimum set of commands. The Git User’s Manual has a more in-depth introduction.

After you mastered the basic concepts, you can come back to this page to learn what commands Git offers. You can learn more about individual Git commands with "git help command". gitcli[7] manual page gives you an overview of the command-line command syntax.

A formatted and hyperlinked copy of the latest Git documentation can be viewed at https://git.github.io/htmldocs/git.html or https://git-scm.com/docs.

OPTIONS

-v --version Prints the Git suite version that the git program came from.

This option is internally converted to git version ... and accepts the same options as the git-version[1] command. If --help is also given, it takes precedence over --version.

-h --help Prints the synopsis and a list of the most commonly used commands. If the option --all or -a is given then all available commands are printed. If a Git command is named this option will bring up the manual page for that command.

Other options are available to control how the manual page is displayed. See git-help[1] for more information, because git --help ... is converted internally into git help ....

-C <path> Run as if git was started in <path> instead of the current working directory. When multiple -C options are given, each subsequent non-absolute -C <path> is interpreted relative to the preceding -C <path>. If <path> is present but empty, e.g. -C "", then the current working directory is left unchanged.

This option affects options that expect path name like --git-dir and --work-tree in that their interpretations of the path names would be made relative to the working directory caused by the -C option. For example the following invocations are equivalent:

git --git-dir=a.git --work-tree=b -C c status git --git-dir=c/a.git --work-tree=c/b status

-c <name>=<value> Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected in the same format as listed by git config (subkeys separated by dots).

Note that omitting the = in git -c foo.bar ... is allowed and sets foo.bar to the boolean true value (just like [foo]bar would in a config file). Including the equals but with an empty value (like git -c foo.bar= ...) sets foo.bar to the empty string which git config --type=bool will convert to false.

Main porcelain commands

git-add[1] Add file contents to the index

git-am[1] Apply a series of patches from a mailbox

git-archive[1] Create an archive of files from a named tree

git-bisect[1] Use binary search to find the commit that introduced a bug

git-branch[1] List, create, or delete branches

git-bundle[1] Move objects and refs by archive

git-checkout[1] Switch branches or restore working tree files

git-cherry-pick[1] Apply the changes introduced by some existing commits

git-citool[1] Graphical alternative to git-commit

git-clean[1] Remove untracked files from the working tree

git-clone[1] Clone a repository into a new directory

git-commit[1] Record changes to the repository

git-describe[1] Give an object a human readable name based on an available ref

git-diff[1] Show changes between commits, commit and working tree, etc

git-fetch[1] Download objects and refs from another repository

git-format-patch[1] Prepare patches for e-mail submission

git-gc[1] Cleanup unnecessary files and optimize the local repository

git-grep[1] Print lines matching a pattern

git-gui[1] A portable graphical interface to Git

git-init[1] Create an empty Git repository or reinitialize an existing one

git-log[1] Show commit logs

git-maintenance[1] Run tasks to optimize Git repository data

git-merge[1] Join two or more development histories together

git-mv[1] Move or rename a file, a directory, or a symlink

git-notes[1] Add or inspect object notes

git-pull[1] Fetch from and integrate with another repository or a local branch

git-push[1] Update remote refs along with associated objects

git-range-diff[1] Compare two commit ranges (e.g. two versions of a branch)

git-rebase[1] Reapply commits on top of another base tip

git-reset[1] Reset current HEAD to the specified state

git-restore[1] Restore working tree files

git-revert[1] Revert some existing commits

git-rm[1] Remove files from the working tree and from the index

git-shortlog[1] Summarize git log output

git-show[1] Show various types of objects

git-sparse-checkout[1] Reduce your working tree to a subset of tracked files

git-stash[1] Stash the changes in a dirty working directory away

git-status[1] Show the working tree status

git-submodule[1] Initialize, update or inspect submodules

git-switch[1] Switch branches

git-tag[1] Create, list, delete or verify a tag object signed with GPG

git-worktree[1] Manage multiple working trees

gitk[1] The Git repository browser

scalar[1] A tool for managing large Git repositories