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