GIT(1) Git Manual GIT(1)
git - the stupid content tracker
git [--version] [--help] [-C ] [-c =]
[--exec-path[=]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=] [--work-tree=] [--namespace=]
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.
Formatted and hyperlinked version of the latest Git documentation can be viewed at
Prints the Git suite version that the git program came from.
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
Run as if git was started in instead of the current working directory. When
multiple -C options are given, each subsequent non-absolute -C is interpreted
relative to the preceding -C .
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
git --git-dir=a.git --work-tree=b -C c status
git --git-dir=c/a.git --work-tree=c/b status
Pass a configuration parameter to the command. The value given will override values
from configuration files. The 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.
Path to wherever your core Git programs are installed. This can also be controlled by
setting the GIT_EXEC_PATH environment variable. If no path is given, git will print
the current setting and then exit.
Print the path, without trailing slash, where Git’s HTML documentation is installed
Print the manpath (see man(1)) for the man pages for this version of Git and exit.
Print the path where the Info files documenting this version of Git are installed and
Pipe all output into less (or if set, $PAGER) if standard output is a terminal. This
overrides the pager. configuration options (see the "Configuration Mechanism"
Do not pipe Git output into a pager.
Set the path to the repository. This can also be controlled by setting the GIT_DIR
environment variable. It can be an absolute path or relative path to current working
Set the path to the working tree. It can be an absolute path or a path relative to the
current working directory. This can also be controlled by setting the GIT_WORK_TREE
environment variable and the core.worktree configuration variable (see core.worktree
in git-config(1) for a more detailed discussion).
Set the Git namespace. See gitnamespaces(7) for more details. Equivalent to setting
the GIT_NAMESPACE environment variable.
Treat the repository as a bare repository. If GIT_DIR environment is not set, it is
set to the current working directory.
Do not use replacement refs to replace Git objects. See git-replace(1) for more
Treat pathspecs literally (i.e. no globbing, no pathspec magic). This is equivalent to
setting the GIT_LITERAL_PATHSPECS environment variable to 1.
Add "glob" magic to all pathspec. This is equivalent to setting the GIT_GLOB_PATHSPECS
environment variable to 1. Disabling globbing on individual pathspecs can be done
using pathspec magic ":(literal)"
Add "literal" magic to all pathspec. This is equivalent to setting the
GIT_NOGLOB_PATHSPECS environment variable to 1. Enabling globbing on individual
pathspecs can be done using pathspec magic ":(glob)"
Add "icase" magic to all pathspec. This is equivalent to setting the
GIT_ICASE_PATHSPECS environment variable to 1.
We divide Git into high level ("porcelain") commands and low level ("plumbing") commands.
HIGH-LEVEL COMMANDS (PORCELAIN)
We separate the porcelain commands into the main commands and some ancillary user
Main porcelain commands
Add file contents to the index.
Apply a series of patches from a mailbox.
Create an archive of files from a named tree.
Use binary search to find the commit that introduced a bug.
List, create, or delete branches.
Move objects and refs by archive.
Switch branches or restore working tree files.
Apply the changes introduced by some existing commits.
Graphical alternative to git-commit.
Remove untracked files from the working tree.
Clone a repository into a new directory.
Record changes to the repository.
Describe a commit using the most recent tag reachable from it.
Show changes between commits, commit and working tree, etc.
Download objects and refs from another repository.
Prepare patches for e-mail submission.
Cleanup unnecessary files and optimize the local repository.
Print lines matching a pattern.
A portable graphical interface to Git.
Create an empty Git repository or reinitialize an existing one.
Show commit logs.
Join two or more development histories together.
Move or rename a file, a directory, or a symlink.
Add or inspect object notes.
Fetch from and integrate with another repository or a local branch.
Update remote refs along with associated objects.
Forward-port local commits to the updated upstream head.
Reset current HEAD to the specified state.
Revert some existing commits.
Remove files from the working tree and from the index.
Summarize git log output.
Show various types of objects.
Stash the changes in a dirty working directory away.
Show the working tree status.
Initialize, update or inspect submodules.
Create, list, delete or verify a tag object signed with GPG.
Manage multiple working trees.
The Git repository browser.
Get and set repository or global options.
Git data exporter.
Backend for fast Git data importers.
Run merge conflict resolution tools to resolve merge conflicts.
Pack heads and tags for efficient repository access.
Prune all unreachable objects from the object database.
Manage reflog information.
Hardlink common objects in local repositories.
Manage set of tracked repositories.
Pack unpacked objects in a repository.
Create, list, delete refs to replace objects.
Annotate file lines with commit information.
Show what revision and author last modified each line of a file.
Find commits yet to be applied to upstream.
Count unpacked number of objects and their disk consumption.
Show changes using common diff tools.
Verifies the connectivity and validity of the objects in the database.
Extract commit ID from an archive created using git-archive.
Display help information about Git.
Instantly browse your working repository in gitweb.
Show three-way merge without touching index.
Reuse recorded resolution of conflicted merges.
Pick out and massage parameters.
Show branches and their commits.
Check the GPG signature of commits.
Check the GPG signature of tags.
Show logs with difference each commit introduces.
Git web interface (web frontend to Git repositories).
Interacting with Others
These commands are to interact with foreign SCM and with other people via patch over
Import an Arch repository into Git.
Export a single commit to a CVS checkout.
Salvage your data out of another SCM people love to hate.
A CVS server emulator for Git.
Send a collection of patches from stdin to an IMAP folder.
Import from and submit to Perforce repositories.
Applies a quilt patchset onto the current branch.
Generates a summary of pending changes.
Send a collection of patches as emails.
Bidirectional operation between a Subversion repository and Git.
LOW-LEVEL COMMANDS (PLUMBING)
Although Git includes its own porcelain layer, its low-level commands are sufficient to
support development of alternative porcelains. Developers of such porcelains might start
by reading about git-update-index(1) and git-read-tree(1).
The interface (input, output, set of options and the semantics) to these low-level
commands are meant to be a lot more stable than Porcelain level commands, because these
commands are primarily for scripted use. The interface to Porcelain commands on the other
hand are subject to change in order to improve the end user experience.
The following description divides the low-level commands into commands that manipulate
objects (in the repository, index, and working tree), commands that interrogate and
compare objects, and commands that move objects and references between repositories.
Apply a patch to files and/or to the index.
Copy files from the index to the working tree.
Create a new commit object.
Compute object ID and optionally creates a blob from a file.
Build pack index file for an existing packed archive.
Run a three-way file merge.
Run a merge for files needing merging.
Creates a tag object.
Build a tree-object from ls-tree formatted text.
Create a packed archive of objects.
Remove extra objects that are already in pack files.
Reads tree information into the index.
Read, modify and delete symbolic refs.
Unpack objects from a packed archive.
Register file contents in the working tree to the index.
Update the object name stored in a ref safely.
Create a tree object from the current index.
Provide content or type and size information for repository objects.
Compares files in the working tree and the index.
Compare a tree to the working tree or index.
Compares the content and mode of blobs found via two tree objects.
Output information on each ref.
Show information about files in the index and the working tree.
List references in a remote repository.
List the contents of a tree object.
Find as good common ancestors as possible for a merge.
Find symbolic names for given revs.
Find redundant pack files.
Lists commit objects in reverse chronological order.
Show packed archive index.
List references in a local repository.
Creates a temporary file with a blob’s contents.
Show a Git logical variable.
Validate packed Git archive files.
In general, the interrogate commands do not touch the files in the working tree.
A really simple server for Git repositories.
Receive missing objects from another repository.
Server side implementation of Git over HTTP.
Push objects over Git protocol to another repository.
Update auxiliary info file to help dumb servers.
The following are helper commands used by the above; end users typically do not use them
Download from a remote Git repository via HTTP.
Push objects over HTTP/DAV to another repository.
Routines to help parsing remote repository access parameters.
Receive what is pushed into the repository.
Restricted login shell for Git-only SSH access.
Send archive back to git-archive.
Send objects packed back to git-fetch-pack.
Internal helper commands
These are internal helper commands used by other commands; end users typically do not use
Display gitattributes information.
Debug gitignore / exclude files.
Show canonical names and email addresses of contacts.
Ensures that a reference name is well formed.
Display data in columns.
Retrieve and store user credentials.
Helper to temporarily store passwords in memory.
Helper to store credentials on disk.
Produce a merge commit message.
help add structured information into commit messages.
Extracts patch and authorship from a single e-mail message.
Simple UNIX mbox splitter program.
The standard helper program to use with git-merge-index.
Compute unique ID for a patch.
Git’s i18n setup code for shell scripts.
Common Git shell script setup code.
Remove unnecessary whitespace.
Git uses a simple text format to store customizations that are per repository and are per
user. Such a configuration file may look like this:
# A '#' or ';' character indicates a comment.
; core variables
; Don't trust file modes
filemode = false
; user identity
name = "Junio C Hamano"
email = "firstname.lastname@example.org"
Various commands read from the configuration file and adjust their operation accordingly.
See git-config(1) for a list and more details about the configuration mechanism.