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