at commit a0189536

1 git(1)
2 ======
3
4 NAME
5 ----
6 git - the stupid content tracker
7
8
9 SYNOPSIS
10 --------
11 [verse]
12 'git' [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
13 [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
14 [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]
15 [--no-optional-locks] [--no-advice] [--bare] [--git-dir=<path>]
16 [--work-tree=<path>] [--namespace=<name>] [--config-env=<name>=<envvar>]
17 <command> [<args>]
18
19 DESCRIPTION
20 -----------
21 Git is a fast, scalable, distributed revision control system with an
22 unusually rich command set that provides both high-level operations
23 and full access to internals.
24
25 See linkgit:gittutorial[7] to get started, then see
26 linkgit:giteveryday[7] for a useful minimum set of
27 commands. The link:user-manual.html[Git User's Manual] has a more
28 in-depth introduction. See linkgit:gitdatamodel[7] if you want to
29 learn about the data model and important terminology.
30
31 After you mastered the basic concepts, you can come back to this
32 page to learn what commands Git offers. You can learn more about
33 individual Git commands with "git help command". linkgit:gitcli[7]
34 manual page gives you an overview of the command-line command syntax.
35
36 A formatted and hyperlinked copy of the latest Git documentation
37 can be viewed at https://git.github.io/htmldocs/git.html
38 or https://git-scm.com/docs.
39
40
41 OPTIONS
42 -------
43 -v::
44 --version::
45 Prints the Git suite version that the 'git' program came from.
46 +
47 This option is internally converted to `git version ...` and accepts
48 the same options as the linkgit:git-version[1] command. If `--help` is
49 also given, it takes precedence over `--version`.
50
51 -h::
52 --help::
53 Prints the synopsis and a list of the most commonly used
54 commands. If the option `--all` or `-a` is given then all
55 available commands are printed. If a Git command is named this
56 option will bring up the manual page for that command.
57 +
58 Other options are available to control how the manual page is
59 displayed. See linkgit:git-help[1] for more information,
60 because `git --help ...` is converted internally into `git
61 help ...`.
62
63 -C <path>::
64 Run as if git was started in '<path>' instead of the current working
65 directory. When multiple `-C` options are given, each subsequent
66 non-absolute `-C <path>` is interpreted relative to the preceding `-C
67 <path>`. If '<path>' is present but empty, e.g. `-C ""`, then the
68 current working directory is left unchanged.
69 +
70 This option affects options that expect path name like `--git-dir` and
71 `--work-tree` in that their interpretations of the path names would be
72 made relative to the working directory caused by the `-C` option. For
73 example the following invocations are equivalent:
74
75 git --git-dir=a.git --work-tree=b -C c status
76 git --git-dir=c/a.git --work-tree=c/b status
77
78 -c <name>=<value>::
79 Pass a configuration parameter to the command. The value
80 given will override values from configuration files.
81 The <name> is expected in the same format as listed by
82 'git config' (subkeys separated by dots).
83 +
84 Note that omitting the `=` in `git -c foo.bar ...` is allowed and sets
85 `foo.bar` to the boolean true value (just like `[foo]bar` would in a
86 config file). Including the equals but with an empty value (like `git -c
87 foo.bar= ...`) sets `foo.bar` to the empty string which `git config
88 --type=bool` will convert to `false`.
89
90 --config-env=<name>=<envvar>::
91 Like `-c <name>=<value>`, give configuration variable
92 '<name>' a value, where <envvar> is the name of an
93 environment variable from which to retrieve the value. Unlike
94 `-c` there is no shortcut for directly setting the value to an
95 empty string, instead the environment variable itself must be
96 set to the empty string. It is an error if the `<envvar>` does not exist
97 in the environment. `<envvar>` may not contain an equals sign
98 to avoid ambiguity with `<name>` containing one.
99 +
100 This is useful for cases where you want to pass transitory
101 configuration options to git, but are doing so on operating systems
102 where other processes might be able to read your command line
103 (e.g. `/proc/self/cmdline`), but not your environment
104 (e.g. `/proc/self/environ`). That behavior is the default on
105 Linux, but may not be on your system.
106 +
107 Note that this might add security for variables such as
108 `http.extraHeader` where the sensitive information is part of
109 the value, but not e.g. `url.<base>.insteadOf` where the
110 sensitive information can be part of the key.
111
112 --exec-path[=<path>]::
113 Path to wherever your core Git programs are installed.
114 This can also be controlled by setting the GIT_EXEC_PATH
115 environment variable. If no path is given, 'git' will print
116 the current setting and then exit.
117
118 --html-path::
119 Print the path, without trailing slash, where Git's HTML
120 documentation is installed and exit.
121
122 --man-path::
123 Print the manpath (see `man(1)`) for the man pages for
124 this version of Git and exit.
125
126 --info-path::
127 Print the path where the Info files documenting this
128 version of Git are installed and exit.
129
130 -p::
131 --paginate::
132 Pipe all output into 'less' (or if set, $PAGER) if standard
133 output is a terminal. This overrides the `pager.<cmd>`
134 configuration options (see the "Configuration Mechanism" section
135 below).
136
137 -P::
138 --no-pager::
139 Do not pipe Git output into a pager.
140
141 --git-dir=<path>::
142 Set the path to the repository (".git" directory). This can also be
143 controlled by setting the `GIT_DIR` environment variable. It can be
144 an absolute path or relative path to current working directory.
145 +
146 Specifying the location of the ".git" directory using this
147 option (or `GIT_DIR` environment variable) turns off the
148 repository discovery that tries to find a directory with
149 ".git" subdirectory (which is how the repository and the
150 top-level of the working tree are discovered), and tells Git
151 that you are at the top level of the working tree. If you
152 are not at the top-level directory of the working tree, you
153 should tell Git where the top-level of the working tree is,
154 with the `--work-tree=<path>` option (or `GIT_WORK_TREE`
155 environment variable)
156 +
157 If you just want to run git as if it was started in `<path>` then use
158 `git -C <path>`.
159
160 --work-tree=<path>::
161 Set the path to the working tree. It can be an absolute path
162 or a path relative to the current working directory.
163 This can also be controlled by setting the GIT_WORK_TREE
164 environment variable and the core.worktree configuration
165 variable (see core.worktree in linkgit:git-config[1] for a
166 more detailed discussion).
167
168 --namespace=<path>::
169 Set the Git namespace. See linkgit:gitnamespaces[7] for more
170 details. Equivalent to setting the `GIT_NAMESPACE` environment
171 variable.
172
173 --bare::
174 Treat the repository as a bare repository. If GIT_DIR
175 environment is not set, it is set to the current working
176 directory.
177
178 --no-replace-objects::
179 Do not use replacement refs to replace Git objects.
180 This is equivalent to exporting the `GIT_NO_REPLACE_OBJECTS`
181 environment variable with any value.
182 See linkgit:git-replace[1] for more information.
183
184 --no-lazy-fetch::
185 Do not fetch missing objects from the promisor remote on
186 demand. Useful together with `git cat-file -e <object>` to
187 see if the object is locally available.
188 This is equivalent to setting the `GIT_NO_LAZY_FETCH`
189 environment variable to `1`.
190
191 --no-optional-locks::
192 Do not perform optional operations that require locks. This is
193 equivalent to setting the `GIT_OPTIONAL_LOCKS` to `0`.
194
195 --no-advice::
196 Disable all advice hints from being printed.
197
198 --literal-pathspecs::
199 Treat pathspecs literally (i.e. no globbing, no pathspec magic).
200 This is equivalent to setting the `GIT_LITERAL_PATHSPECS` environment
201 variable to `1`.
202
203 --glob-pathspecs::
204 Add "glob" magic to all pathspec. This is equivalent to setting
205 the `GIT_GLOB_PATHSPECS` environment variable to `1`. Disabling
206 globbing on individual pathspecs can be done using pathspec
207 magic ":(literal)"
208
209 --noglob-pathspecs::
210 Add "literal" magic to all pathspec. This is equivalent to setting
211 the `GIT_NOGLOB_PATHSPECS` environment variable to `1`. Enabling
212 globbing on individual pathspecs can be done using pathspec
213 magic ":(glob)"
214
215 --icase-pathspecs::
216 Add "icase" magic to all pathspec. This is equivalent to setting
217 the `GIT_ICASE_PATHSPECS` environment variable to `1`.
218
219 --list-cmds=<group>[,<group>...]::
220 List commands by group. This is an internal/experimental
221 option and may change or be removed in the future. Supported
222 groups are: builtins, parseopt (builtin commands that use
223 parse-options), deprecated (deprecated builtins),
224 main (all commands in libexec directory),
225 others (all other commands in `$PATH` that have git- prefix),
226 list-<category> (see categories in command-list.txt),
227 nohelpers (exclude helper commands), alias and config
228 (retrieve command list from config variable completion.commands)
229
230 --attr-source=<tree-ish>::
231 Read gitattributes from <tree-ish> instead of the worktree. See
232 linkgit:gitattributes[5]. This is equivalent to setting the
233 `GIT_ATTR_SOURCE` environment variable.
234
235 GIT COMMANDS
236 ------------
237
238 We divide Git into high level ("porcelain") commands and low level
239 ("plumbing") commands. For defining command aliases, see
240 linkgit:git-config[1] and look for descriptions of `alias.*`.
241 For installing custom "git" subcommands, see the description for
242 the 'PATH' environment variable in this manual.
243
244 High-level commands (porcelain)
245 -------------------------------
246
247 We separate the porcelain commands into the main commands and some
248 ancillary user utilities.
249
250 Main porcelain commands
251 ~~~~~~~~~~~~~~~~~~~~~~~
252
253 include::{build_dir}/cmds-mainporcelain.adoc[]
254
255 Ancillary Commands
256 ~~~~~~~~~~~~~~~~~~
257 Manipulators:
258
259 include::{build_dir}/cmds-ancillarymanipulators.adoc[]
260
261 Interrogators:
262
263 include::{build_dir}/cmds-ancillaryinterrogators.adoc[]
264
265
266 Interacting with Others
267 ~~~~~~~~~~~~~~~~~~~~~~~
268
269 These commands are to interact with foreign SCM and with other
270 people via patch over e-mail.
271
272 include::{build_dir}/cmds-foreignscminterface.adoc[]
273
274 Reset, restore and revert
275 ~~~~~~~~~~~~~~~~~~~~~~~~~
276 There are three commands with similar names: `git reset`,
277 `git restore` and `git revert`.
278
279 * linkgit:git-revert[1] is about making a new commit that reverts the
280 changes made by other commits.
281
282 * linkgit:git-restore[1] is about restoring files in the working tree
283 from either the index or another commit. This command does not
284 update your branch. The command can also be used to restore files in
285 the index from another commit.
286
287 * linkgit:git-reset[1] is about updating your branch, moving the tip
288 in order to add or remove commits from the branch. This operation
289 changes the commit history.
290 +
291 `git reset` can also be used to restore the index, overlapping with
292 `git restore`.
293
294
295 Low-level commands (plumbing)
296 -----------------------------
297
298 Although Git includes its
299 own porcelain layer, its low-level commands are sufficient to support
300 development of alternative porcelains. Developers of such porcelains
301 might start by reading about linkgit:git-update-index[1] and
302 linkgit:git-read-tree[1].
303
304 The interface (input, output, set of options and the semantics)
305 to these low-level commands are meant to be a lot more stable
306 than Porcelain level commands, because these commands are
307 primarily for scripted use. The interface to Porcelain commands
308 on the other hand are subject to change in order to improve the
309 end user experience.
310
311 The following description divides
312 the low-level commands into commands that manipulate objects (in
313 the repository, index, and working tree), commands that interrogate and
314 compare objects, and commands that move objects and references between
315 repositories.
316
317
318 Manipulation commands
319 ~~~~~~~~~~~~~~~~~~~~~
320
321 include::{build_dir}/cmds-plumbingmanipulators.adoc[]
322
323
324 Interrogation commands
325 ~~~~~~~~~~~~~~~~~~~~~~
326
327 include::{build_dir}/cmds-plumbinginterrogators.adoc[]
328
329 In general, the interrogate commands do not touch the files in
330 the working tree.
331
332
333 Syncing repositories
334 ~~~~~~~~~~~~~~~~~~~~
335
336 include::{build_dir}/cmds-synchingrepositories.adoc[]
337
338 The following are helper commands used by the above; end users
339 typically do not use them directly.
340
341 include::{build_dir}/cmds-synchelpers.adoc[]
342
343
344 Internal helper commands
345 ~~~~~~~~~~~~~~~~~~~~~~~~
346
347 These are internal helper commands used by other commands; end
348 users typically do not use them directly.
349
350 include::{build_dir}/cmds-purehelpers.adoc[]
351
352 Guides
353 ------
354
355 The following documentation pages are guides about Git concepts.
356
357 include::{build_dir}/cmds-guide.adoc[]
358
359 Repository, command and file interfaces
360 ---------------------------------------
361
362 This documentation discusses repository and command interfaces which
363 users are expected to interact with directly. See `--user-formats` in
364 linkgit:git-help[1] for more details on the criteria.
365
366 include::{build_dir}/cmds-userinterfaces.adoc[]
367
368 File formats, protocols and other developer interfaces
369 ------------------------------------------------------
370
371 This documentation discusses file formats, over-the-wire protocols and
372 other git developer interfaces. See `--developer-interfaces` in
373 linkgit:git-help[1].
374
375 include::{build_dir}/cmds-developerinterfaces.adoc[]
376
377 Configuration Mechanism
378 -----------------------
379
380 Git uses a simple text format to store customizations that are per
381 repository and are per user. Such a configuration file may look
382 like this:
383
384 ------------
385 #
386 # A '#' or ';' character indicates a comment.
387 #
388
389 ; core variables
390 [core]
391 ; Don't trust file modes
392 filemode = false
393
394 ; user identity
395 [user]
396 name = "Junio C Hamano"
397 email = "gitster@pobox.com"
398
399 ------------
400
401 Various commands read from the configuration file and adjust
402 their operation accordingly. See linkgit:git-config[1] for a
403 list and more details about the configuration mechanism.
404
405
406 Identifier Terminology
407 ----------------------
408 <object>::
409 Indicates the object name for any type of object.
410
411 <blob>::
412 Indicates a blob object name.
413
414 <tree>::
415 Indicates a tree object name.
416
417 <commit>::
418 Indicates a commit object name.
419
420 <tree-ish>::
421 Indicates a tree, commit or tag object name. A
422 command that takes a <tree-ish> argument ultimately wants to
423 operate on a <tree> object but automatically dereferences
424 <commit> and <tag> objects that point at a <tree>.
425
426 <commit-ish>::
427 Indicates a commit or tag object name. A
428 command that takes a <commit-ish> argument ultimately wants to
429 operate on a <commit> object but automatically dereferences
430 <tag> objects that point at a <commit>.
431
432 <type>::
433 Indicates that an object type is required.
434 Currently one of: `blob`, `tree`, `commit`, or `tag`.
435
436 <file>::
437 Indicates a filename - almost always relative to the
438 root of the tree structure `GIT_INDEX_FILE` describes.
439
440 Symbolic Identifiers
441 --------------------
442 Any Git command accepting any <object> can also use the following
443 symbolic notation:
444
445 HEAD::
446 indicates the head of the current branch.
447
448 <tag>::
449 a valid tag 'name'
450 (i.e. a `refs/tags/<tag>` reference).
451
452 <head>::
453 a valid head 'name'
454 (i.e. a `refs/heads/<head>` reference).
455
456 For a more complete list of ways to spell object names, see
457 "SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
458
459
460 File/Directory Structure
461 ------------------------
462
463 Please see the linkgit:gitrepository-layout[5] document.
464
465 Read linkgit:githooks[5] for more details about each hook.
466
467 Higher level SCMs may provide and manage additional information in the
468 `$GIT_DIR`.
469
470
471 Terminology
472 -----------
473 Please see linkgit:gitglossary[7]. See linkgit:gitdatamodel[7] for a
474 discussion of the core data model, which includes important terminology
475 used throughout the documentation.
476
477
478 Environment Variables
479 ---------------------
480 Various Git commands pay attention to environment variables and change
481 their behavior. The environment variables marked as "Boolean" take
482 their values the same way as Boolean valued configuration variables, i.e.,
483 "true", "yes", "on" and positive numbers are taken as "yes", while "false",
484 "no", "off", and "0" are taken as "no".
485
486 Here are the variables:
487
488 System
489 ~~~~~~
490 `HOME`::
491 Specifies the path to the user's home directory. On Windows, if
492 unset, Git will set a process environment variable equal to:
493 `$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;
494 otherwise `$USERPROFILE` if `$USERPROFILE` exists.
495
496 `PATH`::
497 When a user runs 'git <command>' that is not part of the core Git programs
498 (installed in GIT_EXEC_PATH), 'git-<command>' that is runnable by the user
499 in a directory on `$PATH` is invoked. Argument passed after the command
500 name are passed as-is to the program. To execute `git <foo>`, `git` finds
501 command `<foo>` (either a core Git program found in 'GIT_EXEC_PATH', or a
502 custom one in a directory on 'PATH'), before trying `foo` as an alias.
503
504 The Git Repository
505 ~~~~~~~~~~~~~~~~~~
506 These environment variables apply to 'all' core Git commands. Nb: it
507 is worth noting that they may be used/overridden by SCMS sitting above
508 Git so take care if using a foreign front-end.
509
510 `GIT_INDEX_FILE`::
511 This environment variable specifies an alternate
512 index file. If not specified, the default of `$GIT_DIR/index`
513 is used.
514
515 `GIT_INDEX_VERSION`::
516 This environment variable specifies what index version is used
517 when writing the index file out. It won't affect existing index
518 files. By default index file version 2 or 3 is used. See
519 linkgit:git-update-index[1] for more information.
520
521 `GIT_OBJECT_DIRECTORY`::
522 If the object storage directory is specified via this
523 environment variable then the sha1 directories are created
524 underneath - otherwise the default `$GIT_DIR/objects`
525 directory is used.
526
527 `GIT_ALTERNATE_OBJECT_DIRECTORIES`::
528 Due to the immutable nature of Git objects, old objects can be
529 archived into shared, read-only directories. This variable
530 specifies a ":" separated (on Windows ";" separated) list
531 of Git object directories which can be used to search for Git
532 objects. New objects will not be written to these directories.
533 +
534 Entries that begin with `"` (double-quote) will be interpreted
535 as C-style quoted paths, removing leading and trailing
536 double-quotes and respecting backslash escapes. E.g., the value
537 `"path-with-\"-and-:-in-it":vanilla-path` has two paths:
538 `path-with-"-and-:-in-it` and `vanilla-path`.
539
540 `GIT_DIR`::
541 If the `GIT_DIR` environment variable is set then it
542 specifies a path to use instead of the default `.git`
543 for the base of the repository.
544 The `--git-dir` command-line option also sets this value.
545
546 `GIT_WORK_TREE`::
547 Set the path to the root of the working tree.
548 This can also be controlled by the `--work-tree` command-line
549 option and the core.worktree configuration variable.
550
551 `GIT_NAMESPACE`::
552 Set the Git namespace; see linkgit:gitnamespaces[7] for details.
553 The `--namespace` command-line option also sets this value.
554
555 `GIT_CEILING_DIRECTORIES`::
556 This should be a colon-separated list of absolute paths. If
557 set, it is a list of directories that Git should not chdir up
558 into while looking for a repository directory (useful for
559 excluding slow-loading network directories). It will not
560 exclude the current working directory or a GIT_DIR set on the
561 command line or in the environment. Normally, Git has to read
562 the entries in this list and resolve any symlink that
563 might be present in order to compare them with the current
564 directory. However, if even this access is slow, you
565 can add an empty entry to the list to tell Git that the
566 subsequent entries are not symlinks and needn't be resolved;
567 e.g.,
568 `GIT_CEILING_DIRECTORIES=/maybe/symlink::/very/slow/non/symlink`.
569
570 `GIT_DISCOVERY_ACROSS_FILESYSTEM`::
571 When run in a directory that does not have ".git" repository
572 directory, Git tries to find such a directory in the parent
573 directories to find the top of the working tree, but by default it
574 does not cross filesystem boundaries. This Boolean environment variable
575 can be set to true to tell Git not to stop at filesystem
576 boundaries. Like `GIT_CEILING_DIRECTORIES`, this will not affect
577 an explicit repository directory set via `GIT_DIR` or on the
578 command line.
579
580 `GIT_COMMON_DIR`::
581 If this variable is set to a path, non-worktree files that are
582 normally in $GIT_DIR will be taken from this path
583 instead. Worktree-specific files such as HEAD or index are
584 taken from $GIT_DIR. See linkgit:gitrepository-layout[5] and
585 linkgit:git-worktree[1] for
586 details. This variable has lower precedence than other path
587 variables such as GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY...
588
589 `GIT_DEFAULT_HASH`::
590 If this variable is set, the default hash algorithm for new
591 repositories will be set to this value. This value is
592 ignored when cloning and the setting of the remote repository
593 is always used. The default is "sha1".
594 See `--object-format` in linkgit:git-init[1].
595
596 `GIT_DEFAULT_REF_FORMAT`::
597 If this variable is set, the default reference backend format for new
598 repositories will be set to this value. The default is "files".
599 See `--ref-format` in linkgit:git-init[1].
600
601 `GIT_REFERENCE_BACKEND`::
602 Specify which reference backend to be used along with its URI.
603 See `extensions.refStorage` option in linkgit:git-config[1] for more
604 details. Overrides the config variable when used.
605
606 Git Commits
607 ~~~~~~~~~~~
608 `GIT_AUTHOR_NAME`::
609 The human-readable name used in the author identity when creating commit or
610 tag objects, or when writing reflogs. Overrides the `user.name` and
611 `author.name` configuration settings.
612
613 `GIT_AUTHOR_EMAIL`::
614 The email address used in the author identity when creating commit or
615 tag objects, or when writing reflogs. Overrides the `user.email` and
616 `author.email` configuration settings.
617
618 `GIT_AUTHOR_DATE`::
619 The date used for the author identity when creating commit or tag objects, or
620 when writing reflogs. See linkgit:git-commit[1] for valid formats.
621
622 `GIT_COMMITTER_NAME`::
623 The human-readable name used in the committer identity when creating commit or
624 tag objects, or when writing reflogs. Overrides the `user.name` and
625 `committer.name` configuration settings.
626
627 `GIT_COMMITTER_EMAIL`::
628 The email address used in the author identity when creating commit or
629 tag objects, or when writing reflogs. Overrides the `user.email` and
630 `committer.email` configuration settings.
631
632 `GIT_COMMITTER_DATE`::
633 The date used for the committer identity when creating commit or tag objects, or
634 when writing reflogs. See linkgit:git-commit[1] for valid formats.
635
636 `EMAIL`::
637 The email address used in the author and committer identities if no other
638 relevant environment variable or configuration setting has been set.
639
640 Git Diffs
641 ~~~~~~~~~
642 `GIT_DIFF_OPTS`::
643 Only valid setting is "--unified=??" or "-u??" to set the
644 number of context lines shown when a unified diff is created.
645 This takes precedence over any "-U" or "--unified" option
646 value passed on the Git diff command line.
647
648 `GIT_EXTERNAL_DIFF`::
649 When the environment variable `GIT_EXTERNAL_DIFF` is set, the
650 program named by it is called to generate diffs, and Git
651 does not use its builtin diff machinery.
652 For a path that is added, removed, or modified,
653 `GIT_EXTERNAL_DIFF` is called with 7 parameters:
654
655 path old-file old-hex old-mode new-file new-hex new-mode
656 +
657 where:
658
659 <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
660 contents of <old|new>,
661 <old|new>-hex:: are the 40-hexdigit SHA-1 hashes,
662 <old|new>-mode:: are the octal representation of the file modes.
663 +
664 The file parameters can point at the user's working file
665 (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
666 when a new file is added), or a temporary file (e.g. `old-file` in the
667 index). `GIT_EXTERNAL_DIFF` should not worry about unlinking the
668 temporary file -- it is removed when `GIT_EXTERNAL_DIFF` exits.
669 +
670 For a path that is unmerged, `GIT_EXTERNAL_DIFF` is called with 1
671 parameter, <path>.
672 +
673 For each path `GIT_EXTERNAL_DIFF` is called, two environment variables,
674 `GIT_DIFF_PATH_COUNTER` and `GIT_DIFF_PATH_TOTAL` are set.
675
676 `GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE`::
677 If this Boolean environment variable is set to true then the
678 `GIT_EXTERNAL_DIFF` command is expected to return exit code
679 0 if it considers the input files to be equal or 1 if it
680 considers them to be different, like `diff(1)`.
681 If it is set to false, which is the default, then the command
682 is expected to return exit code 0 regardless of equality.
683 Any other exit code causes Git to report a fatal error.
684
685
686 `GIT_DIFF_PATH_COUNTER`::
687 A 1-based counter incremented by one for every path.
688
689 `GIT_DIFF_PATH_TOTAL`::
690 The total number of paths.
691
692 other
693 ~~~~~
694 `GIT_MERGE_VERBOSITY`::
695 A number controlling the amount of output shown by
696 the recursive merge strategy. Overrides merge.verbosity.
697 See linkgit:git-merge[1]
698
699 `GIT_PAGER`::
700 This environment variable overrides `$PAGER`. If it is set
701 to an empty string or to the value "cat", Git will not launch
702 a pager. See also the `core.pager` option in
703 linkgit:git-config[1].
704
705 `GIT_PROGRESS_DELAY`::
706 A number controlling how many seconds to delay before showing
707 optional progress indicators. Defaults to 1.
708
709 `GIT_EDITOR`::
710 This environment variable overrides `$EDITOR` and `$VISUAL`.
711 It is used by several Git commands when, on interactive mode,
712 an editor is to be launched. See also linkgit:git-var[1]
713 and the `core.editor` option in linkgit:git-config[1].
714
715 `GIT_SEQUENCE_EDITOR`::
716 This environment variable overrides the configured Git editor
717 when editing the todo list of an interactive rebase. See also
718 linkgit:git-rebase[1] and the `sequence.editor` option in
719 linkgit:git-config[1].
720
721 `GIT_SSH`::
722 `GIT_SSH_COMMAND`::
723 If either of these environment variables is set then 'git fetch'
724 and 'git push' will use the specified command instead of 'ssh'
725 when they need to connect to a remote system.
726 The command-line parameters passed to the configured command are
727 determined by the ssh variant. See `ssh.variant` option in
728 linkgit:git-config[1] for details.
729 +
730 `$GIT_SSH_COMMAND` takes precedence over `$GIT_SSH`, and is interpreted
731 by the shell, which allows additional arguments to be included.
732 `$GIT_SSH` on the other hand must be just the path to a program
733 (which can be a wrapper shell script, if additional arguments are
734 needed).
735 +
736 Usually it is easier to configure any desired options through your
737 personal `.ssh/config` file. Please consult your ssh documentation
738 for further details.
739
740 `GIT_SSH_VARIANT`::
741 If this environment variable is set, it overrides Git's autodetection
742 whether `GIT_SSH`/`GIT_SSH_COMMAND`/`core.sshCommand` refer to OpenSSH,
743 plink or tortoiseplink. This variable overrides the config setting
744 `ssh.variant` that serves the same purpose.
745
746 `GIT_SSL_NO_VERIFY`::
747 Setting and exporting this environment variable to any value
748 tells Git not to verify the SSL certificate when fetching or
749 pushing over HTTPS.
750
751 `GIT_ATTR_SOURCE`::
752 Sets the treeish that gitattributes will be read from.
753
754 `GIT_ASKPASS`::
755 If this environment variable is set, then Git commands which need to
756 acquire passwords or passphrases (e.g. for HTTP or IMAP authentication)
757 will call this program with a suitable prompt as command-line argument
758 and read the password from its STDOUT. See also the `core.askPass`
759 option in linkgit:git-config[1].
760
761 `GIT_TERMINAL_PROMPT`::
762 If this Boolean environment variable is set to false, git will not prompt
763 on the terminal (e.g., when asking for HTTP authentication).
764
765 `GIT_CONFIG_GLOBAL`::
766 `GIT_CONFIG_SYSTEM`::
767 Take the configuration from the given files instead from global or
768 system-level configuration files. If `GIT_CONFIG_SYSTEM` is set, the
769 system config file defined at build time (usually `/etc/gitconfig`)
770 will not be read. Likewise, if `GIT_CONFIG_GLOBAL` is set, neither
771 `$HOME/.gitconfig` nor `$XDG_CONFIG_HOME/git/config` will be read. Can
772 be set to `/dev/null` to skip reading configuration files of the
773 respective level.
774
775 `GIT_CONFIG_NOSYSTEM`::
776 Whether to skip reading settings from the system-wide
777 `$(prefix)/etc/gitconfig` file. This Boolean environment variable can
778 be used along with `$HOME` and `$XDG_CONFIG_HOME` to create a
779 predictable environment for a picky script, or you can set it
780 to true to temporarily avoid using a buggy `/etc/gitconfig` file while
781 waiting for someone with sufficient permissions to fix it.
782
783 `GIT_FLUSH`::
784 If this Boolean environment variable is set to true, then commands such
785 as 'git blame' (in incremental mode), 'git rev-list', 'git log',
786 'git check-attr' and 'git check-ignore' will
787 force a flush of the output stream after each record have been
788 flushed. If this
789 variable is set to false, the output of these commands will be done
790 using completely buffered I/O. If this environment variable is
791 not set, Git will choose buffered or record-oriented flushing
792 based on whether stdout appears to be redirected to a file or not.
793
794 `GIT_TRACE`::
795 Enables general trace messages, e.g. alias expansion, built-in
796 command execution and external command execution.
797 +
798 If this variable is set to "1", "2" or "true" (comparison
799 is case insensitive), trace messages will be printed to
800 stderr.
801 +
802 If the variable is set to an integer value greater than 2
803 and lower than 10 (strictly) then Git will interpret this
804 value as an open file descriptor and will try to write the
805 trace messages into this file descriptor.
806 +
807 Alternatively, if the variable is set to an absolute path
808 (starting with a '/' character), Git will interpret this
809 as a file path and will try to append the trace messages
810 to it.
811 +
812 Unsetting the variable, or setting it to empty, "0" or
813 "false" (case insensitive) disables trace messages.
814
815 `GIT_TRACE_FSMONITOR`::
816 Enables trace messages for the filesystem monitor extension.
817 See `GIT_TRACE` for available trace output options.
818
819 `GIT_TRACE_PACK_ACCESS`::
820 Enables trace messages for all accesses to any packs. For each
821 access, the pack file name and an offset in the pack is
822 recorded. This may be helpful for troubleshooting some
823 pack-related performance problems.
824 See `GIT_TRACE` for available trace output options.
825
826 `GIT_TRACE_PACKET`::
827 Enables trace messages for all packets coming in or out of a
828 given program. This can help with debugging object negotiation
829 or other protocol issues. Tracing is turned off at a packet
830 starting with "PACK" (but see `GIT_TRACE_PACKFILE` below).
831 See `GIT_TRACE` for available trace output options.
832
833 `GIT_TRACE_PACKFILE`::
834 Enables tracing of packfiles sent or received by a
835 given program. Unlike other trace output, this trace is
836 verbatim: no headers, and no quoting of binary data. You almost
837 certainly want to direct into a file (e.g.,
838 `GIT_TRACE_PACKFILE=/tmp/my.pack`) rather than displaying it on
839 the terminal or mixing it with other trace output.
840 +
841 Note that this is currently only implemented for the client side
842 of clones and fetches.
843
844 `GIT_TRACE_PERFORMANCE`::
845 Enables performance related trace messages, e.g. total execution
846 time of each Git command.
847 See `GIT_TRACE` for available trace output options.
848
849 `GIT_TRACE_REFS`::
850 Enables trace messages for operations on the ref database.
851 See `GIT_TRACE` for available trace output options.
852
853 `GIT_TRACE_SETUP`::
854 Enables trace messages printing the .git, working tree and current
855 working directory after Git has completed its setup phase.
856 See `GIT_TRACE` for available trace output options.
857
858 `GIT_TRACE_SHALLOW`::
859 Enables trace messages that can help debugging fetching /
860 cloning of shallow repositories.
861 See `GIT_TRACE` for available trace output options.
862
863 `GIT_TRACE_CURL`::
864 Enables a curl full trace dump of all incoming and outgoing data,
865 including descriptive information, of the git transport protocol.
866 This is similar to doing curl `--trace-ascii` on the command line.
867 See `GIT_TRACE` for available trace output options.
868
869 `GIT_TRACE_CURL_NO_DATA`::
870 When a curl trace is enabled (see `GIT_TRACE_CURL` above), do not dump
871 data (that is, only dump info lines and headers).
872
873 `GIT_TRACE2`::
874 Enables more detailed trace messages from the "trace2" library.
875 Output from `GIT_TRACE2` is a simple text-based format for human
876 readability.
877 +
878 If this variable is set to "1", "2" or "true" (comparison
879 is case insensitive), trace messages will be printed to
880 stderr.
881 +
882 If the variable is set to an integer value greater than 2
883 and lower than 10 (strictly) then Git will interpret this
884 value as an open file descriptor and will try to write the
885 trace messages into this file descriptor.
886 +
887 Alternatively, if the variable is set to an absolute path
888 (starting with a '/' character), Git will interpret this
889 as a file path and will try to append the trace messages
890 to it. If the path already exists and is a directory, the
891 trace messages will be written to files (one per process)
892 in that directory, named according to the last component
893 of the SID and an optional counter (to avoid filename
894 collisions).
895 +
896 In addition, if the variable is set to
897 `af_unix:[<socket-type>:]<absolute-pathname>`, Git will try
898 to open the path as a Unix Domain Socket. The socket type
899 can be either `stream` or `dgram`.
900 +
901 Unsetting the variable, or setting it to empty, "0" or
902 "false" (case insensitive) disables trace messages.
903 +
904 See link:technical/api-trace2.html[Trace2 documentation]
905 for full details.
906
907
908 `GIT_TRACE2_EVENT`::
909 This setting writes a JSON-based format that is suited for machine
910 interpretation.
911 See `GIT_TRACE2` for available trace output options and
912 link:technical/api-trace2.html[Trace2 documentation] for full details.
913
914 `GIT_TRACE2_PERF`::
915 In addition to the text-based messages available in `GIT_TRACE2`, this
916 setting writes a column-based format for understanding nesting
917 regions.
918 See `GIT_TRACE2` for available trace output options and
919 link:technical/api-trace2.html[Trace2 documentation] for full details.
920
921 `GIT_TRACE_REDACT`::
922 By default, when tracing is activated, Git redacts the values of
923 cookies, the "Authorization:" header, the "Proxy-Authorization:"
924 header and packfile URIs. Set this Boolean environment variable to false to prevent this
925 redaction.
926
927 `GIT_NO_REPLACE_OBJECTS`::
928 Setting and exporting this environment variable tells Git to
929 ignore replacement refs and do not replace Git objects.
930
931 `GIT_LITERAL_PATHSPECS`::
932 Setting this Boolean environment variable to true will cause Git to treat all
933 pathspecs literally, rather than as glob patterns. For example,
934 running `GIT_LITERAL_PATHSPECS=1 git log -- '*.c'` will search
935 for commits that touch the path `*.c`, not any paths that the
936 glob `*.c` matches. You might want this if you are feeding
937 literal paths to Git (e.g., paths previously given to you by
938 `git ls-tree`, `--raw` diff output, etc).
939
940 `GIT_GLOB_PATHSPECS`::
941 Setting this Boolean environment variable to true will cause Git to treat all
942 pathspecs as glob patterns (aka "glob" magic).
943
944 `GIT_NOGLOB_PATHSPECS`::
945 Setting this Boolean environment variable to true will cause Git to treat all
946 pathspecs as literal (aka "literal" magic).
947
948 `GIT_ICASE_PATHSPECS`::
949 Setting this Boolean environment variable to true will cause Git to treat all
950 pathspecs as case-insensitive.
951
952 `GIT_NO_LAZY_FETCH`::
953 Setting this Boolean environment variable to true tells Git
954 not to lazily fetch missing objects from the promisor remote
955 on demand.
956
957 `GIT_REFLOG_ACTION`::
958 When a ref is updated, reflog entries are created to keep
959 track of the reason why the ref was updated (which is
960 typically the name of the high-level command that updated
961 the ref), in addition to the old and new values of the ref.
962 A scripted Porcelain command can use set_reflog_action
963 helper function in `git-sh-setup` to set its name to this
964 variable when it is invoked as the top level command by the
965 end user, to be recorded in the body of the reflog.
966
967 `GIT_REF_PARANOIA`::
968 If this Boolean environment variable is set to false, ignore broken or badly named refs when iterating
969 over lists of refs. Normally Git will try to include any such
970 refs, which may cause some operations to fail. This is usually
971 preferable, as potentially destructive operations (e.g.,
972 linkgit:git-prune[1]) are better off aborting rather than
973 ignoring broken refs (and thus considering the history they
974 point to as not worth saving). The default value is `1` (i.e.,
975 be paranoid about detecting and aborting all operations). You
976 should not normally need to set this to `0`, but it may be
977 useful when trying to salvage data from a corrupted repository.
978
979 `GIT_COMMIT_GRAPH_PARANOIA`::
980 When loading a commit object from the commit-graph, Git performs an
981 existence check on the object in the object database. This is done to
982 avoid issues with stale commit-graphs that contain references to
983 already-deleted commits, but comes with a performance penalty.
984 +
985 The default is "false", which disables the aforementioned behavior.
986 Setting this to "true" enables the existence check so that stale commits
987 will never be returned from the commit-graph at the cost of performance.
988
989 `GIT_ALLOW_PROTOCOL`::
990 If set to a colon-separated list of protocols, behave as if
991 `protocol.allow` is set to `never`, and each of the listed
992 protocols has `protocol.<name>.allow` set to `always`
993 (overriding any existing configuration). See the description of
994 `protocol.allow` in linkgit:git-config[1] for more details.
995
996 `GIT_PROTOCOL_FROM_USER`::
997 Set this Boolean environment variable to false to prevent protocols used by fetch/push/clone which are
998 configured to the `user` state. This is useful to restrict recursive
999 submodule initialization from an untrusted repository or for programs
1000 which feed potentially-untrusted URLS to git commands. See
1001 linkgit:git-config[1] for more details.
1002
1003 `GIT_PROTOCOL`::
1004 For internal use only. Used in handshaking the wire protocol.
1005 Contains a colon ':' separated list of keys with optional values
1006 '<key>[=<value>]'. Presence of unknown keys and values must be
1007 ignored.
1008 +
1009 Note that servers may need to be configured to allow this variable to
1010 pass over some transports. It will be propagated automatically when
1011 accessing local repositories (i.e., `file://` or a filesystem path), as
1012 well as over the `git://` protocol. For git-over-http, it should work
1013 automatically in most configurations, but see the discussion in
1014 linkgit:git-http-backend[1]. For git-over-ssh, the ssh server may need
1015 to be configured to allow clients to pass this variable (e.g., by using
1016 `AcceptEnv GIT_PROTOCOL` with OpenSSH).
1017 +
1018 This configuration is optional. If the variable is not propagated, then
1019 clients will fall back to the original "v0" protocol (but may miss out
1020 on some performance improvements or features). This variable currently
1021 only affects clones and fetches; it is not yet used for pushes (but may
1022 be in the future).
1023
1024 `GIT_OPTIONAL_LOCKS`::
1025 If this Boolean environment variable is set to false, Git will complete any requested operation without
1026 performing any optional sub-operations that require taking a lock.
1027 For example, this will prevent `git status` from refreshing the
1028 index as a side effect. This is useful for processes running in
1029 the background which do not want to cause lock contention with
1030 other operations on the repository. Defaults to `1`.
1031
1032 `GIT_REDIRECT_STDIN`::
1033 `GIT_REDIRECT_STDOUT`::
1034 `GIT_REDIRECT_STDERR`::
1035 Windows-only: allow redirecting the standard input/output/error
1036 handles to paths specified by the environment variables. This is
1037 particularly useful in multi-threaded applications where the
1038 canonical way to pass standard handles via `CreateProcess()` is
1039 not an option because it would require the handles to be marked
1040 inheritable (and consequently *every* spawned process would
1041 inherit them, possibly blocking regular Git operations). The
1042 primary intended use case is to use named pipes for communication
1043 (e.g. `\\.\pipe\my-git-stdin-123`).
1044 +
1045 Two special values are supported: `off` will simply close the
1046 corresponding standard handle, and if `GIT_REDIRECT_STDERR` is
1047 `2>&1`, standard error will be redirected to the same handle as
1048 standard output.
1049
1050 `GIT_PRINT_SHA1_ELLIPSIS` (deprecated)::
1051 If set to `yes`, print an ellipsis following an
1052 (abbreviated) SHA-1 value. This affects indications of
1053 detached HEADs (linkgit:git-checkout[1]) and the raw
1054 diff output (linkgit:git-diff[1]). Printing an
1055 ellipsis in the cases mentioned is no longer considered
1056 adequate and support for it is likely to be removed in the
1057 foreseeable future (along with the variable).
1058
1059 `GIT_ADVICE`::
1060 If set to `0`, then disable all advice messages. These messages are
1061 intended to provide hints to human users that may help them get out of
1062 problematic situations or take advantage of new features. Users can
1063 disable individual messages using the `advice.*` config keys. These
1064 messages may be disruptive to tools that execute Git processes, so this
1065 variable is available to disable the messages. (The `--no-advice`
1066 global option is also available, but old Git versions may fail when
1067 this option is not understood. The environment variable will be ignored
1068 by Git versions that do not understand it.)
1069
1070 Discussion[[Discussion]]
1071 ------------------------
1072
1073 More detail on the following is available from the
1074 link:user-manual.html#git-concepts[Git concepts chapter of the
1075 user-manual] and linkgit:gitcore-tutorial[7].
1076
1077 A Git project normally consists of a working directory with a ".git"
1078 subdirectory at the top level. The .git directory contains, among other
1079 things, a compressed object database representing the complete history
1080 of the project, an "index" file which links that history to the current
1081 contents of the working tree, and named pointers into that history such
1082 as tags and branch heads.
1083
1084 The object database contains objects of three main types: blobs, which
1085 hold file data; trees, which point to blobs and other trees to build up
1086 directory hierarchies; and commits, which each reference a single tree
1087 and some number of parent commits.
1088
1089 The commit, equivalent to what other systems call a "changeset" or
1090 "version", represents a step in the project's history, and each parent
1091 represents an immediately preceding step. Commits with more than one
1092 parent represent merges of independent lines of development.
1093
1094 All objects are named by the SHA-1 hash of their contents, normally
1095 written as a string of 40 hex digits. Such names are globally unique.
1096 The entire history leading up to a commit can be vouched for by signing
1097 just that commit. A fourth object type, the tag, is provided for this
1098 purpose.
1099
1100 When first created, objects are stored in individual files, but for
1101 efficiency may later be compressed together into "pack files".
1102
1103 Named pointers called refs mark interesting points in history. A ref
1104 may contain the SHA-1 name of an object or the name of another ref (the
1105 latter is called a "symbolic ref").
1106 Refs with names beginning `refs/head/` contain the SHA-1 name of the most
1107 recent commit (or "head") of a branch under development. SHA-1 names of
1108 tags of interest are stored under `refs/tags/`. A symbolic ref named
1109 `HEAD` contains the name of the currently checked-out branch.
1110
1111 The index file is initialized with a list of all paths and, for each
1112 path, a blob object and a set of attributes. The blob object represents
1113 the contents of the file as of the head of the current branch. The
1114 attributes (last modified time, size, etc.) are taken from the
1115 corresponding file in the working tree. Subsequent changes to the
1116 working tree can be found by comparing these attributes. The index may
1117 be updated with new content, and new commits may be created from the
1118 content stored in the index.
1119
1120 The index is also capable of storing multiple entries (called "stages")
1121 for a given pathname. These stages are used to hold the various
1122 unmerged version of a file when a merge is in progress.
1123
1124 SECURITY
1125 --------
1126
1127 Some configuration options and hook files may cause Git to run arbitrary
1128 shell commands. Because configuration and hooks are not copied using
1129 `git clone`, it is generally safe to clone remote repositories with
1130 untrusted content, inspect them with `git log`, and so on.
1131
1132 However, it is not safe to run Git commands in a `.git` directory (or
1133 the working tree that surrounds it) when that `.git` directory itself
1134 comes from an untrusted source. The commands in its config and hooks
1135 are executed in the usual way.
1136
1137 By default, Git will refuse to run when the repository is owned by
1138 someone other than the user running the command. See the entry for
1139 `safe.directory` in linkgit:git-config[1]. While this can help protect
1140 you in a multi-user environment, note that you can also acquire
1141 untrusted repositories that are owned by you (for example, if you
1142 extract a zip file or tarball from an untrusted source). In such cases,
1143 you'd need to "sanitize" the untrusted repository first.
1144
1145 If you have an untrusted `.git` directory, you should first clone it
1146 with `git clone --no-local` to obtain a clean copy. Git does restrict
1147 the set of options and hooks that will be run by `upload-pack`, which
1148 handles the server side of a clone or fetch, but beware that the
1149 surface area for attack against `upload-pack` is large, so this does
1150 carry some risk. The safest thing is to serve the repository as an
1151 unprivileged user (either via linkgit:git-daemon[1], ssh, or using
1152 other tools to change user ids). See the discussion in the `SECURITY`
1153 section of linkgit:git-upload-pack[1].
1154
1155 FURTHER DOCUMENTATION
1156 ---------------------
1157
1158 See the references in the "description" section to get started
1159 using Git. The following is probably more detail than necessary
1160 for a first-time user.
1161
1162 The link:user-manual.html#git-concepts[Git concepts chapter of the
1163 user-manual] and linkgit:gitcore-tutorial[7] both provide
1164 introductions to the underlying Git architecture.
1165
1166 See linkgit:gitworkflows[7] for an overview of recommended workflows.
1167
1168 See also the link:howto-index.html[howto] documents for some useful
1169 examples.
1170
1171 The internals are documented in the
1172 link:technical/api-index.html[Git API documentation].
1173
1174 Users migrating from CVS may also want to
1175 read linkgit:gitcvs-migration[7].
1176
1177
1178 Authors
1179 -------
1180 Git was started by Linus Torvalds, and is currently maintained by Junio
1181 C Hamano. Numerous contributions have come from the Git mailing list
1182 <git@vger.kernel.org>. https://openhub.net/p/git/contributors/summary
1183 gives you a more complete list of contributors.
1184
1185 If you have a clone of git.git itself, the
1186 output of linkgit:git-shortlog[1] and linkgit:git-blame[1] can show you
1187 the authors for specific parts of the project.
1188
1189 Reporting Bugs
1190 --------------
1191
1192 Report bugs to the Git mailing list <git@vger.kernel.org> where the
1193 development and maintenance is primarily done. You do not have to be
1194 subscribed to the list to send a message there. See the list archive
1195 at https://lore.kernel.org/git for previous bug reports and other
1196 discussions.
1197
1198 Issues which are security relevant should be disclosed privately to
1199 the Git Security mailing list <git-security@googlegroups.com>.
1200
1201 SEE ALSO
1202 --------
1203 linkgit:gittutorial[7], linkgit:gittutorial-2[7],
1204 linkgit:giteveryday[7], linkgit:gitcvs-migration[7],
1205 linkgit:gitglossary[7], linkgit:gitdatamodel[7],
1206 linkgit:gitcore-tutorial[7], linkgit:gitcli[7],
1207 link:user-manual.html[The Git User's Manual],
1208 linkgit:gitworkflows[7]
1209
1210 GIT
1211 ---
1212 Part of the linkgit:git[1] suite