1GIT(1) Git Manual GIT(1)
2
3
4
6 git - the stupid content tracker
7
9 git [--version] [--help] [-C <path>] [-c <name>=<value>]
10 [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
11 [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
12 [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
13 [--super-prefix=<path>]
14 <command> [<args>]
15
16
18 Git is a fast, scalable, distributed revision control system with an
19 unusually rich command set that provides both high-level operations and
20 full access to internals.
21
22 See gittutorial(7) to get started, then see giteveryday(7) for a useful
23 minimum set of commands. The Git User’s Manual[1] has a more in-depth
24 introduction.
25
26 After you mastered the basic concepts, you can come back to this page
27 to learn what commands Git offers. You can learn more about individual
28 Git commands with "git help command". gitcli(7) manual page gives you
29 an overview of the command-line command syntax.
30
31 A formatted and hyperlinked copy of the latest Git documentation can be
32 viewed at https://git.github.io/htmldocs/git.html or
33 https://git-scm.com/docs.
34
36 --version
37 Prints the Git suite version that the git program came from.
38
39 --help
40 Prints the synopsis and a list of the most commonly used commands.
41 If the option --all or -a is given then all available commands are
42 printed. If a Git command is named this option will bring up the
43 manual page for that command.
44
45 Other options are available to control how the manual page is
46 displayed. See git-help(1) for more information, because git --help
47 ... is converted internally into git help ....
48
49 -C <path>
50 Run as if git was started in <path> instead of the current working
51 directory. When multiple -C options are given, each subsequent
52 non-absolute -C <path> is interpreted relative to the preceding -C
53 <path>. If <path> is present but empty, e.g. -C "", then the
54 current working directory is left unchanged.
55
56 This option affects options that expect path name like --git-dir
57 and --work-tree in that their interpretations of the path names
58 would be made relative to the working directory caused by the -C
59 option. For example the following invocations are equivalent:
60
61 git --git-dir=a.git --work-tree=b -C c status
62 git --git-dir=c/a.git --work-tree=c/b status
63
64 -c <name>=<value>
65 Pass a configuration parameter to the command. The value given will
66 override values from configuration files. The <name> is expected in
67 the same format as listed by git config (subkeys separated by
68 dots).
69
70 Note that omitting the = in git -c foo.bar ... is allowed and sets
71 foo.bar to the boolean true value (just like [foo]bar would in a
72 config file). Including the equals but with an empty value (like
73 git -c foo.bar= ...) sets foo.bar to the empty string which git
74 config --type=bool will convert to false.
75
76 --exec-path[=<path>]
77 Path to wherever your core Git programs are installed. This can
78 also be controlled by setting the GIT_EXEC_PATH environment
79 variable. If no path is given, git will print the current setting
80 and then exit.
81
82 --html-path
83 Print the path, without trailing slash, where Git’s HTML
84 documentation is installed and exit.
85
86 --man-path
87 Print the manpath (see man(1)) for the man pages for this version
88 of Git and exit.
89
90 --info-path
91 Print the path where the Info files documenting this version of Git
92 are installed and exit.
93
94 -p, --paginate
95 Pipe all output into less (or if set, $PAGER) if standard output is
96 a terminal. This overrides the pager.<cmd> configuration options
97 (see the "Configuration Mechanism" section below).
98
99 -P, --no-pager
100 Do not pipe Git output into a pager.
101
102 --git-dir=<path>
103 Set the path to the repository. This can also be controlled by
104 setting the GIT_DIR environment variable. It can be an absolute
105 path or relative path to current working directory.
106
107 --work-tree=<path>
108 Set the path to the working tree. It can be an absolute path or a
109 path relative to the current working directory. This can also be
110 controlled by setting the GIT_WORK_TREE environment variable and
111 the core.worktree configuration variable (see core.worktree in git-
112 config(1) for a more detailed discussion).
113
114 --namespace=<path>
115 Set the Git namespace. See gitnamespaces(7) for more details.
116 Equivalent to setting the GIT_NAMESPACE environment variable.
117
118 --super-prefix=<path>
119 Currently for internal use only. Set a prefix which gives a path
120 from above a repository down to its root. One use is to give
121 submodules context about the superproject that invoked it.
122
123 --bare
124 Treat the repository as a bare repository. If GIT_DIR environment
125 is not set, it is set to the current working directory.
126
127 --no-replace-objects
128 Do not use replacement refs to replace Git objects. See git-
129 replace(1) for more information.
130
131 --literal-pathspecs
132 Treat pathspecs literally (i.e. no globbing, no pathspec magic).
133 This is equivalent to setting the GIT_LITERAL_PATHSPECS environment
134 variable to 1.
135
136 --glob-pathspecs
137 Add "glob" magic to all pathspec. This is equivalent to setting the
138 GIT_GLOB_PATHSPECS environment variable to 1. Disabling globbing on
139 individual pathspecs can be done using pathspec magic ":(literal)"
140
141 --noglob-pathspecs
142 Add "literal" magic to all pathspec. This is equivalent to setting
143 the GIT_NOGLOB_PATHSPECS environment variable to 1. Enabling
144 globbing on individual pathspecs can be done using pathspec magic
145 ":(glob)"
146
147 --icase-pathspecs
148 Add "icase" magic to all pathspec. This is equivalent to setting
149 the GIT_ICASE_PATHSPECS environment variable to 1.
150
151 --no-optional-locks
152 Do not perform optional operations that require locks. This is
153 equivalent to setting the GIT_OPTIONAL_LOCKS to 0.
154
155 --list-cmds=group[,group...]
156 List commands by group. This is an internal/experimental option and
157 may change or be removed in the future. Supported groups are:
158 builtins, parseopt (builtin commands that use parse-options), main
159 (all commands in libexec directory), others (all other commands in
160 $PATH that have git- prefix), list-<category> (see categories in
161 command-list.txt), nohelpers (exclude helper commands), alias and
162 config (retrieve command list from config variable
163 completion.commands)
164
166 We divide Git into high level ("porcelain") commands and low level
167 ("plumbing") commands.
168
170 We separate the porcelain commands into the main commands and some
171 ancillary user utilities.
172
173 Main porcelain commands
174 git-add(1)
175 Add file contents to the index.
176
177 git-am(1)
178 Apply a series of patches from a mailbox.
179
180 git-archive(1)
181 Create an archive of files from a named tree.
182
183 git-bisect(1)
184 Use binary search to find the commit that introduced a bug.
185
186 git-branch(1)
187 List, create, or delete branches.
188
189 git-bundle(1)
190 Move objects and refs by archive.
191
192 git-checkout(1)
193 Switch branches or restore working tree files.
194
195 git-cherry-pick(1)
196 Apply the changes introduced by some existing commits.
197
198 git-citool(1)
199 Graphical alternative to git-commit.
200
201 git-clean(1)
202 Remove untracked files from the working tree.
203
204 git-clone(1)
205 Clone a repository into a new directory.
206
207 git-commit(1)
208 Record changes to the repository.
209
210 git-describe(1)
211 Give an object a human readable name based on an available ref.
212
213 git-diff(1)
214 Show changes between commits, commit and working tree, etc.
215
216 git-fetch(1)
217 Download objects and refs from another repository.
218
219 git-format-patch(1)
220 Prepare patches for e-mail submission.
221
222 git-gc(1)
223 Cleanup unnecessary files and optimize the local repository.
224
225 git-grep(1)
226 Print lines matching a pattern.
227
228 git-gui(1)
229 A portable graphical interface to Git.
230
231 git-init(1)
232 Create an empty Git repository or reinitialize an existing one.
233
234 git-log(1)
235 Show commit logs.
236
237 git-merge(1)
238 Join two or more development histories together.
239
240 git-mv(1)
241 Move or rename a file, a directory, or a symlink.
242
243 git-notes(1)
244 Add or inspect object notes.
245
246 git-pull(1)
247 Fetch from and integrate with another repository or a local branch.
248
249 git-push(1)
250 Update remote refs along with associated objects.
251
252 git-range-diff(1)
253 Compare two commit ranges (e.g. two versions of a branch).
254
255 git-rebase(1)
256 Reapply commits on top of another base tip.
257
258 git-reset(1)
259 Reset current HEAD to the specified state.
260
261 git-restore(1)
262 Restore working tree files.
263
264 git-revert(1)
265 Revert some existing commits.
266
267 git-rm(1)
268 Remove files from the working tree and from the index.
269
270 git-shortlog(1)
271 Summarize git log output.
272
273 git-show(1)
274 Show various types of objects.
275
276 git-stash(1)
277 Stash the changes in a dirty working directory away.
278
279 git-status(1)
280 Show the working tree status.
281
282 git-submodule(1)
283 Initialize, update or inspect submodules.
284
285 git-switch(1)
286 Switch branches.
287
288 git-tag(1)
289 Create, list, delete or verify a tag object signed with GPG.
290
291 git-worktree(1)
292 Manage multiple working trees.
293
294 gitk(1)
295 The Git repository browser.
296
297 Ancillary Commands
298 Manipulators:
299
300 git-config(1)
301 Get and set repository or global options.
302
303 git-fast-export(1)
304 Git data exporter.
305
306 git-fast-import(1)
307 Backend for fast Git data importers.
308
309 git-filter-branch(1)
310 Rewrite branches.
311
312 git-mergetool(1)
313 Run merge conflict resolution tools to resolve merge conflicts.
314
315 git-pack-refs(1)
316 Pack heads and tags for efficient repository access.
317
318 git-prune(1)
319 Prune all unreachable objects from the object database.
320
321 git-reflog(1)
322 Manage reflog information.
323
324 git-remote(1)
325 Manage set of tracked repositories.
326
327 git-repack(1)
328 Pack unpacked objects in a repository.
329
330 git-replace(1)
331 Create, list, delete refs to replace objects.
332
333 Interrogators:
334
335 git-annotate(1)
336 Annotate file lines with commit information.
337
338 git-blame(1)
339 Show what revision and author last modified each line of a file.
340
341 git-count-objects(1)
342 Count unpacked number of objects and their disk consumption.
343
344 git-difftool(1)
345 Show changes using common diff tools.
346
347 git-fsck(1)
348 Verifies the connectivity and validity of the objects in the
349 database.
350
351 git-help(1)
352 Display help information about Git.
353
354 git-instaweb(1)
355 Instantly browse your working repository in gitweb.
356
357 git-merge-tree(1)
358 Show three-way merge without touching index.
359
360 git-rerere(1)
361 Reuse recorded resolution of conflicted merges.
362
363 git-show-branch(1)
364 Show branches and their commits.
365
366 git-verify-commit(1)
367 Check the GPG signature of commits.
368
369 git-verify-tag(1)
370 Check the GPG signature of tags.
371
372 git-whatchanged(1)
373 Show logs with difference each commit introduces.
374
375 gitweb(1)
376 Git web interface (web frontend to Git repositories).
377
378 Interacting with Others
379 These commands are to interact with foreign SCM and with other people
380 via patch over e-mail.
381
382 git-cvsexportcommit(1)
383 Export a single commit to a CVS checkout.
384
385 git-cvsimport(1)
386 Salvage your data out of another SCM people love to hate.
387
388 git-cvsserver(1)
389 A CVS server emulator for Git.
390
391 git-imap-send(1)
392 Send a collection of patches from stdin to an IMAP folder.
393
394 git-quiltimport(1)
395 Applies a quilt patchset onto the current branch.
396
397 git-request-pull(1)
398 Generates a summary of pending changes.
399
400 git-send-email(1)
401 Send a collection of patches as emails.
402
403 git-svn(1)
404 Bidirectional operation between a Subversion repository and Git.
405
406 Reset, restore and revert
407 There are three commands with similar names: git reset, git restore and
408 git revert.
409
410 · git-revert(1) is about making a new commit that reverts the changes
411 made by other commits.
412
413 · git-restore(1) is about restoring files in the working tree from
414 either the index or another commit. This command does not update
415 your branch. The command can also be used to restore files in the
416 index from another commit.
417
418 · git-reset(1) is about updating your branch, moving the tip in order
419 to add or remove commits from the branch. This operation changes
420 the commit history.
421
422 git reset can also be used to restore the index, overlapping with
423 git restore.
424
426 Although Git includes its own porcelain layer, its low-level commands
427 are sufficient to support development of alternative porcelains.
428 Developers of such porcelains might start by reading about git-update-
429 index(1) and git-read-tree(1).
430
431 The interface (input, output, set of options and the semantics) to
432 these low-level commands are meant to be a lot more stable than
433 Porcelain level commands, because these commands are primarily for
434 scripted use. The interface to Porcelain commands on the other hand are
435 subject to change in order to improve the end user experience.
436
437 The following description divides the low-level commands into commands
438 that manipulate objects (in the repository, index, and working tree),
439 commands that interrogate and compare objects, and commands that move
440 objects and references between repositories.
441
442 Manipulation commands
443 git-apply(1)
444 Apply a patch to files and/or to the index.
445
446 git-checkout-index(1)
447 Copy files from the index to the working tree.
448
449 git-commit-graph(1)
450 Write and verify Git commit-graph files.
451
452 git-commit-tree(1)
453 Create a new commit object.
454
455 git-hash-object(1)
456 Compute object ID and optionally creates a blob from a file.
457
458 git-index-pack(1)
459 Build pack index file for an existing packed archive.
460
461 git-merge-file(1)
462 Run a three-way file merge.
463
464 git-merge-index(1)
465 Run a merge for files needing merging.
466
467 git-mktag(1)
468 Creates a tag object.
469
470 git-mktree(1)
471 Build a tree-object from ls-tree formatted text.
472
473 git-multi-pack-index(1)
474 Write and verify multi-pack-indexes.
475
476 git-pack-objects(1)
477 Create a packed archive of objects.
478
479 git-prune-packed(1)
480 Remove extra objects that are already in pack files.
481
482 git-read-tree(1)
483 Reads tree information into the index.
484
485 git-symbolic-ref(1)
486 Read, modify and delete symbolic refs.
487
488 git-unpack-objects(1)
489 Unpack objects from a packed archive.
490
491 git-update-index(1)
492 Register file contents in the working tree to the index.
493
494 git-update-ref(1)
495 Update the object name stored in a ref safely.
496
497 git-write-tree(1)
498 Create a tree object from the current index.
499
500 Interrogation commands
501 git-cat-file(1)
502 Provide content or type and size information for repository
503 objects.
504
505 git-cherry(1)
506 Find commits yet to be applied to upstream.
507
508 git-diff-files(1)
509 Compares files in the working tree and the index.
510
511 git-diff-index(1)
512 Compare a tree to the working tree or index.
513
514 git-diff-tree(1)
515 Compares the content and mode of blobs found via two tree objects.
516
517 git-for-each-ref(1)
518 Output information on each ref.
519
520 git-get-tar-commit-id(1)
521 Extract commit ID from an archive created using git-archive.
522
523 git-ls-files(1)
524 Show information about files in the index and the working tree.
525
526 git-ls-remote(1)
527 List references in a remote repository.
528
529 git-ls-tree(1)
530 List the contents of a tree object.
531
532 git-merge-base(1)
533 Find as good common ancestors as possible for a merge.
534
535 git-name-rev(1)
536 Find symbolic names for given revs.
537
538 git-pack-redundant(1)
539 Find redundant pack files.
540
541 git-rev-list(1)
542 Lists commit objects in reverse chronological order.
543
544 git-rev-parse(1)
545 Pick out and massage parameters.
546
547 git-show-index(1)
548 Show packed archive index.
549
550 git-show-ref(1)
551 List references in a local repository.
552
553 git-unpack-file(1)
554 Creates a temporary file with a blob’s contents.
555
556 git-var(1)
557 Show a Git logical variable.
558
559 git-verify-pack(1)
560 Validate packed Git archive files.
561
562 In general, the interrogate commands do not touch the files in the
563 working tree.
564
565 Synching repositories
566 git-daemon(1)
567 A really simple server for Git repositories.
568
569 git-fetch-pack(1)
570 Receive missing objects from another repository.
571
572 git-http-backend(1)
573 Server side implementation of Git over HTTP.
574
575 git-send-pack(1)
576 Push objects over Git protocol to another repository.
577
578 git-update-server-info(1)
579 Update auxiliary info file to help dumb servers.
580
581 The following are helper commands used by the above; end users
582 typically do not use them directly.
583
584 git-http-fetch(1)
585 Download from a remote Git repository via HTTP.
586
587 git-http-push(1)
588 Push objects over HTTP/DAV to another repository.
589
590 git-parse-remote(1)
591 Routines to help parsing remote repository access parameters.
592
593 git-receive-pack(1)
594 Receive what is pushed into the repository.
595
596 git-shell(1)
597 Restricted login shell for Git-only SSH access.
598
599 git-upload-archive(1)
600 Send archive back to git-archive.
601
602 git-upload-pack(1)
603 Send objects packed back to git-fetch-pack.
604
605 Internal helper commands
606 These are internal helper commands used by other commands; end users
607 typically do not use them directly.
608
609 git-check-attr(1)
610 Display gitattributes information.
611
612 git-check-ignore(1)
613 Debug gitignore / exclude files.
614
615 git-check-mailmap(1)
616 Show canonical names and email addresses of contacts.
617
618 git-check-ref-format(1)
619 Ensures that a reference name is well formed.
620
621 git-column(1)
622 Display data in columns.
623
624 git-credential(1)
625 Retrieve and store user credentials.
626
627 git-credential-cache(1)
628 Helper to temporarily store passwords in memory.
629
630 git-credential-store(1)
631 Helper to store credentials on disk.
632
633 git-fmt-merge-msg(1)
634 Produce a merge commit message.
635
636 git-interpret-trailers(1)
637 Add or parse structured information in commit messages.
638
639 git-mailinfo(1)
640 Extracts patch and authorship from a single e-mail message.
641
642 git-mailsplit(1)
643 Simple UNIX mbox splitter program.
644
645 git-merge-one-file(1)
646 The standard helper program to use with git-merge-index.
647
648 git-patch-id(1)
649 Compute unique ID for a patch.
650
651 git-sh-i18n(1)
652 Git’s i18n setup code for shell scripts.
653
654 git-sh-setup(1)
655 Common Git shell script setup code.
656
657 git-stripspace(1)
658 Remove unnecessary whitespace.
659
661 Git uses a simple text format to store customizations that are per
662 repository and are per user. Such a configuration file may look like
663 this:
664
665 #
666 # A '#' or ';' character indicates a comment.
667 #
668
669 ; core variables
670 [core]
671 ; Don't trust file modes
672 filemode = false
673
674 ; user identity
675 [user]
676 name = "Junio C Hamano"
677 email = "gitster@pobox.com"
678
679
680 Various commands read from the configuration file and adjust their
681 operation accordingly. See git-config(1) for a list and more details
682 about the configuration mechanism.
683
685 <object>
686 Indicates the object name for any type of object.
687
688 <blob>
689 Indicates a blob object name.
690
691 <tree>
692 Indicates a tree object name.
693
694 <commit>
695 Indicates a commit object name.
696
697 <tree-ish>
698 Indicates a tree, commit or tag object name. A command that takes a
699 <tree-ish> argument ultimately wants to operate on a <tree> object
700 but automatically dereferences <commit> and <tag> objects that
701 point at a <tree>.
702
703 <commit-ish>
704 Indicates a commit or tag object name. A command that takes a
705 <commit-ish> argument ultimately wants to operate on a <commit>
706 object but automatically dereferences <tag> objects that point at a
707 <commit>.
708
709 <type>
710 Indicates that an object type is required. Currently one of: blob,
711 tree, commit, or tag.
712
713 <file>
714 Indicates a filename - almost always relative to the root of the
715 tree structure GIT_INDEX_FILE describes.
716
718 Any Git command accepting any <object> can also use the following
719 symbolic notation:
720
721 HEAD
722 indicates the head of the current branch.
723
724 <tag>
725 a valid tag name (i.e. a refs/tags/<tag> reference).
726
727 <head>
728 a valid head name (i.e. a refs/heads/<head> reference).
729
730 For a more complete list of ways to spell object names, see "SPECIFYING
731 REVISIONS" section in gitrevisions(7).
732
734 Please see the gitrepository-layout(5) document.
735
736 Read githooks(5) for more details about each hook.
737
738 Higher level SCMs may provide and manage additional information in the
739 $GIT_DIR.
740
742 Please see gitglossary(7).
743
745 Various Git commands use the following environment variables:
746
747 The Git Repository
748 These environment variables apply to all core Git commands. Nb: it is
749 worth noting that they may be used/overridden by SCMS sitting above Git
750 so take care if using a foreign front-end.
751
752 GIT_INDEX_FILE
753 This environment allows the specification of an alternate index
754 file. If not specified, the default of $GIT_DIR/index is used.
755
756 GIT_INDEX_VERSION
757 This environment variable allows the specification of an index
758 version for new repositories. It won’t affect existing index files.
759 By default index file version 2 or 3 is used. See git-update-
760 index(1) for more information.
761
762 GIT_OBJECT_DIRECTORY
763 If the object storage directory is specified via this environment
764 variable then the sha1 directories are created underneath -
765 otherwise the default $GIT_DIR/objects directory is used.
766
767 GIT_ALTERNATE_OBJECT_DIRECTORIES
768 Due to the immutable nature of Git objects, old objects can be
769 archived into shared, read-only directories. This variable
770 specifies a ":" separated (on Windows ";" separated) list of Git
771 object directories which can be used to search for Git objects. New
772 objects will not be written to these directories.
773
774 Entries that begin with " (double-quote) will be interpreted as
775 C-style quoted paths, removing leading and trailing double-quotes
776 and respecting backslash escapes. E.g., the value
777 "path-with-\"-and-:-in-it":vanilla-path has two paths:
778 path-with-"-and-:-in-it and vanilla-path.
779
780 GIT_DIR
781 If the GIT_DIR environment variable is set then it specifies a path
782 to use instead of the default .git for the base of the repository.
783 The --git-dir command-line option also sets this value.
784
785 GIT_WORK_TREE
786 Set the path to the root of the working tree. This can also be
787 controlled by the --work-tree command-line option and the
788 core.worktree configuration variable.
789
790 GIT_NAMESPACE
791 Set the Git namespace; see gitnamespaces(7) for details. The
792 --namespace command-line option also sets this value.
793
794 GIT_CEILING_DIRECTORIES
795 This should be a colon-separated list of absolute paths. If set, it
796 is a list of directories that Git should not chdir up into while
797 looking for a repository directory (useful for excluding
798 slow-loading network directories). It will not exclude the current
799 working directory or a GIT_DIR set on the command line or in the
800 environment. Normally, Git has to read the entries in this list and
801 resolve any symlink that might be present in order to compare them
802 with the current directory. However, if even this access is slow,
803 you can add an empty entry to the list to tell Git that the
804 subsequent entries are not symlinks and needn’t be resolved; e.g.,
805 GIT_CEILING_DIRECTORIES=/maybe/symlink::/very/slow/non/symlink.
806
807 GIT_DISCOVERY_ACROSS_FILESYSTEM
808 When run in a directory that does not have ".git" repository
809 directory, Git tries to find such a directory in the parent
810 directories to find the top of the working tree, but by default it
811 does not cross filesystem boundaries. This environment variable can
812 be set to true to tell Git not to stop at filesystem boundaries.
813 Like GIT_CEILING_DIRECTORIES, this will not affect an explicit
814 repository directory set via GIT_DIR or on the command line.
815
816 GIT_COMMON_DIR
817 If this variable is set to a path, non-worktree files that are
818 normally in $GIT_DIR will be taken from this path instead.
819 Worktree-specific files such as HEAD or index are taken from
820 $GIT_DIR. See gitrepository-layout(5) and git-worktree(1) for
821 details. This variable has lower precedence than other path
822 variables such as GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY...
823
824 Git Commits
825 GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_AUTHOR_DATE, GIT_COMMITTER_NAME,
826 GIT_COMMITTER_EMAIL, GIT_COMMITTER_DATE, EMAIL
827 see git-commit-tree(1)
828
829 Git Diffs
830 GIT_DIFF_OPTS
831 Only valid setting is "--unified=??" or "-u??" to set the number of
832 context lines shown when a unified diff is created. This takes
833 precedence over any "-U" or "--unified" option value passed on the
834 Git diff command line.
835
836 GIT_EXTERNAL_DIFF
837 When the environment variable GIT_EXTERNAL_DIFF is set, the program
838 named by it is called, instead of the diff invocation described
839 above. For a path that is added, removed, or modified,
840 GIT_EXTERNAL_DIFF is called with 7 parameters:
841
842 path old-file old-hex old-mode new-file new-hex new-mode
843
844 where:
845
846 <old|new>-file
847 are files GIT_EXTERNAL_DIFF can use to read the contents of
848 <old|new>,
849
850 <old|new>-hex
851 are the 40-hexdigit SHA-1 hashes,
852
853 <old|new>-mode
854 are the octal representation of the file modes.
855
856 The file parameters can point at the user’s working file (e.g.
857 new-file in "git-diff-files"), /dev/null (e.g. old-file when a new
858 file is added), or a temporary file (e.g. old-file in the index).
859 GIT_EXTERNAL_DIFF should not worry about unlinking the temporary
860 file --- it is removed when GIT_EXTERNAL_DIFF exits.
861
862 For a path that is unmerged, GIT_EXTERNAL_DIFF is called with 1
863 parameter, <path>.
864
865 For each path GIT_EXTERNAL_DIFF is called, two environment
866 variables, GIT_DIFF_PATH_COUNTER and GIT_DIFF_PATH_TOTAL are set.
867
868 GIT_DIFF_PATH_COUNTER
869 A 1-based counter incremented by one for every path.
870
871 GIT_DIFF_PATH_TOTAL
872 The total number of paths.
873
874 other
875 GIT_MERGE_VERBOSITY
876 A number controlling the amount of output shown by the recursive
877 merge strategy. Overrides merge.verbosity. See git-merge(1)
878
879 GIT_PAGER
880 This environment variable overrides $PAGER. If it is set to an
881 empty string or to the value "cat", Git will not launch a pager.
882 See also the core.pager option in git-config(1).
883
884 GIT_EDITOR
885 This environment variable overrides $EDITOR and $VISUAL. It is used
886 by several Git commands when, on interactive mode, an editor is to
887 be launched. See also git-var(1) and the core.editor option in git-
888 config(1).
889
890 GIT_SSH, GIT_SSH_COMMAND
891 If either of these environment variables is set then git fetch and
892 git push will use the specified command instead of ssh when they
893 need to connect to a remote system. The command-line parameters
894 passed to the configured command are determined by the ssh variant.
895 See ssh.variant option in git-config(1) for details.
896
897 $GIT_SSH_COMMAND takes precedence over $GIT_SSH, and is interpreted
898 by the shell, which allows additional arguments to be included.
899 $GIT_SSH on the other hand must be just the path to a program
900 (which can be a wrapper shell script, if additional arguments are
901 needed).
902
903 Usually it is easier to configure any desired options through your
904 personal .ssh/config file. Please consult your ssh documentation
905 for further details.
906
907 GIT_SSH_VARIANT
908 If this environment variable is set, it overrides Git’s
909 autodetection whether GIT_SSH/GIT_SSH_COMMAND/core.sshCommand refer
910 to OpenSSH, plink or tortoiseplink. This variable overrides the
911 config setting ssh.variant that serves the same purpose.
912
913 GIT_ASKPASS
914 If this environment variable is set, then Git commands which need
915 to acquire passwords or passphrases (e.g. for HTTP or IMAP
916 authentication) will call this program with a suitable prompt as
917 command-line argument and read the password from its STDOUT. See
918 also the core.askPass option in git-config(1).
919
920 GIT_TERMINAL_PROMPT
921 If this environment variable is set to 0, git will not prompt on
922 the terminal (e.g., when asking for HTTP authentication).
923
924 GIT_CONFIG_NOSYSTEM
925 Whether to skip reading settings from the system-wide
926 $(prefix)/etc/gitconfig file. This environment variable can be used
927 along with $HOME and $XDG_CONFIG_HOME to create a predictable
928 environment for a picky script, or you can set it temporarily to
929 avoid using a buggy /etc/gitconfig file while waiting for someone
930 with sufficient permissions to fix it.
931
932 GIT_FLUSH
933 If this environment variable is set to "1", then commands such as
934 git blame (in incremental mode), git rev-list, git log, git
935 check-attr and git check-ignore will force a flush of the output
936 stream after each record have been flushed. If this variable is set
937 to "0", the output of these commands will be done using completely
938 buffered I/O. If this environment variable is not set, Git will
939 choose buffered or record-oriented flushing based on whether stdout
940 appears to be redirected to a file or not.
941
942 GIT_TRACE
943 Enables general trace messages, e.g. alias expansion, built-in
944 command execution and external command execution.
945
946 If this variable is set to "1", "2" or "true" (comparison is case
947 insensitive), trace messages will be printed to stderr.
948
949 If the variable is set to an integer value greater than 2 and lower
950 than 10 (strictly) then Git will interpret this value as an open
951 file descriptor and will try to write the trace messages into this
952 file descriptor.
953
954 Alternatively, if the variable is set to an absolute path (starting
955 with a / character), Git will interpret this as a file path and
956 will try to append the trace messages to it.
957
958 Unsetting the variable, or setting it to empty, "0" or "false"
959 (case insensitive) disables trace messages.
960
961 GIT_TRACE_FSMONITOR
962 Enables trace messages for the filesystem monitor extension. See
963 GIT_TRACE for available trace output options.
964
965 GIT_TRACE_PACK_ACCESS
966 Enables trace messages for all accesses to any packs. For each
967 access, the pack file name and an offset in the pack is recorded.
968 This may be helpful for troubleshooting some pack-related
969 performance problems. See GIT_TRACE for available trace output
970 options.
971
972 GIT_TRACE_PACKET
973 Enables trace messages for all packets coming in or out of a given
974 program. This can help with debugging object negotiation or other
975 protocol issues. Tracing is turned off at a packet starting with
976 "PACK" (but see GIT_TRACE_PACKFILE below). See GIT_TRACE for
977 available trace output options.
978
979 GIT_TRACE_PACKFILE
980 Enables tracing of packfiles sent or received by a given program.
981 Unlike other trace output, this trace is verbatim: no headers, and
982 no quoting of binary data. You almost certainly want to direct into
983 a file (e.g., GIT_TRACE_PACKFILE=/tmp/my.pack) rather than
984 displaying it on the terminal or mixing it with other trace output.
985
986 Note that this is currently only implemented for the client side of
987 clones and fetches.
988
989 GIT_TRACE_PERFORMANCE
990 Enables performance related trace messages, e.g. total execution
991 time of each Git command. See GIT_TRACE for available trace output
992 options.
993
994 GIT_TRACE_SETUP
995 Enables trace messages printing the .git, working tree and current
996 working directory after Git has completed its setup phase. See
997 GIT_TRACE for available trace output options.
998
999 GIT_TRACE_SHALLOW
1000 Enables trace messages that can help debugging fetching / cloning
1001 of shallow repositories. See GIT_TRACE for available trace output
1002 options.
1003
1004 GIT_TRACE_CURL
1005 Enables a curl full trace dump of all incoming and outgoing data,
1006 including descriptive information, of the git transport protocol.
1007 This is similar to doing curl --trace-ascii on the command line.
1008 This option overrides setting the GIT_CURL_VERBOSE environment
1009 variable. See GIT_TRACE for available trace output options.
1010
1011 GIT_TRACE_CURL_NO_DATA
1012 When a curl trace is enabled (see GIT_TRACE_CURL above), do not
1013 dump data (that is, only dump info lines and headers).
1014
1015 GIT_TRACE2
1016 Enables more detailed trace messages from the "trace2" library.
1017 Output from GIT_TRACE2 is a simple text-based format for human
1018 readability.
1019
1020 If this variable is set to "1", "2" or "true" (comparison is case
1021 insensitive), trace messages will be printed to stderr.
1022
1023 If the variable is set to an integer value greater than 2 and lower
1024 than 10 (strictly) then Git will interpret this value as an open
1025 file descriptor and will try to write the trace messages into this
1026 file descriptor.
1027
1028 Alternatively, if the variable is set to an absolute path (starting
1029 with a / character), Git will interpret this as a file path and
1030 will try to append the trace messages to it. If the path already
1031 exists and is a directory, the trace messages will be written to
1032 files (one per process) in that directory, named according to the
1033 last component of the SID and an optional counter (to avoid
1034 filename collisions).
1035
1036 In addition, if the variable is set to
1037 af_unix:[<socket_type>:]<absolute-pathname>, Git will try to open
1038 the path as a Unix Domain Socket. The socket type can be either
1039 stream or dgram.
1040
1041 Unsetting the variable, or setting it to empty, "0" or "false"
1042 (case insensitive) disables trace messages.
1043
1044 See Trace2 documentation[2] for full details.
1045
1046 GIT_TRACE2_EVENT
1047 This setting writes a JSON-based format that is suited for machine
1048 interpretation. See GIT_TRACE2 for available trace output options
1049 and Trace2 documentation[2] for full details.
1050
1051 GIT_TRACE2_PERF
1052 In addition to the text-based messages available in GIT_TRACE2,
1053 this setting writes a column-based format for understanding nesting
1054 regions. See GIT_TRACE2 for available trace output options and
1055 Trace2 documentation[2] for full details.
1056
1057 GIT_REDACT_COOKIES
1058 This can be set to a comma-separated list of strings. When a curl
1059 trace is enabled (see GIT_TRACE_CURL above), whenever a "Cookies:"
1060 header sent by the client is dumped, values of cookies whose key is
1061 in that list (case-sensitive) are redacted.
1062
1063 GIT_LITERAL_PATHSPECS
1064 Setting this variable to 1 will cause Git to treat all pathspecs
1065 literally, rather than as glob patterns. For example, running
1066 GIT_LITERAL_PATHSPECS=1 git log -- '*.c' will search for commits
1067 that touch the path *.c, not any paths that the glob *.c matches.
1068 You might want this if you are feeding literal paths to Git (e.g.,
1069 paths previously given to you by git ls-tree, --raw diff output,
1070 etc).
1071
1072 GIT_GLOB_PATHSPECS
1073 Setting this variable to 1 will cause Git to treat all pathspecs as
1074 glob patterns (aka "glob" magic).
1075
1076 GIT_NOGLOB_PATHSPECS
1077 Setting this variable to 1 will cause Git to treat all pathspecs as
1078 literal (aka "literal" magic).
1079
1080 GIT_ICASE_PATHSPECS
1081 Setting this variable to 1 will cause Git to treat all pathspecs as
1082 case-insensitive.
1083
1084 GIT_REFLOG_ACTION
1085 When a ref is updated, reflog entries are created to keep track of
1086 the reason why the ref was updated (which is typically the name of
1087 the high-level command that updated the ref), in addition to the
1088 old and new values of the ref. A scripted Porcelain command can use
1089 set_reflog_action helper function in git-sh-setup to set its name
1090 to this variable when it is invoked as the top level command by the
1091 end user, to be recorded in the body of the reflog.
1092
1093 GIT_REF_PARANOIA
1094 If set to 1, include broken or badly named refs when iterating over
1095 lists of refs. In a normal, non-corrupted repository, this does
1096 nothing. However, enabling it may help git to detect and abort some
1097 operations in the presence of broken refs. Git sets this variable
1098 automatically when performing destructive operations like git-
1099 prune(1). You should not need to set it yourself unless you want to
1100 be paranoid about making sure an operation has touched every ref
1101 (e.g., because you are cloning a repository to make a backup).
1102
1103 GIT_ALLOW_PROTOCOL
1104 If set to a colon-separated list of protocols, behave as if
1105 protocol.allow is set to never, and each of the listed protocols
1106 has protocol.<name>.allow set to always (overriding any existing
1107 configuration). In other words, any protocol not mentioned will be
1108 disallowed (i.e., this is a whitelist, not a blacklist). See the
1109 description of protocol.allow in git-config(1) for more details.
1110
1111 GIT_PROTOCOL_FROM_USER
1112 Set to 0 to prevent protocols used by fetch/push/clone which are
1113 configured to the user state. This is useful to restrict recursive
1114 submodule initialization from an untrusted repository or for
1115 programs which feed potentially-untrusted URLS to git commands. See
1116 git-config(1) for more details.
1117
1118 GIT_PROTOCOL
1119 For internal use only. Used in handshaking the wire protocol.
1120 Contains a colon : separated list of keys with optional values
1121 key[=value]. Presence of unknown keys and values must be ignored.
1122
1123 GIT_OPTIONAL_LOCKS
1124 If set to 0, Git will complete any requested operation without
1125 performing any optional sub-operations that require taking a lock.
1126 For example, this will prevent git status from refreshing the index
1127 as a side effect. This is useful for processes running in the
1128 background which do not want to cause lock contention with other
1129 operations on the repository. Defaults to 1.
1130
1131 GIT_REDIRECT_STDIN, GIT_REDIRECT_STDOUT, GIT_REDIRECT_STDERR
1132 Windows-only: allow redirecting the standard input/output/error
1133 handles to paths specified by the environment variables. This is
1134 particularly useful in multi-threaded applications where the
1135 canonical way to pass standard handles via CreateProcess() is not
1136 an option because it would require the handles to be marked
1137 inheritable (and consequently every spawned process would inherit
1138 them, possibly blocking regular Git operations). The primary
1139 intended use case is to use named pipes for communication (e.g.
1140 \\.\pipe\my-git-stdin-123).
1141
1142 Two special values are supported: off will simply close the
1143 corresponding standard handle, and if GIT_REDIRECT_STDERR is 2>&1,
1144 standard error will be redirected to the same handle as standard
1145 output.
1146
1147 GIT_PRINT_SHA1_ELLIPSIS (deprecated)
1148 If set to yes, print an ellipsis following an (abbreviated) SHA-1
1149 value. This affects indications of detached HEADs (git-checkout(1))
1150 and the raw diff output (git-diff(1)). Printing an ellipsis in the
1151 cases mentioned is no longer considered adequate and support for it
1152 is likely to be removed in the foreseeable future (along with the
1153 variable).
1154
1156 More detail on the following is available from the Git concepts chapter
1157 of the user-manual[3] and gitcore-tutorial(7).
1158
1159 A Git project normally consists of a working directory with a ".git"
1160 subdirectory at the top level. The .git directory contains, among other
1161 things, a compressed object database representing the complete history
1162 of the project, an "index" file which links that history to the current
1163 contents of the working tree, and named pointers into that history such
1164 as tags and branch heads.
1165
1166 The object database contains objects of three main types: blobs, which
1167 hold file data; trees, which point to blobs and other trees to build up
1168 directory hierarchies; and commits, which each reference a single tree
1169 and some number of parent commits.
1170
1171 The commit, equivalent to what other systems call a "changeset" or
1172 "version", represents a step in the project’s history, and each parent
1173 represents an immediately preceding step. Commits with more than one
1174 parent represent merges of independent lines of development.
1175
1176 All objects are named by the SHA-1 hash of their contents, normally
1177 written as a string of 40 hex digits. Such names are globally unique.
1178 The entire history leading up to a commit can be vouched for by signing
1179 just that commit. A fourth object type, the tag, is provided for this
1180 purpose.
1181
1182 When first created, objects are stored in individual files, but for
1183 efficiency may later be compressed together into "pack files".
1184
1185 Named pointers called refs mark interesting points in history. A ref
1186 may contain the SHA-1 name of an object or the name of another ref.
1187 Refs with names beginning ref/head/ contain the SHA-1 name of the most
1188 recent commit (or "head") of a branch under development. SHA-1 names of
1189 tags of interest are stored under ref/tags/. A special ref named HEAD
1190 contains the name of the currently checked-out branch.
1191
1192 The index file is initialized with a list of all paths and, for each
1193 path, a blob object and a set of attributes. The blob object represents
1194 the contents of the file as of the head of the current branch. The
1195 attributes (last modified time, size, etc.) are taken from the
1196 corresponding file in the working tree. Subsequent changes to the
1197 working tree can be found by comparing these attributes. The index may
1198 be updated with new content, and new commits may be created from the
1199 content stored in the index.
1200
1201 The index is also capable of storing multiple entries (called "stages")
1202 for a given pathname. These stages are used to hold the various
1203 unmerged version of a file when a merge is in progress.
1204
1206 See the references in the "description" section to get started using
1207 Git. The following is probably more detail than necessary for a
1208 first-time user.
1209
1210 The Git concepts chapter of the user-manual[3] and gitcore-tutorial(7)
1211 both provide introductions to the underlying Git architecture.
1212
1213 See gitworkflows(7) for an overview of recommended workflows.
1214
1215 See also the howto[4] documents for some useful examples.
1216
1217 The internals are documented in the Git API documentation[5].
1218
1219 Users migrating from CVS may also want to read gitcvs-migration(7).
1220
1222 Git was started by Linus Torvalds, and is currently maintained by Junio
1223 C Hamano. Numerous contributions have come from the Git mailing list
1224 <git@vger.kernel.org[6]>.
1225 http://www.openhub.net/p/git/contributors/summary gives you a more
1226 complete list of contributors.
1227
1228 If you have a clone of git.git itself, the output of git-shortlog(1)
1229 and git-blame(1) can show you the authors for specific parts of the
1230 project.
1231
1233 Report bugs to the Git mailing list <git@vger.kernel.org[6]> where the
1234 development and maintenance is primarily done. You do not have to be
1235 subscribed to the list to send a message there. See the list archive at
1236 https://public-inbox.org/git for previous bug reports and other
1237 discussions.
1238
1239 Issues which are security relevant should be disclosed privately to the
1240 Git Security mailing list <git-security@googlegroups.com[7]>.
1241
1243 gittutorial(7), gittutorial-2(7), giteveryday(7), gitcvs-migration(7),
1244 gitglossary(7), gitcore-tutorial(7), gitcli(7), The Git User’s
1245 Manual[1], gitworkflows(7)
1246
1248 Part of the git(1) suite
1249
1251 1. Git User’s Manual
1252 file:///usr/share/doc/git/user-manual.html
1253
1254 2. Trace2 documentation
1255 file:///usr/share/doc/git/technical/api-trace2.html
1256
1257 3. Git concepts chapter of the user-manual
1258 file:///usr/share/doc/git/user-manual.html#git-concepts
1259
1260 4. howto
1261 file:///usr/share/doc/git/howto-index.html
1262
1263 5. Git API documentation
1264 file:///usr/share/doc/git/technical/api-index.html
1265
1266 6. git@vger.kernel.org
1267 mailto:git@vger.kernel.org
1268
1269 7. git-security@googlegroups.com
1270 mailto:git-security@googlegroups.com
1271
1272
1273
1274Git 2.24.1 12/10/2019 GIT(1)