blob: dba7f0c18e33e7e26ca100992236e39b3d5b8a91 [file] [log] [blame]
Christian Couder9e1f0a82008-06-06 09:07:32 +02001git(1)
David Greaves2cf565c2005-05-10 22:32:30 +01002======
David Greaves2cf565c2005-05-10 22:32:30 +01003
4NAME
5----
6git - the stupid content tracker
7
8
9SYNOPSIS
10--------
Jonas Fonseca8b700042006-08-25 03:05:48 +020011[verse]
Nazri Ramliy44e1e4d2013-09-09 21:47:43 +080012'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
Zbigniew Jędrzejewski-Szmek68e4b552012-02-15 00:54:21 +010013 [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
Johannes Sixt7213c282018-05-03 19:15:08 +020014 [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
Josh Triplettd49483f2011-07-08 16:14:10 -070015 [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
Brandon Williams74866d72016-10-07 11:18:48 -070016 [--super-prefix=<path>]
Zbigniew Jędrzejewski-Szmek68e4b552012-02-15 00:54:21 +010017 <command> [<args>]
David Greaves2cf565c2005-05-10 22:32:30 +010018
19DESCRIPTION
20-----------
J. Bruce Fields23091e92006-04-02 17:54:34 -040021Git is a fast, scalable, distributed revision control system with an
22unusually rich command set that provides both high-level operations
23and full access to internals.
24
Jonathan Nieder6998e4d2008-06-30 17:01:21 -050025See linkgit:gittutorial[7] to get started, then see
Philip Oakley673151a2014-10-10 22:25:37 +010026linkgit:giteveryday[7] for a useful minimum set of
Junio C Hamano7687ae92012-08-17 12:48:52 -070027commands. The link:user-manual.html[Git User's Manual] has a more
28in-depth introduction.
David Greaves2cf565c2005-05-10 22:32:30 +010029
Junio C Hamano7687ae92012-08-17 12:48:52 -070030After you mastered the basic concepts, you can come back to this
Thomas Ackermann2de9b712013-01-21 20:17:53 +010031page to learn what commands Git offers. You can learn more about
32individual Git commands with "git help command". linkgit:gitcli[7]
Jason St. John06ab60c2014-05-21 14:52:26 -040033manual page gives you an overview of the command-line command syntax.
Petr Baudis4514ad42006-06-07 20:43:50 +020034
Jonathan Niederf7935822016-06-22 10:38:25 -070035A formatted and hyperlinked copy of the latest Git documentation
36can be viewed at `https://git.github.io/htmldocs/git.html`.
Jari Aalto34b604a2007-04-30 14:21:38 +030037
Junio C Hamano26cfcfb2007-02-13 15:15:05 -080038
Andreas Ericssoncb22bc42005-11-16 00:31:25 +010039OPTIONS
40-------
41--version::
Thomas Ackermann2de9b712013-01-21 20:17:53 +010042 Prints the Git suite version that the 'git' program came from.
David Greaves2cf565c2005-05-10 22:32:30 +010043
Andreas Ericssoncb22bc42005-11-16 00:31:25 +010044--help::
Fredrik Kuivinena87cd022006-03-09 17:24:19 +010045 Prints the synopsis and a list of the most commonly used
Matthieu Moybcf96262016-06-28 13:40:11 +020046 commands. If the option `--all` or `-a` is given then all
Thomas Ackermann2de9b712013-01-21 20:17:53 +010047 available commands are printed. If a Git command is named this
Christian Couder0f6f1952007-12-04 06:44:29 +010048 option will bring up the manual page for that command.
Christian Couder45533d22007-12-04 06:44:29 +010049+
50Other options are available to control how the manual page is
Dan McGee5162e692007-12-29 00:20:38 -060051displayed. See linkgit:git-help[1] for more information,
Jonathan Niederdb5d6662008-07-03 01:06:23 -050052because `git --help ...` is converted internally into `git
53help ...`.
Andreas Ericssoncb22bc42005-11-16 00:31:25 +010054
Nazri Ramliy44e1e4d2013-09-09 21:47:43 +080055-C <path>::
56 Run as if git was started in '<path>' instead of the current working
57 directory. When multiple `-C` options are given, each subsequent
58 non-absolute `-C <path>` is interpreted relative to the preceding `-C
59 <path>`.
60+
61This option affects options that expect path name like `--git-dir` and
62`--work-tree` in that their interpretations of the path names would be
63made relative to the working directory caused by the `-C` option. For
64example the following invocations are equivalent:
65
66 git --git-dir=a.git --work-tree=b -C c status
67 git --git-dir=c/a.git --work-tree=c/b status
68
Alex Riesen8b1fa772010-03-26 23:53:57 +010069-c <name>=<value>::
70 Pass a configuration parameter to the command. The value
71 given will override values from configuration files.
72 The <name> is expected in the same format as listed by
73 'git config' (subkeys separated by dots).
Junio C Hamanoa789ca72014-08-04 15:40:19 -070074+
75Note that omitting the `=` in `git -c foo.bar ...` is allowed and sets
76`foo.bar` to the boolean true value (just like `[foo]bar` would in a
77config file). Including the equals but with an empty value (like `git -c
Adam Dinwoodie5e633322017-09-28 15:06:48 +010078foo.bar= ...`) sets `foo.bar` to the empty string which `git config
Andreas Heiduk7f0a02b2017-08-15 00:12:18 +020079--bool` will convert to `false`.
Alex Riesen8b1fa772010-03-26 23:53:57 +010080
Štěpán Němec62b46982010-10-08 19:31:15 +020081--exec-path[=<path>]::
Thomas Ackermann2de9b712013-01-21 20:17:53 +010082 Path to wherever your core Git programs are installed.
Andreas Ericssoncb22bc42005-11-16 00:31:25 +010083 This can also be controlled by setting the GIT_EXEC_PATH
Jonathan Nieder56992f72008-07-03 00:08:12 -050084 environment variable. If no path is given, 'git' will print
Andreas Ericssoncb22bc42005-11-16 00:31:25 +010085 the current setting and then exit.
86
Markus Heidelberg89a56bf2009-04-05 04:15:16 +020087--html-path::
Thomas Ackermann2de9b712013-01-21 20:17:53 +010088 Print the path, without trailing slash, where Git's HTML
Jonathan Nieder239b5ed2011-05-02 01:07:45 -050089 documentation is installed and exit.
Markus Heidelberg89a56bf2009-04-05 04:15:16 +020090
Jon Seymourf2dd8c32011-05-01 18:16:25 +100091--man-path::
Jonathan Nieder239b5ed2011-05-02 01:07:45 -050092 Print the manpath (see `man(1)`) for the man pages for
Thomas Ackermann2de9b712013-01-21 20:17:53 +010093 this version of Git and exit.
Jon Seymourf2dd8c32011-05-01 18:16:25 +100094
95--info-path::
Jonathan Nieder239b5ed2011-05-02 01:07:45 -050096 Print the path where the Info files documenting this
Thomas Ackermann2de9b712013-01-21 20:17:53 +010097 version of Git are installed and exit.
Johannes Schindelin6acbcb92006-07-25 20:24:22 +020098
Matthieu Moy463a8492007-08-19 19:24:36 +020099-p::
100--paginate::
Jonathan Nieder06300d92010-02-14 06:02:35 -0600101 Pipe all output into 'less' (or if set, $PAGER) if standard
102 output is a terminal. This overrides the `pager.<cmd>`
103 configuration options (see the "Configuration Mechanism" section
104 below).
Johannes Schindelin6acbcb92006-07-25 20:24:22 +0200105
Johannes Sixt7213c282018-05-03 19:15:08 +0200106-P::
Matthieu Moy463a8492007-08-19 19:24:36 +0200107--no-pager::
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100108 Do not pipe Git output into a pager.
Matthieu Moy463a8492007-08-19 19:24:36 +0200109
Johannes Schindelin6acbcb92006-07-25 20:24:22 +0200110--git-dir=<path>::
111 Set the path to the repository. This can also be controlled by
Tom Russello47d81b52016-06-08 00:35:07 +0200112 setting the `GIT_DIR` environment variable. It can be an absolute
Liu Yubao302cc112008-04-29 04:09:20 +0800113 path or relative path to current working directory.
Johannes Schindelin6acbcb92006-07-25 20:24:22 +0200114
Matthias Lederhofer892c41b2007-06-06 09:10:42 +0200115--work-tree=<path>::
Junio C Hamanoea472c12011-01-23 15:49:41 -0800116 Set the path to the working tree. It can be an absolute path
117 or a path relative to the current working directory.
Matthias Lederhofer892c41b2007-06-06 09:10:42 +0200118 This can also be controlled by setting the GIT_WORK_TREE
119 environment variable and the core.worktree configuration
Junio C Hamanoea472c12011-01-23 15:49:41 -0800120 variable (see core.worktree in linkgit:git-config[1] for a
121 more detailed discussion).
Matthias Lederhofer892c41b2007-06-06 09:10:42 +0200122
Josh Triplettd49483f2011-07-08 16:14:10 -0700123--namespace=<path>::
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100124 Set the Git namespace. See linkgit:gitnamespaces[7] for more
Josh Triplettd49483f2011-07-08 16:14:10 -0700125 details. Equivalent to setting the `GIT_NAMESPACE` environment
126 variable.
127
Brandon Williams74866d72016-10-07 11:18:48 -0700128--super-prefix=<path>::
129 Currently for internal use only. Set a prefix which gives a path from
130 above a repository down to its root. One use is to give submodules
131 context about the superproject that invoked it.
132
Johannes Schindelin6acbcb92006-07-25 20:24:22 +0200133--bare::
Junio C Hamano9277d602007-08-27 22:41:23 -0700134 Treat the repository as a bare repository. If GIT_DIR
135 environment is not set, it is set to the current working
136 directory.
137
Christian Couderb0fa7ab2009-10-12 22:30:32 +0200138--no-replace-objects::
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100139 Do not use replacement refs to replace Git objects. See
Christian Couderb0fa7ab2009-10-12 22:30:32 +0200140 linkgit:git-replace[1] for more information.
141
Jeff King823ab402012-12-19 17:37:30 -0500142--literal-pathspecs::
Nguyễn Thái Ngọc Duya16bf9d2013-07-14 15:36:07 +0700143 Treat pathspecs literally (i.e. no globbing, no pathspec magic).
144 This is equivalent to setting the `GIT_LITERAL_PATHSPECS` environment
Jeff King823ab402012-12-19 17:37:30 -0500145 variable to `1`.
146
Steffen Prohaska6fb02162013-09-23 20:54:35 +0200147--glob-pathspecs::
Nguyễn Thái Ngọc Duybd30c2e2013-07-14 15:36:08 +0700148 Add "glob" magic to all pathspec. This is equivalent to setting
149 the `GIT_GLOB_PATHSPECS` environment variable to `1`. Disabling
150 globbing on individual pathspecs can be done using pathspec
151 magic ":(literal)"
152
Steffen Prohaska6fb02162013-09-23 20:54:35 +0200153--noglob-pathspecs::
Nguyễn Thái Ngọc Duybd30c2e2013-07-14 15:36:08 +0700154 Add "literal" magic to all pathspec. This is equivalent to setting
155 the `GIT_NOGLOB_PATHSPECS` environment variable to `1`. Enabling
156 globbing on individual pathspecs can be done using pathspec
157 magic ":(glob)"
Junio C Hamano0d6a8732005-08-23 21:18:49 -0700158
Steffen Prohaska6fb02162013-09-23 20:54:35 +0200159--icase-pathspecs::
Nguyễn Thái Ngọc Duy93d93532013-07-14 15:36:09 +0700160 Add "icase" magic to all pathspec. This is equivalent to setting
161 the `GIT_ICASE_PATHSPECS` environment variable to `1`.
David Greaves6c84e2e2005-05-22 18:44:16 +0100162
Jeff King27344d62017-09-27 02:54:30 -0400163--no-optional-locks::
164 Do not perform optional operations that require locks. This is
165 equivalent to setting the `GIT_OPTIONAL_LOCKS` to `0`.
166
Nguyễn Thái Ngọc Duy00895212018-05-20 20:39:57 +0200167--list-cmds=group[,group...]::
168 List commands by group. This is an internal/experimental
169 option and may change or be removed in the future. Supported
170 groups are: builtins, parseopt (builtin commands that use
Nguyễn Thái Ngọc Duy6bb2dc02018-05-20 20:39:59 +0200171 parse-options), main (all commands in libexec directory),
Nguyễn Thái Ngọc Duy3c777762018-05-20 20:40:00 +0200172 others (all other commands in `$PATH` that have git- prefix),
Nguyễn Thái Ngọc Duye11dca12018-05-20 20:40:07 +0200173 list-<category> (see categories in command-list.txt),
Nguyễn Thái Ngọc Duy6532f372018-05-20 20:40:09 +0200174 nohelpers (exclude helper commands), alias and config
175 (retrieve command list from config variable completion.commands)
Nguyễn Thái Ngọc Duy00895212018-05-20 20:39:57 +0200176
J. Bruce Fields23091e92006-04-02 17:54:34 -0400177GIT COMMANDS
178------------
Junio C Hamano8db93072005-08-30 13:51:01 -0700179
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100180We divide Git into high level ("porcelain") commands and low level
J. Bruce Fields23091e92006-04-02 17:54:34 -0400181("plumbing") commands.
Junio C Hamanoe6fc2342005-08-25 00:28:18 -0700182
J. Bruce Fields23091e92006-04-02 17:54:34 -0400183High-level commands (porcelain)
184-------------------------------
185
186We separate the porcelain commands into the main commands and some
187ancillary user utilities.
188
189Main porcelain commands
190~~~~~~~~~~~~~~~~~~~~~~~
Junio C Hamano905197d2005-08-26 21:33:46 -0700191
Junio C Hamano377e8132007-01-18 15:03:13 -0800192include::cmds-mainporcelain.txt[]
Junio C Hamanoe31bb3b2005-08-15 15:48:47 -0700193
Yasushi SHOJI90933ef2005-08-16 00:23:06 +0900194Ancillary Commands
J. Bruce Fields23091e92006-04-02 17:54:34 -0400195~~~~~~~~~~~~~~~~~~
David Greaves204ee6a2005-05-10 22:32:37 +0100196Manipulators:
197
Junio C Hamano377e8132007-01-18 15:03:13 -0800198include::cmds-ancillarymanipulators.txt[]
Junio C Hamano7fc9d692005-08-23 01:49:47 -0700199
Junio C Hamanof85a4192005-08-29 17:21:06 -0700200Interrogators:
Junio C Hamano7fc9d692005-08-23 01:49:47 -0700201
Junio C Hamano377e8132007-01-18 15:03:13 -0800202include::cmds-ancillaryinterrogators.txt[]
Junio C Hamano35ef3a42005-09-07 23:04:52 -0700203
Junio C Hamano89bf2072007-01-18 22:32:38 -0800204
205Interacting with Others
206~~~~~~~~~~~~~~~~~~~~~~~
207
208These commands are to interact with foreign SCM and with other
209people via patch over e-mail.
210
211include::cmds-foreignscminterface.txt[]
212
213
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100214Low-level commands (plumbing)
215-----------------------------
216
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100217Although Git includes its
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100218own porcelain layer, its low-level commands are sufficient to support
219development of alternative porcelains. Developers of such porcelains
Dan McGee5162e692007-12-29 00:20:38 -0600220might start by reading about linkgit:git-update-index[1] and
221linkgit:git-read-tree[1].
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100222
Junio C Hamano89bf2072007-01-18 22:32:38 -0800223The interface (input, output, set of options and the semantics)
224to these low-level commands are meant to be a lot more stable
225than Porcelain level commands, because these commands are
226primarily for scripted use. The interface to Porcelain commands
227on the other hand are subject to change in order to improve the
228end user experience.
229
230The following description divides
231the low-level commands into commands that manipulate objects (in
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100232the repository, index, and working tree), commands that interrogate and
233compare objects, and commands that move objects and references between
234repositories.
235
Junio C Hamano89bf2072007-01-18 22:32:38 -0800236
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100237Manipulation commands
238~~~~~~~~~~~~~~~~~~~~~
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100239
Junio C Hamano377e8132007-01-18 15:03:13 -0800240include::cmds-plumbingmanipulators.txt[]
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100241
242
243Interrogation commands
244~~~~~~~~~~~~~~~~~~~~~~
245
Junio C Hamano377e8132007-01-18 15:03:13 -0800246include::cmds-plumbinginterrogators.txt[]
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100247
248In general, the interrogate commands do not touch the files in
249the working tree.
250
251
252Synching repositories
253~~~~~~~~~~~~~~~~~~~~~
254
Junio C Hamano377e8132007-01-18 15:03:13 -0800255include::cmds-synchingrepositories.txt[]
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100256
Ori Avtalion57f6ec02009-08-07 17:24:21 +0300257The following are helper commands used by the above; end users
Junio C Hamano89bf2072007-01-18 22:32:38 -0800258typically do not use them directly.
259
260include::cmds-synchelpers.txt[]
261
262
263Internal helper commands
264~~~~~~~~~~~~~~~~~~~~~~~~
265
266These are internal helper commands used by other commands; end
267users typically do not use them directly.
268
269include::cmds-purehelpers.txt[]
270
Robin Rosenbergb1f33d62006-10-29 21:09:48 +0100271
Junio C Hamano5773c9f2005-10-29 14:32:56 -0700272Configuration Mechanism
273-----------------------
274
Matthieu Moyc0179c02013-02-14 16:36:54 +0100275Git uses a simple text format to store customizations that are per
276repository and are per user. Such a configuration file may look
277like this:
Junio C Hamano5773c9f2005-10-29 14:32:56 -0700278
279------------
280#
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800281# A '#' or ';' character indicates a comment.
Junio C Hamano5773c9f2005-10-29 14:32:56 -0700282#
283
284; core variables
285[core]
286 ; Don't trust file modes
287 filemode = false
288
289; user identity
290[user]
291 name = "Junio C Hamano"
Matthieu Moyc0179c02013-02-14 16:36:54 +0100292 email = "gitster@pobox.com"
Junio C Hamano5773c9f2005-10-29 14:32:56 -0700293
294------------
295
296Various commands read from the configuration file and adjust
Jonathan Nieder06300d92010-02-14 06:02:35 -0600297their operation accordingly. See linkgit:git-config[1] for a
Matthieu Moyc0179c02013-02-14 16:36:54 +0100298list and more details about the configuration mechanism.
Junio C Hamano5773c9f2005-10-29 14:32:56 -0700299
300
David Greaves6c84e2e2005-05-22 18:44:16 +0100301Identifier Terminology
David Greaves2cf565c2005-05-10 22:32:30 +0100302----------------------
303<object>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800304 Indicates the object name for any type of object.
David Greaves2cf565c2005-05-10 22:32:30 +0100305
306<blob>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800307 Indicates a blob object name.
David Greaves2cf565c2005-05-10 22:32:30 +0100308
309<tree>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800310 Indicates a tree object name.
David Greaves2cf565c2005-05-10 22:32:30 +0100311
312<commit>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800313 Indicates a commit object name.
David Greaves2cf565c2005-05-10 22:32:30 +0100314
315<tree-ish>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800316 Indicates a tree, commit or tag object name. A
David Greaves6c84e2e2005-05-22 18:44:16 +0100317 command that takes a <tree-ish> argument ultimately wants to
318 operate on a <tree> object but automatically dereferences
319 <commit> and <tag> objects that point at a <tree>.
David Greaves2cf565c2005-05-10 22:32:30 +0100320
Theodore Ts'o043d7602007-03-05 14:46:05 -0500321<commit-ish>::
322 Indicates a commit or tag object name. A
323 command that takes a <commit-ish> argument ultimately wants to
324 operate on a <commit> object but automatically dereferences
325 <tag> objects that point at a <commit>.
326
David Greaves2cf565c2005-05-10 22:32:30 +0100327<type>::
328 Indicates that an object type is required.
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800329 Currently one of: `blob`, `tree`, `commit`, or `tag`.
David Greaves2cf565c2005-05-10 22:32:30 +0100330
331<file>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800332 Indicates a filename - almost always relative to the
333 root of the tree structure `GIT_INDEX_FILE` describes.
David Greaves2cf565c2005-05-10 22:32:30 +0100334
David Greavesc1bdacf2005-05-10 22:32:38 +0100335Symbolic Identifiers
336--------------------
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100337Any Git command accepting any <object> can also use the following
David Greaves6c84e2e2005-05-22 18:44:16 +0100338symbolic notation:
David Greavesc1bdacf2005-05-10 22:32:38 +0100339
340HEAD::
Junio C Hamano0abcfbf2011-06-23 09:35:10 -0700341 indicates the head of the current branch.
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800342
David Greavesc1bdacf2005-05-10 22:32:38 +0100343<tag>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800344 a valid tag 'name'
Junio C Hamano0abcfbf2011-06-23 09:35:10 -0700345 (i.e. a `refs/tags/<tag>` reference).
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800346
David Greavesc1bdacf2005-05-10 22:32:38 +0100347<head>::
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800348 a valid head 'name'
Junio C Hamano0abcfbf2011-06-23 09:35:10 -0700349 (i.e. a `refs/heads/<head>` reference).
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800350
Junio C Hamanod47107d2006-10-25 11:33:08 -0700351For a more complete list of ways to spell object names, see
Jonathan Nieder9d83e382010-10-11 11:03:32 -0500352"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
Junio C Hamanod47107d2006-10-25 11:33:08 -0700353
David Greavesc1bdacf2005-05-10 22:32:38 +0100354
355File/Directory Structure
356------------------------
David Greavesc1bdacf2005-05-10 22:32:38 +0100357
Jonathan Nieder6998e4d2008-06-30 17:01:21 -0500358Please see the linkgit:gitrepository-layout[5] document.
David Greavesc1bdacf2005-05-10 22:32:38 +0100359
Jonathan Nieder6998e4d2008-06-30 17:01:21 -0500360Read linkgit:githooks[5] for more details about each hook.
Jon Loeliger6250ad12006-03-24 21:21:07 -0600361
David Greavesc1bdacf2005-05-10 22:32:38 +0100362Higher level SCMs may provide and manage additional information in the
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800363`$GIT_DIR`.
David Greavesc1bdacf2005-05-10 22:32:38 +0100364
Junio C Hamanoa1d4aa72005-09-01 16:56:13 -0700365
David Greaves2cf565c2005-05-10 22:32:30 +0100366Terminology
367-----------
Jonathan Nieder6998e4d2008-06-30 17:01:21 -0500368Please see linkgit:gitglossary[7].
David Greaves2cf565c2005-05-10 22:32:30 +0100369
370
371Environment Variables
372---------------------
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100373Various Git commands use the following environment variables:
David Greaves2cf565c2005-05-10 22:32:30 +0100374
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100375The Git Repository
David Greavesc1bdacf2005-05-10 22:32:38 +0100376~~~~~~~~~~~~~~~~~~
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100377These environment variables apply to 'all' core Git commands. Nb: it
David Greavesc1bdacf2005-05-10 22:32:38 +0100378is worth noting that they may be used/overridden by SCMS sitting above
Eric Sunshinef25b98e2015-07-24 00:00:54 -0400379Git so take care if using a foreign front-end.
David Greaves2cf565c2005-05-10 22:32:30 +0100380
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200381`GIT_INDEX_FILE`::
David Greavesc1bdacf2005-05-10 22:32:38 +0100382 This environment allows the specification of an alternate
Lukas_Sandström5f3aa192005-11-11 02:12:27 +0100383 index file. If not specified, the default of `$GIT_DIR/index`
384 is used.
David Greavesc1bdacf2005-05-10 22:32:38 +0100385
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200386`GIT_INDEX_VERSION`::
Thomas Gummerer136347d2014-02-23 21:49:57 +0100387 This environment variable allows the specification of an index
388 version for new repositories. It won't affect existing index
Nguyễn Thái Ngọc Duy70320542015-03-24 07:28:33 +0700389 files. By default index file version 2 or 3 is used. See
390 linkgit:git-update-index[1] for more information.
Thomas Gummerer136347d2014-02-23 21:49:57 +0100391
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200392`GIT_OBJECT_DIRECTORY`::
David Greavesc1bdacf2005-05-10 22:32:38 +0100393 If the object storage directory is specified via this
394 environment variable then the sha1 directories are created
395 underneath - otherwise the default `$GIT_DIR/objects`
396 directory is used.
397
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200398`GIT_ALTERNATE_OBJECT_DIRECTORIES`::
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100399 Due to the immutable nature of Git objects, old objects can be
David Greavesc1bdacf2005-05-10 22:32:38 +0100400 archived into shared, read-only directories. This variable
Johannes Sixt80ba0742007-12-03 21:55:57 +0100401 specifies a ":" separated (on Windows ";" separated) list
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100402 of Git object directories which can be used to search for Git
Johannes Sixt80ba0742007-12-03 21:55:57 +0100403 objects. New objects will not be written to these directories.
Jeff Kingcf3c6352016-12-12 14:52:22 -0500404+
405 Entries that begin with `"` (double-quote) will be interpreted
406 as C-style quoted paths, removing leading and trailing
407 double-quotes and respecting backslash escapes. E.g., the value
408 `"path-with-\"-and-:-in-it":vanilla-path` has two paths:
409 `path-with-"-and-:-in-it` and `vanilla-path`.
David Greavesc1bdacf2005-05-10 22:32:38 +0100410
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200411`GIT_DIR`::
412 If the `GIT_DIR` environment variable is set then it
Junio C Hamano2fa090b2005-12-07 16:05:21 -0800413 specifies a path to use instead of the default `.git`
414 for the base of the repository.
Matthieu Moybcf96262016-06-28 13:40:11 +0200415 The `--git-dir` command-line option also sets this value.
David Greavesc1bdacf2005-05-10 22:32:38 +0100416
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200417`GIT_WORK_TREE`::
Chris Rorvicka758a342013-05-30 20:11:41 -0500418 Set the path to the root of the working tree.
Matthieu Moybcf96262016-06-28 13:40:11 +0200419 This can also be controlled by the `--work-tree` command-line
Matthias Lederhofer892c41b2007-06-06 09:10:42 +0200420 option and the core.worktree configuration variable.
421
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200422`GIT_NAMESPACE`::
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100423 Set the Git namespace; see linkgit:gitnamespaces[7] for details.
Matthieu Moybcf96262016-06-28 13:40:11 +0200424 The `--namespace` command-line option also sets this value.
Josh Triplettd49483f2011-07-08 16:14:10 -0700425
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200426`GIT_CEILING_DIRECTORIES`::
Michael Haggerty7ec30aa2013-02-20 10:09:24 +0100427 This should be a colon-separated list of absolute paths. If
Junio C Hamano3e07d262013-02-27 09:47:27 -0800428 set, it is a list of directories that Git should not chdir up
Michael Haggerty7ec30aa2013-02-20 10:09:24 +0100429 into while looking for a repository directory (useful for
430 excluding slow-loading network directories). It will not
431 exclude the current working directory or a GIT_DIR set on the
432 command line or in the environment. Normally, Git has to read
433 the entries in this list and resolve any symlink that
434 might be present in order to compare them with the current
435 directory. However, if even this access is slow, you
436 can add an empty entry to the list to tell Git that the
437 subsequent entries are not symlinks and needn't be resolved;
438 e.g.,
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200439 `GIT_CEILING_DIRECTORIES=/maybe/symlink::/very/slow/non/symlink`.
David Reiss0454dd92008-05-19 23:49:26 -0700440
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200441`GIT_DISCOVERY_ACROSS_FILESYSTEM`::
Junio C Hamanoe6405512010-04-04 10:33:53 -0700442 When run in a directory that does not have ".git" repository
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100443 directory, Git tries to find such a directory in the parent
Junio C Hamanoe6405512010-04-04 10:33:53 -0700444 directories to find the top of the working tree, but by default it
445 does not cross filesystem boundaries. This environment variable
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100446 can be set to true to tell Git not to stop at filesystem
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200447 boundaries. Like `GIT_CEILING_DIRECTORIES`, this will not affect
448 an explicit repository directory set via `GIT_DIR` or on the
Junio C Hamanocf874632010-04-04 14:49:31 -0700449 command line.
Lars R. Damerow8030e442010-03-17 12:55:53 -0700450
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200451`GIT_COMMON_DIR`::
Nguyễn Thái Ngọc Duyc7b3a3d2014-11-30 15:24:36 +0700452 If this variable is set to a path, non-worktree files that are
453 normally in $GIT_DIR will be taken from this path
454 instead. Worktree-specific files such as HEAD or index are
Nguyễn Thái Ngọc Duy529fef22014-11-30 15:24:47 +0700455 taken from $GIT_DIR. See linkgit:gitrepository-layout[5] and
Eric Sunshine1eaca7a2015-07-16 20:17:02 -0400456 linkgit:git-worktree[1] for
Nguyễn Thái Ngọc Duyc7b3a3d2014-11-30 15:24:36 +0700457 details. This variable has lower precedence than other path
458 variables such as GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY...
459
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100460Git Commits
David Greavesc1bdacf2005-05-10 22:32:38 +0100461~~~~~~~~~~~
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200462`GIT_AUTHOR_NAME`::
463`GIT_AUTHOR_EMAIL`::
464`GIT_AUTHOR_DATE`::
465`GIT_COMMITTER_NAME`::
466`GIT_COMMITTER_EMAIL`::
467`GIT_COMMITTER_DATE`::
Josh Triplett28a94f82007-04-28 18:40:28 -0700468'EMAIL'::
Dan McGee5162e692007-12-29 00:20:38 -0600469 see linkgit:git-commit-tree[1]
David Greavesc1bdacf2005-05-10 22:32:38 +0100470
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100471Git Diffs
David Greavesc1bdacf2005-05-10 22:32:38 +0100472~~~~~~~~~
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200473`GIT_DIFF_OPTS`::
Seanfde97d82006-11-27 14:37:43 -0500474 Only valid setting is "--unified=??" or "-u??" to set the
475 number of context lines shown when a unified diff is created.
476 This takes precedence over any "-U" or "--unified" option
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100477 value passed on the Git diff command line.
Seanfde97d82006-11-27 14:37:43 -0500478
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200479`GIT_EXTERNAL_DIFF`::
480 When the environment variable `GIT_EXTERNAL_DIFF` is set, the
Seanfde97d82006-11-27 14:37:43 -0500481 program named by it is called, instead of the diff invocation
482 described above. For a path that is added, removed, or modified,
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200483 `GIT_EXTERNAL_DIFF` is called with 7 parameters:
Seanfde97d82006-11-27 14:37:43 -0500484
485 path old-file old-hex old-mode new-file new-hex new-mode
486+
487where:
488
489 <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
490 contents of <old|new>,
Thomas Ackermannd5fa1f12013-04-15 19:49:04 +0200491 <old|new>-hex:: are the 40-hexdigit SHA-1 hashes,
Seanfde97d82006-11-27 14:37:43 -0500492 <old|new>-mode:: are the octal representation of the file modes.
Seanfde97d82006-11-27 14:37:43 -0500493+
494The file parameters can point at the user's working file
495(e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
496when a new file is added), or a temporary file (e.g. `old-file` in the
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200497index). `GIT_EXTERNAL_DIFF` should not worry about unlinking the
498temporary file --- it is removed when `GIT_EXTERNAL_DIFF` exits.
Seanfde97d82006-11-27 14:37:43 -0500499+
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200500For a path that is unmerged, `GIT_EXTERNAL_DIFF` is called with 1
Seanfde97d82006-11-27 14:37:43 -0500501parameter, <path>.
Zoltan Klingeree7fb0b2013-12-06 10:38:46 +1100502+
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200503For each path `GIT_EXTERNAL_DIFF` is called, two environment variables,
504`GIT_DIFF_PATH_COUNTER` and `GIT_DIFF_PATH_TOTAL` are set.
Zoltan Klingeree7fb0b2013-12-06 10:38:46 +1100505
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200506`GIT_DIFF_PATH_COUNTER`::
Zoltan Klingeree7fb0b2013-12-06 10:38:46 +1100507 A 1-based counter incremented by one for every path.
508
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200509`GIT_DIFF_PATH_TOTAL`::
Zoltan Klingeree7fb0b2013-12-06 10:38:46 +1100510 The total number of paths.
David Greaves2cf565c2005-05-10 22:32:30 +0100511
Matthias Lederhofer575ba9d2006-06-25 15:56:18 +0200512other
513~~~~~
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200514`GIT_MERGE_VERBOSITY`::
Jakub Narebskidbddb712007-07-13 01:54:06 +0200515 A number controlling the amount of output shown by
516 the recursive merge strategy. Overrides merge.verbosity.
Dan McGee5162e692007-12-29 00:20:38 -0600517 See linkgit:git-merge[1]
Jakub Narebskidbddb712007-07-13 01:54:06 +0200518
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200519`GIT_PAGER`::
Steven Grimma7738c72007-07-19 03:43:51 -0700520 This environment variable overrides `$PAGER`. If it is set
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100521 to an empty string or to the value "cat", Git will not launch
Jonathan Niederab54cd62008-08-24 00:28:32 -0500522 a pager. See also the `core.pager` option in
523 linkgit:git-config[1].
Matthias Lederhoferc27d2052006-07-31 15:27:00 +0200524
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200525`GIT_EDITOR`::
Rodrigo Silva (MestreLion)36384c92012-03-23 12:38:42 +0000526 This environment variable overrides `$EDITOR` and `$VISUAL`.
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100527 It is used by several Git commands when, on interactive mode,
Rodrigo Silva (MestreLion)36384c92012-03-23 12:38:42 +0000528 an editor is to be launched. See also linkgit:git-var[1]
529 and the `core.editor` option in linkgit:git-config[1].
530
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200531`GIT_SSH`::
532`GIT_SSH_COMMAND`::
Thomas Quinot39942762014-11-09 23:42:32 +0100533 If either of these environment variables is set then 'git fetch'
534 and 'git push' will use the specified command instead of 'ssh'
535 when they need to connect to a remote system.
Brandon Williams94b8ae52017-10-16 10:55:31 -0700536 The command-line parameters passed to the configured command are
537 determined by the ssh variant. See `ssh.variant` option in
538 linkgit:git-config[1] for details.
539
Shawn O. Pearced5538b42007-08-04 02:06:52 -0400540+
Thomas Quinot39942762014-11-09 23:42:32 +0100541`$GIT_SSH_COMMAND` takes precedence over `$GIT_SSH`, and is interpreted
542by the shell, which allows additional arguments to be included.
543`$GIT_SSH` on the other hand must be just the path to a program
544(which can be a wrapper shell script, if additional arguments are
545needed).
Shawn O. Pearced5538b42007-08-04 02:06:52 -0400546+
547Usually it is easier to configure any desired options through your
548personal `.ssh/config` file. Please consult your ssh documentation
549for further details.
550
Segev Finerdd33e072017-02-01 13:01:16 +0100551`GIT_SSH_VARIANT`::
552 If this environment variable is set, it overrides Git's autodetection
553 whether `GIT_SSH`/`GIT_SSH_COMMAND`/`core.sshCommand` refer to OpenSSH,
554 plink or tortoiseplink. This variable overrides the config setting
555 `ssh.variant` that serves the same purpose.
556
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200557`GIT_ASKPASS`::
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100558 If this environment variable is set, then Git commands which need to
Knut Franke453842c2010-08-30 15:40:29 +0200559 acquire passwords or passphrases (e.g. for HTTP or IMAP authentication)
Jason St. John06ab60c2014-05-21 14:52:26 -0400560 will call this program with a suitable prompt as command-line argument
Tom Russelloae9f6312016-06-08 19:23:16 +0200561 and read the password from its STDOUT. See also the `core.askPass`
Knut Franke453842c2010-08-30 15:40:29 +0200562 option in linkgit:git-config[1].
563
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200564`GIT_TERMINAL_PROMPT`::
Jeff Kinge652c0e2014-12-03 22:52:29 -0500565 If this environment variable is set to `0`, git will not prompt
566 on the terminal (e.g., when asking for HTTP authentication).
567
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200568`GIT_CONFIG_NOSYSTEM`::
Jonathan Niedere8ef4012012-10-14 01:53:59 -0700569 Whether to skip reading settings from the system-wide
570 `$(prefix)/etc/gitconfig` file. This environment variable can
571 be used along with `$HOME` and `$XDG_CONFIG_HOME` to create a
572 predictable environment for a picky script, or you can set it
573 temporarily to avoid using a buggy `/etc/gitconfig` file while
574 waiting for someone with sufficient permissions to fix it.
575
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200576`GIT_FLUSH`::
Theodore Ts'o06f59e92007-06-29 13:40:46 -0400577 If this environment variable is set to "1", then commands such
Thomas Rast0b444cd2010-01-10 00:33:00 +0100578 as 'git blame' (in incremental mode), 'git rev-list', 'git log',
Junio C Hamano627a8b82013-08-09 10:28:53 -0700579 'git check-attr' and 'git check-ignore' will
Adam Spiersf1ed7fe2013-04-11 13:05:13 +0100580 force a flush of the output stream after each record have been
581 flushed. If this
Theodore Ts'o06f59e92007-06-29 13:40:46 -0400582 variable is set to "0", the output of these commands will be done
583 using completely buffered I/O. If this environment variable is
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100584 not set, Git will choose buffered or record-oriented flushing
Theodore Ts'o06f59e92007-06-29 13:40:46 -0400585 based on whether stdout appears to be redirected to a file or not.
586
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200587`GIT_TRACE`::
Karsten Bleeseb9250d2014-07-12 02:00:53 +0200588 Enables general trace messages, e.g. alias expansion, built-in
589 command execution and external command execution.
590+
591If this variable is set to "1", "2" or "true" (comparison
592is case insensitive), trace messages will be printed to
593stderr.
594+
595If the variable is set to an integer value greater than 2
596and lower than 10 (strictly) then Git will interpret this
597value as an open file descriptor and will try to write the
598trace messages into this file descriptor.
599+
600Alternatively, if the variable is set to an absolute path
601(starting with a '/' character), Git will interpret this
602as a file path and will try to write the trace messages
603into it.
604+
605Unsetting the variable, or setting it to empty, "0" or
606"false" (case insensitive) disables trace messages.
Matthias Lederhofer575ba9d2006-06-25 15:56:18 +0200607
Alex Vandiverbd76afd2017-10-27 16:26:36 -0700608`GIT_TRACE_FSMONITOR`::
609 Enables trace messages for the filesystem monitor extension.
610 See `GIT_TRACE` for available trace output options.
611
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200612`GIT_TRACE_PACK_ACCESS`::
Karsten Blees67dc5982014-07-12 02:01:38 +0200613 Enables trace messages for all accesses to any packs. For each
Nguyễn Thái Ngọc Duyb12ca962013-06-09 12:22:48 +0700614 access, the pack file name and an offset in the pack is
615 recorded. This may be helpful for troubleshooting some
616 pack-related performance problems.
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200617 See `GIT_TRACE` for available trace output options.
Nguyễn Thái Ngọc Duyb12ca962013-06-09 12:22:48 +0700618
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200619`GIT_TRACE_PACKET`::
Karsten Bleeseb9250d2014-07-12 02:00:53 +0200620 Enables trace messages for all packets coming in or out of a
621 given program. This can help with debugging object negotiation
622 or other protocol issues. Tracing is turned off at a packet
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200623 starting with "PACK" (but see `GIT_TRACE_PACKFILE` below).
624 See `GIT_TRACE` for available trace output options.
Karsten Bleeseb9250d2014-07-12 02:00:53 +0200625
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200626`GIT_TRACE_PACKFILE`::
Jeff King32359832015-06-16 13:23:20 -0400627 Enables tracing of packfiles sent or received by a
628 given program. Unlike other trace output, this trace is
629 verbatim: no headers, and no quoting of binary data. You almost
630 certainly want to direct into a file (e.g.,
631 `GIT_TRACE_PACKFILE=/tmp/my.pack`) rather than displaying it on
632 the terminal or mixing it with other trace output.
633+
634Note that this is currently only implemented for the client side
635of clones and fetches.
636
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200637`GIT_TRACE_PERFORMANCE`::
Karsten Blees578da032014-07-12 02:07:01 +0200638 Enables performance related trace messages, e.g. total execution
639 time of each Git command.
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200640 See `GIT_TRACE` for available trace output options.
Karsten Blees578da032014-07-12 02:07:01 +0200641
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200642`GIT_TRACE_SETUP`::
Karsten Bleeseb9250d2014-07-12 02:00:53 +0200643 Enables trace messages printing the .git, working tree and current
644 working directory after Git has completed its setup phase.
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200645 See `GIT_TRACE` for available trace output options.
Karsten Bleeseb9250d2014-07-12 02:00:53 +0200646
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200647`GIT_TRACE_SHALLOW`::
Karsten Bleeseb9250d2014-07-12 02:00:53 +0200648 Enables trace messages that can help debugging fetching /
649 cloning of shallow repositories.
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200650 See `GIT_TRACE` for available trace output options.
Nguyễn Thái Ngọc Duy1dd278c2013-06-09 12:22:49 +0700651
Junio C Hamano2f84df22016-07-06 13:38:06 -0700652`GIT_TRACE_CURL`::
Elia Pinto74c682d2016-05-23 13:44:02 +0000653 Enables a curl full trace dump of all incoming and outgoing data,
654 including descriptive information, of the git transport protocol.
Junio C Hamano2f84df22016-07-06 13:38:06 -0700655 This is similar to doing curl `--trace-ascii` on the command line.
656 This option overrides setting the `GIT_CURL_VERBOSE` environment
Elia Pinto74c682d2016-05-23 13:44:02 +0000657 variable.
Junio C Hamano2f84df22016-07-06 13:38:06 -0700658 See `GIT_TRACE` for available trace output options.
Elia Pinto74c682d2016-05-23 13:44:02 +0000659
Jonathan Tan8ba18e62018-01-18 16:28:02 -0800660`GIT_TRACE_CURL_NO_DATA`::
661 When a curl trace is enabled (see `GIT_TRACE_CURL` above), do not dump
662 data (that is, only dump info lines and headers).
663
Jonathan Tan83411782018-01-18 16:28:01 -0800664`GIT_REDACT_COOKIES`::
665 This can be set to a comma-separated list of strings. When a curl trace
666 is enabled (see `GIT_TRACE_CURL` above), whenever a "Cookies:" header
667 sent by the client is dumped, values of cookies whose key is in that
668 list (case-sensitive) are redacted.
669
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200670`GIT_LITERAL_PATHSPECS`::
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100671 Setting this variable to `1` will cause Git to treat all
Jeff King823ab402012-12-19 17:37:30 -0500672 pathspecs literally, rather than as glob patterns. For example,
673 running `GIT_LITERAL_PATHSPECS=1 git log -- '*.c'` will search
674 for commits that touch the path `*.c`, not any paths that the
675 glob `*.c` matches. You might want this if you are feeding
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100676 literal paths to Git (e.g., paths previously given to you by
Jeff King823ab402012-12-19 17:37:30 -0500677 `git ls-tree`, `--raw` diff output, etc).
678
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200679`GIT_GLOB_PATHSPECS`::
Nguyễn Thái Ngọc Duybd30c2e2013-07-14 15:36:08 +0700680 Setting this variable to `1` will cause Git to treat all
681 pathspecs as glob patterns (aka "glob" magic).
682
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200683`GIT_NOGLOB_PATHSPECS`::
Nguyễn Thái Ngọc Duybd30c2e2013-07-14 15:36:08 +0700684 Setting this variable to `1` will cause Git to treat all
685 pathspecs as literal (aka "literal" magic).
686
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200687`GIT_ICASE_PATHSPECS`::
Nguyễn Thái Ngọc Duy93d93532013-07-14 15:36:09 +0700688 Setting this variable to `1` will cause Git to treat all
689 pathspecs as case-insensitive.
690
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200691`GIT_REFLOG_ACTION`::
Junio C Hamanoc3e2d182013-06-19 10:54:00 -0700692 When a ref is updated, reflog entries are created to keep
693 track of the reason why the ref was updated (which is
694 typically the name of the high-level command that updated
695 the ref), in addition to the old and new values of the ref.
696 A scripted Porcelain command can use set_reflog_action
697 helper function in `git-sh-setup` to set its name to this
698 variable when it is invoked as the top level command by the
699 end user, to be recorded in the body of the reflog.
700
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200701`GIT_REF_PARANOIA`::
Jeff King49672f22015-03-20 14:43:06 -0400702 If set to `1`, include broken or badly named refs when iterating
703 over lists of refs. In a normal, non-corrupted repository, this
704 does nothing. However, enabling it may help git to detect and
705 abort some operations in the presence of broken refs. Git sets
706 this variable automatically when performing destructive
707 operations like linkgit:git-prune[1]. You should not need to set
708 it yourself unless you want to be paranoid about making sure
709 an operation has touched every ref (e.g., because you are
710 cloning a repository to make a backup).
711
Tom Russelloeee7f4a2016-06-08 00:35:06 +0200712`GIT_ALLOW_PROTOCOL`::
Brandon Williamsf1762d72016-12-14 14:39:52 -0800713 If set to a colon-separated list of protocols, behave as if
714 `protocol.allow` is set to `never`, and each of the listed
715 protocols has `protocol.<name>.allow` set to `always`
716 (overriding any existing configuration). In other words, any
717 protocol not mentioned will be disallowed (i.e., this is a
718 whitelist, not a blacklist). See the description of
719 `protocol.allow` in linkgit:git-config[1] for more details.
Jeff Kinga5adace2015-09-16 13:12:52 -0400720
Brandon Williamsf1762d72016-12-14 14:39:52 -0800721`GIT_PROTOCOL_FROM_USER`::
722 Set to 0 to prevent protocols used by fetch/push/clone which are
723 configured to the `user` state. This is useful to restrict recursive
724 submodule initialization from an untrusted repository or for programs
725 which feed potentially-untrusted URLS to git commands. See
726 linkgit:git-config[1] for more details.
Jeff King823ab402012-12-19 17:37:30 -0500727
Brandon Williams373d70e2017-10-16 10:55:24 -0700728`GIT_PROTOCOL`::
729 For internal use only. Used in handshaking the wire protocol.
730 Contains a colon ':' separated list of keys with optional values
731 'key[=value]'. Presence of unknown keys and values must be
732 ignored.
733
Jeff King27344d62017-09-27 02:54:30 -0400734`GIT_OPTIONAL_LOCKS`::
735 If set to `0`, Git will complete any requested operation without
736 performing any optional sub-operations that require taking a lock.
737 For example, this will prevent `git status` from refreshing the
738 index as a side effect. This is useful for processes running in
739 the background which do not want to cause lock contention with
740 other operations on the repository. Defaults to `1`.
741
Johannes Schindelinb2f55712017-11-01 18:10:33 +0100742`GIT_REDIRECT_STDIN`::
743`GIT_REDIRECT_STDOUT`::
744`GIT_REDIRECT_STDERR`::
745 Windows-only: allow redirecting the standard input/output/error
746 handles to paths specified by the environment variables. This is
747 particularly useful in multi-threaded applications where the
748 canonical way to pass standard handles via `CreateProcess()` is
749 not an option because it would require the handles to be marked
750 inheritable (and consequently *every* spawned process would
751 inherit them, possibly blocking regular Git operations). The
752 primary intended use case is to use named pipes for communication
753 (e.g. `\\.\pipe\my-git-stdin-123`).
754+
755Two special values are supported: `off` will simply close the
756corresponding standard handle, and if `GIT_REDIRECT_STDERR` is
757`2>&1`, standard error will be redirected to the same handle as
758standard output.
759
Ann T Ropeaa2cd7092017-12-03 22:27:39 +0100760`GIT_PRINT_SHA1_ELLIPSIS` (deprecated)::
761 If set to `yes`, print an ellipsis following an
762 (abbreviated) SHA-1 value. This affects indications of
763 detached HEADs (linkgit:git-checkout[1]) and the raw
764 diff output (linkgit:git-diff[1]). Printing an
765 ellipsis in the cases mentioned is no longer considered
766 adequate and support for it is likely to be removed in the
767 foreseeable future (along with the variable).
768
Junio C Hamano8db93072005-08-30 13:51:01 -0700769Discussion[[Discussion]]
770------------------------
J. Bruce Fields40dac512007-09-03 00:01:19 -0400771
772More detail on the following is available from the
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100773link:user-manual.html#git-concepts[Git concepts chapter of the
Jonathan Nieder6998e4d2008-06-30 17:01:21 -0500774user-manual] and linkgit:gitcore-tutorial[7].
J. Bruce Fields40dac512007-09-03 00:01:19 -0400775
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100776A Git project normally consists of a working directory with a ".git"
J. Bruce Fields40dac512007-09-03 00:01:19 -0400777subdirectory at the top level. The .git directory contains, among other
778things, a compressed object database representing the complete history
779of the project, an "index" file which links that history to the current
780contents of the working tree, and named pointers into that history such
781as tags and branch heads.
782
783The object database contains objects of three main types: blobs, which
784hold file data; trees, which point to blobs and other trees to build up
Ralf Wildenhues02ff6252007-12-18 07:07:36 +0100785directory hierarchies; and commits, which each reference a single tree
J. Bruce Fields40dac512007-09-03 00:01:19 -0400786and some number of parent commits.
787
788The commit, equivalent to what other systems call a "changeset" or
789"version", represents a step in the project's history, and each parent
790represents an immediately preceding step. Commits with more than one
791parent represent merges of independent lines of development.
792
Thomas Ackermannd5fa1f12013-04-15 19:49:04 +0200793All objects are named by the SHA-1 hash of their contents, normally
J. Bruce Fields40dac512007-09-03 00:01:19 -0400794written as a string of 40 hex digits. Such names are globally unique.
795The entire history leading up to a commit can be vouched for by signing
796just that commit. A fourth object type, the tag, is provided for this
797purpose.
798
799When first created, objects are stored in individual files, but for
800efficiency may later be compressed together into "pack files".
801
802Named pointers called refs mark interesting points in history. A ref
Thomas Ackermannd5fa1f12013-04-15 19:49:04 +0200803may contain the SHA-1 name of an object or the name of another ref. Refs
804with names beginning `ref/head/` contain the SHA-1 name of the most
805recent commit (or "head") of a branch under development. SHA-1 names of
J. Bruce Fields40dac512007-09-03 00:01:19 -0400806tags of interest are stored under `ref/tags/`. A special ref named
807`HEAD` contains the name of the currently checked-out branch.
808
809The index file is initialized with a list of all paths and, for each
810path, a blob object and a set of attributes. The blob object represents
811the contents of the file as of the head of the current branch. The
812attributes (last modified time, size, etc.) are taken from the
813corresponding file in the working tree. Subsequent changes to the
814working tree can be found by comparing these attributes. The index may
815be updated with new content, and new commits may be created from the
816content stored in the index.
817
818The index is also capable of storing multiple entries (called "stages")
819for a given pathname. These stages are used to hold the various
820unmerged version of a file when a merge is in progress.
David Greaves6c84e2e2005-05-22 18:44:16 +0100821
Junio C Hamano7687ae92012-08-17 12:48:52 -0700822FURTHER DOCUMENTATION
823---------------------
824
825See the references in the "description" section to get started
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100826using Git. The following is probably more detail than necessary
Junio C Hamano7687ae92012-08-17 12:48:52 -0700827for a first-time user.
828
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100829The link:user-manual.html#git-concepts[Git concepts chapter of the
Junio C Hamano7687ae92012-08-17 12:48:52 -0700830user-manual] and linkgit:gitcore-tutorial[7] both provide
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100831introductions to the underlying Git architecture.
Junio C Hamano7687ae92012-08-17 12:48:52 -0700832
833See linkgit:gitworkflows[7] for an overview of recommended workflows.
834
835See also the link:howto-index.html[howto] documents for some useful
836examples.
837
838The internals are documented in the
Thomas Ackermann48a8c262013-01-21 20:16:20 +0100839link:technical/api-index.html[Git API documentation].
Junio C Hamano7687ae92012-08-17 12:48:52 -0700840
841Users migrating from CVS may also want to
842read linkgit:gitcvs-migration[7].
843
844
Andreas Ericssoncb22bc42005-11-16 00:31:25 +0100845Authors
846-------
Jeff King48bb9142011-03-11 00:52:08 -0500847Git was started by Linus Torvalds, and is currently maintained by Junio
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100848C Hamano. Numerous contributions have come from the Git mailing list
Stefan Beller405869d2014-07-23 14:32:09 +0200849<git@vger.kernel.org>. http://www.openhub.net/p/git/contributors/summary
Junio C Hamano6ecc01f2012-12-12 10:06:24 -0800850gives you a more complete list of contributors.
851
852If you have a clone of git.git itself, the
Jeff Kingd8f708f2011-03-12 22:00:38 -0500853output of linkgit:git-shortlog[1] and linkgit:git-blame[1] can show you
854the authors for specific parts of the project.
David Greaves2cf565c2005-05-10 22:32:30 +0100855
Junio C Hamanoc97ca272010-08-02 09:07:39 -0700856Reporting Bugs
857--------------
858
859Report bugs to the Git mailing list <git@vger.kernel.org> where the
860development and maintenance is primarily done. You do not have to be
861subscribed to the list to send a message there.
862
Ævar Arnfjörð Bjarmason2caa7b82018-03-08 15:08:20 +0000863Issues which are security relevant should be disclosed privately to
864the Git Security mailing list <git-security@googlegroups.com>.
865
Christian Couder497c8332008-05-29 19:21:46 +0200866SEE ALSO
867--------
868linkgit:gittutorial[7], linkgit:gittutorial-2[7],
Philip Oakley673151a2014-10-10 22:25:37 +0100869linkgit:giteveryday[7], linkgit:gitcvs-migration[7],
Christian Couder497c8332008-05-29 19:21:46 +0200870linkgit:gitglossary[7], linkgit:gitcore-tutorial[7],
Thomas Rast801a0112009-06-06 15:11:07 +0200871linkgit:gitcli[7], link:user-manual.html[The Git User's Manual],
872linkgit:gitworkflows[7]
Christian Couder497c8332008-05-29 19:21:46 +0200873
David Greaves2cf565c2005-05-10 22:32:30 +0100874GIT
875---
Christian Couder9e1f0a82008-06-06 09:07:32 +0200876Part of the linkgit:git[1] suite