1GIT(7) Git Manual GIT(7)
2
3
4
6 git - the stupid content tracker
7
9 git [--version] [--exec-path[=GIT_EXEC_PATH]]
10 [-p|--paginate|--no-pager]
11 [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
12 [--help] COMMAND [ARGS]
13
15 Git is a fast, scalable, distributed revision control system with an
16 unusually rich command set that provides both high-level operations and
17 full access to internals.
18
19 See this tutorial[1] to get started, then see Everyday Git[2] for a
20 useful minimum set of commands, and "man git-commandname" for
21 documentation of each command. CVS users may also want to read CVS
22 migration[3]. See Git User´s Manual[4] for a more in-depth
23 introduction.
24
25 The COMMAND is either a name of a Git command (see below) or an alias
26 as defined in the configuration file (see git-config(1)).
27
28 Formatted and hyperlinked version of the latest git documentation can
29 be viewed at http://www.kernel.org/pub/software/scm/git/docs/.
30
32 --version
33 Prints the git suite version that the git program came from.
34
35 --help
36 Prints the synopsis and a list of the most commonly used commands.
37 If a git command is named this option will bring up the man-page
38 for that command. If the option --all or -a is given then all
39 available commands are printed.
40
41 --exec-path
42 Path to wherever your core git programs are installed. This can
43 also be controlled by setting the GIT_EXEC_PATH environment
44 variable. If no path is given git will print the current setting
45 and then exit.
46
47 -p|--paginate
48 Pipe all output into less (or if set, $PAGER).
49
50 --no-pager
51 Do not pipe git output into a pager.
52
53 --git-dir=<path>
54 Set the path to the repository. This can also be controlled by
55 setting the GIT_DIR environment variable.
56
57 --work-tree=<path>
58 Set the path to the working tree. The value will not be used in
59 combination with repositories found automatically in a .git
60 directory (i.e. $GIT_DIR is not set). This can also be controlled
61 by setting the GIT_WORK_TREE environment variable and the
62 core.worktree configuration variable.
63
64 --bare
65 Treat the repository as a bare repository. If GIT_DIR environment
66 is not set, it is set to the current working directory.
67
69 See the references above to get started using git. The following is
70 probably more detail than necessary for a first-time user.
71
72 The git concepts chapter of the user-manual[5] and the Core tutorial[6]
73 both provide introductions to the underlying git architecture.
74
75 See also the howto[7] documents for some useful examples.
76
78 We divide git into high level ("porcelain") commands and low level
79 ("plumbing") commands.
80
82 We separate the porcelain commands into the main commands and some
83 ancillary user utilities.
84
85 Main porcelain commands
86 git-add(1)
87 Add file contents to the index.
88
89 git-am(1)
90 Apply a series of patches from a mailbox.
91
92 git-archive(1)
93 Create an archive of files from a named tree.
94
95 git-bisect(1)
96 Find the change that introduced a bug by binary search.
97
98 git-branch(1)
99 List, create, or delete branches.
100
101 git-bundle(1)
102 Move objects and refs by archive.
103
104 git-checkout(1)
105 Checkout and switch to a branch.
106
107 git-cherry-pick(1)
108 Apply the change introduced by an existing commit.
109
110 git-citool(1)
111 Graphical alternative to git-commit.
112
113 git-clean(1)
114 Remove untracked files from the working tree.
115
116 git-clone(1)
117 Clone a repository into a new directory.
118
119 git-commit(1)
120 Record changes to the repository.
121
122 git-describe(1)
123 Show the most recent tag that is reachable from a commit.
124
125 git-diff(1)
126 Show changes between commits, commit and working tree, etc.
127
128 git-fetch(1)
129 Download objects and refs from another repository.
130
131 git-format-patch(1)
132 Prepare patches for e-mail submission.
133
134 git-gc(1)
135 Cleanup unnecessary files and optimize the local repository.
136
137 git-grep(1)
138 Print lines matching a pattern.
139
140 git-gui(1)
141 A portable graphical interface to Git.
142
143 git-init(1)
144 Create an empty git repository or reinitialize an existing one.
145
146 gitk(1)
147 The git repository browser.
148
149 git-log(1)
150 Show commit logs.
151
152 git-merge(1)
153 Join two or more development histories together.
154
155 git-mv(1)
156 Move or rename a file, a directory, or a symlink.
157
158 git-pull(1)
159 Fetch from and merge with another repository or a local branch.
160
161 git-push(1)
162 Update remote refs along with associated objects.
163
164 git-rebase(1)
165 Forward-port local commits to the updated upstream head.
166
167 git-reset(1)
168 Reset current HEAD to the specified state.
169
170 git-revert(1)
171 Revert an existing commit.
172
173 git-rm(1)
174 Remove files from the working tree and from the index.
175
176 git-shortlog(1)
177 Summarize git log output.
178
179 git-show(1)
180 Show various types of objects.
181
182 git-stash(1)
183 Stash the changes in a dirty working directory away.
184
185 git-status(1)
186 Show the working tree status.
187
188 git-submodule(1)
189 Initialize, update or inspect submodules.
190
191 git-tag(1)
192 Create, list, delete or verify a tag object signed with GPG.
193
194 Ancillary Commands
195 Manipulators:
196
197 git-config(1)
198 Get and set repository or global options.
199
200 git-convert-objects(1)
201 Converts old-style git repository.
202
203 git-fast-import(1)
204 Backend for fast Git data importers.
205
206 git-filter-branch(1)
207 Rewrite branches.
208
209 git-lost-found(1)
210 Recover lost refs that luckily have not yet been pruned.
211
212 git-mergetool(1)
213 Run merge conflict resolution tools to resolve merge conflicts.
214
215 git-pack-refs(1)
216 Pack heads and tags for efficient repository access.
217
218 git-prune(1)
219 Prune all unreachable objects from the object database.
220
221 git-reflog(1)
222 Manage reflog information.
223
224 git-relink(1)
225 Hardlink common objects in local repositories.
226
227 git-remote(1)
228 manage set of tracked repositories.
229
230 git-repack(1)
231 Pack unpacked objects in a repository.
232 Interrogators:
233
234 git-annotate(1)
235 Annotate file lines with commit info.
236
237 git-blame(1)
238 Show what revision and author last modified each line of a file.
239
240 git-cherry(1)
241 Find commits not merged upstream.
242
243 git-count-objects(1)
244 Count unpacked number of objects and their disk consumption.
245
246 git-fsck(1)
247 Verifies the connectivity and validity of the objects in the
248 database.
249
250 git-get-tar-commit-id(1)
251 Extract commit ID from an archive created using git-tar-tree.
252
253 git-instaweb(1)
254 Instantly browse your working repository in gitweb.
255
256 git-merge-tree(1)
257 Show three-way merge without touching index.
258
259 git-rerere(1)
260 Reuse recorded resolution of conflicted merges.
261
262 git-rev-parse(1)
263 Pick out and massage parameters.
264
265 git-runstatus(1)
266 A helper for git-status and git-commit.
267
268 git-show-branch(1)
269 Show branches and their commits.
270
271 git-verify-tag(1)
272 Check the GPG signature of tags.
273
274 git-whatchanged(1)
275 Show logs with difference each commit introduces.
276
277 Interacting with Others
278 These commands are to interact with foreign SCM and with other people
279 via patch over e-mail.
280
281 git-archimport(1)
282 Import an Arch repository into git.
283
284 git-cvsexportcommit(1)
285 Export a single commit to a CVS checkout.
286
287 git-cvsimport(1)
288 Salvage your data out of another SCM people love to hate.
289
290 git-cvsserver(1)
291 A CVS server emulator for git.
292
293 git-imap-send(1)
294 Dump a mailbox from stdin into an imap folder.
295
296 git-quiltimport(1)
297 Applies a quilt patchset onto the current branch.
298
299 git-request-pull(1)
300 Generates a summary of pending changes.
301
302 git-send-email(1)
303 Send a collection of patches as emails.
304
305 git-svn(1)
306 Bidirectional operation between a single Subversion branch and git.
307
308 git-svnimport(1)
309 Import a SVN repository into git.
310
312 Although git includes its own porcelain layer, its low-level commands
313 are sufficient to support development of alternative porcelains.
314 Developers of such porcelains might start by reading about git-update-
315 index(1) and git-read-tree(1).
316
317 The interface (input, output, set of options and the semantics) to
318 these low-level commands are meant to be a lot more stable than
319 Porcelain level commands, because these commands are primarily for
320 scripted use. The interface to Porcelain commands on the other hand are
321 subject to change in order to improve the end user experience.
322
323 The following description divides the low-level commands into commands
324 that manipulate objects (in the repository, index, and working tree),
325 commands that interrogate and compare objects, and commands that move
326 objects and references between repositories.
327
328 Manipulation commands
329 git-apply(1)
330 Apply a patch on a git index file and a working tree.
331
332 git-checkout-index(1)
333 Copy files from the index to the working tree.
334
335 git-commit-tree(1)
336 Create a new commit object.
337
338 git-hash-object(1)
339 Compute object ID and optionally creates a blob from a file.
340
341 git-index-pack(1)
342 Build pack index file for an existing packed archive.
343
344 git-merge-file(1)
345 Run a three-way file merge.
346
347 git-merge-index(1)
348 Run a merge for files needing merging.
349
350 git-mktag(1)
351 Creates a tag object.
352
353 git-mktree(1)
354 Build a tree-object from ls-tree formatted text.
355
356 git-pack-objects(1)
357 Create a packed archive of objects.
358
359 git-prune-packed(1)
360 Remove extra objects that are already in pack files.
361
362 git-read-tree(1)
363 Reads tree information into the index.
364
365 git-symbolic-ref(1)
366 Read and modify symbolic refs.
367
368 git-unpack-objects(1)
369 Unpack objects from a packed archive.
370
371 git-update-index(1)
372 Register file contents in the working tree to the index.
373
374 git-update-ref(1)
375 Update the object name stored in a ref safely.
376
377 git-write-tree(1)
378 Create a tree object from the current index.
379
380 Interrogation commands
381 git-cat-file(1)
382 Provide content or type/size information for repository objects.
383
384 git-diff-files(1)
385 Compares files in the working tree and the index.
386
387 git-diff-index(1)
388 Compares content and mode of blobs between the index and
389 repository.
390
391 git-diff-tree(1)
392 Compares the content and mode of blobs found via two tree objects.
393
394 git-for-each-ref(1)
395 Output information on each ref.
396
397 git-ls-files(1)
398 Show information about files in the index and the working tree.
399
400 git-ls-remote(1)
401 List references in a remote repository.
402
403 git-ls-tree(1)
404 List the contents of a tree object.
405
406 git-merge-base(1)
407 Find as good common ancestors as possible for a merge.
408
409 git-name-rev(1)
410 Find symbolic names for given revs.
411
412 git-pack-redundant(1)
413 Find redundant pack files.
414
415 git-rev-list(1)
416 Lists commit objects in reverse chronological order.
417
418 git-show-index(1)
419 Show packed archive index.
420
421 git-show-ref(1)
422 List references in a local repository.
423
424 git-tar-tree(1)
425 Create a tar archive of the files in the named tree object.
426
427 git-unpack-file(1)
428 Creates a temporary file with a blob´s contents.
429
430 git-var(1)
431 Show a git logical variable.
432
433 git-verify-pack(1)
434 Validate packed git archive files.
435 In general, the interrogate commands do not touch the files in the
436 working tree.
437
438 Synching repositories
439 git-daemon(1)
440 A really simple server for git repositories.
441
442 git-fetch-pack(1)
443 Receive missing objects from another repository.
444
445 git-local-fetch(1)
446 Duplicate another git repository on a local system.
447
448 git-send-pack(1)
449 Push objects over git protocol to another repository.
450
451 git-ssh-fetch(1)
452 Fetch from a remote repository over ssh connection.
453
454 git-ssh-upload(1)
455 Push to a remote repository over ssh connection.
456
457 git-update-server-info(1)
458 Update auxiliary info file to help dumb servers.
459 The following are helper programs used by the above; end users
460 typically do not use them directly.
461
462 git-http-fetch(1)
463 Download from a remote git repository via HTTP.
464
465 git-http-push(1)
466 Push objects over HTTP/DAV to another repository.
467
468 git-parse-remote(1)
469 Routines to help parsing remote repository access parameters.
470
471 git-receive-pack(1)
472 Receive what is pushed into the repository.
473
474 git-shell(1)
475 Restricted login shell for GIT-only SSH access.
476
477 git-upload-archive(1)
478 Send archive back to git-archive.
479
480 git-upload-pack(1)
481 Send objects packed back to git-fetch-pack.
482
483 Internal helper commands
484 These are internal helper commands used by other commands; end users
485 typically do not use them directly.
486
487 git-check-attr(1)
488 Display gitattributes information..
489
490 git-check-ref-format(1)
491 Make sure ref name is well formed.
492
493 git-fmt-merge-msg(1)
494 Produce a merge commit message.
495
496 git-mailinfo(1)
497 Extracts patch and authorship from a single e-mail message.
498
499 git-mailsplit(1)
500 Simple UNIX mbox splitter program.
501
502 git-merge-one-file(1)
503 The standard helper program to use with git-merge-index.
504
505 git-patch-id(1)
506 Compute unique ID for a patch.
507
508 git-peek-remote(1)
509 List the references in a remote repository.
510
511 git-sh-setup(1)
512 Common git shell script setup code.
513
514 git-stripspace(1)
515 Filter out empty lines.
516
518 Starting from 0.99.9 (actually mid 0.99.8.GIT), .git/config file is
519 used to hold per-repository configuration options. It is a simple text
520 file modeled after .ini format familiar to some people. Here is an
521 example:
522
523
524
525 #
526 # A ´#´ or ´;´ character indicates a comment.
527 #
528
529 ; core variables
530 [core]
531 ; Don´t trust file modes
532 filemode = false
533
534 ; user identity
535 [user]
536 name = "Junio C Hamano"
537 email = "junkio@twinsun.com"
538
539
540 Various commands read from the configuration file and adjust their
541 operation accordingly.
542
544 <object>
545 Indicates the object name for any type of object.
546
547 <blob>
548 Indicates a blob object name.
549
550 <tree>
551 Indicates a tree object name.
552
553 <commit>
554 Indicates a commit object name.
555
556 <tree-ish>
557 Indicates a tree, commit or tag object name. A command that takes a
558 <tree-ish> argument ultimately wants to operate on a <tree> object
559 but automatically dereferences <commit> and <tag> objects that
560 point at a <tree>.
561
562 <commit-ish>
563 Indicates a commit or tag object name. A command that takes a
564 <commit-ish> argument ultimately wants to operate on a <commit>
565 object but automatically dereferences <tag> objects that point at a
566 <commit>.
567
568 <type>
569 Indicates that an object type is required. Currently one of: blob,
570 tree, commit, or tag.
571
572 <file>
573 Indicates a filename - almost always relative to the root of the
574 tree structure GIT_INDEX_FILE describes.
575
577 Any git command accepting any <object> can also use the following
578 symbolic notation:
579
580 HEAD
581 indicates the head of the current branch (i.e. the contents of
582 $GIT_DIR/HEAD).
583
584 <tag>
585 a valid tag name (i.e. the contents of $GIT_DIR/refs/tags/<tag>).
586
587 <head>
588 a valid head name (i.e. the contents of
589 $GIT_DIR/refs/heads/<head>).
590 For a more complete list of ways to spell object names, see "SPECIFYING
591 REVISIONS" section in git-rev-parse(1).
592
594 Please see repository layout[8] document.
595
596 Read hooks[9] for more details about each hook.
597
598 Higher level SCMs may provide and manage additional information in the
599 $GIT_DIR.
600
602 Please see glossary[10] document.
603
605 Various git commands use the following environment variables:
606
607 The git Repository
608 These environment variables apply to all core git commands. Nb: it is
609 worth noting that they may be used/overridden by SCMS sitting above git
610 so take care if using Cogito etc.
611
612 GIT_INDEX_FILE
613 This environment allows the specification of an alternate index
614 file. If not specified, the default of $GIT_DIR/index is used.
615
616 GIT_OBJECT_DIRECTORY
617 If the object storage directory is specified via this environment
618 variable then the sha1 directories are created underneath -
619 otherwise the default $GIT_DIR/objects directory is used.
620
621 GIT_ALTERNATE_OBJECT_DIRECTORIES
622 Due to the immutable nature of git objects, old objects can be
623 archived into shared, read-only directories. This variable
624 specifies a ":" separated list of git object directories which can
625 be used to search for git objects. New objects will not be written
626 to these directories.
627
628 GIT_DIR
629 If the GIT_DIR environment variable is set then it specifies a path
630 to use instead of the default .git for the base of the repository.
631
632 GIT_WORK_TREE
633 Set the path to the working tree. The value will not be used in
634 combination with repositories found automatically in a .git
635 directory (i.e. $GIT_DIR is not set). This can also be controlled
636 by the --work-tree command line option and the core.worktree
637 configuration variable.
638
639 git Commits
640 GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_AUTHOR_DATE, GIT_COMMITTER_NAME,
641 GIT_COMMITTER_EMAIL, GIT_COMMITTER_DATE, EMAIL
642 see git-commit-tree(1)
643
644 git Diffs
645 GIT_DIFF_OPTS
646 Only valid setting is "--unified=??" or "-u??" to set the number of
647 context lines shown when a unified diff is created. This takes
648 precedence over any "-U" or "--unified" option value passed on the
649 git diff command line.
650
651 GIT_EXTERNAL_DIFF
652 When the environment variable GIT_EXTERNAL_DIFF is set, the program
653 named by it is called, instead of the diff invocation described
654 above. For a path that is added, removed, or modified,
655 GIT_EXTERNAL_DIFF is called with 7 parameters:
656
657
658 path old-file old-hex old-mode new-file new-hex new-mode
659 where:
660
661
662
663 <old|new>-file are files
664 GIT_EXTERNAL_DIFF can use
665 to read the contents of
666 <old|new>,
667 <old|new>-hex are the 40-hexdigit SHA1
668 hashes,
669 <old|new>-mode are the octal
670 representation of the file
671 modes.
672
673 The file parameters can point at the user´s working file (e.g.
674 new-file in "git-diff-files"), /dev/null (e.g. old-file when a new
675 file is added), or a temporary file (e.g. old-file in the index).
676 GIT_EXTERNAL_DIFF should not worry about unlinking the temporary
677 file --- it is removed when GIT_EXTERNAL_DIFF exits.
678
679 For a path that is unmerged, GIT_EXTERNAL_DIFF is called with 1
680 parameter, <path>.
681
682 other
683 GIT_MERGE_VERBOSITY
684 A number controlling the amount of output shown by the recursive
685 merge strategy. Overrides merge.verbosity. See git-merge(1)
686
687 GIT_PAGER
688 This environment variable overrides $PAGER. If it is set to an
689 empty string or to the value "cat", git will not launch a pager.
690
691 GIT_SSH
692 If this environment variable is set then git-fetch(1) and git-
693 push(1) will use this command instead of ssh when they need to
694 connect to a remote system. The GIT_SSH command will be given
695 exactly two arguments: the username@host (or just host) from the
696 URL and the shell command to execute on that remote system.
697
698 To pass options to the program that you want to list in GIT_SSH you
699 will need to wrap the program and options into a shell script, then
700 set GIT_SSH to refer to the shell script.
701
702 Usually it is easier to configure any desired options through your
703 personal .ssh/config file. Please consult your ssh documentation
704 for further details.
705
706 GIT_FLUSH
707 If this environment variable is set to "1", then commands such as
708 git-blame (in incremental mode), git-rev-list, git-log,
709 git-whatchanged, etc., will force a flush of the output stream
710 after each commit-oriented record have been flushed. If this
711 variable is set to "0", the output of these commands will be done
712 using completely buffered I/O. If this environment variable is not
713 set, git will choose buffered or record-oriented flushing based on
714 whether stdout appears to be redirected to a file or not.
715
716 GIT_TRACE
717 If this variable is set to "1", "2" or "true" (comparison is case
718 insensitive), git will print trace: messages on stderr telling
719 about alias expansion, built-in command execution and external
720 command execution. If this variable is set to an integer value
721 greater than 1 and lower than 10 (strictly) then git will interpret
722 this value as an open file descriptor and will try to write the
723 trace messages into this file descriptor. Alternatively, if this
724 variable is set to an absolute path (starting with a / character),
725 git will interpret this as a file path and will try to write the
726 trace messages into it.
727
729 More detail on the following is available from the git concepts chapter
730 of the user-manual[5] and the Core tutorial[6].
731
732 A git project normally consists of a working directory with a ".git"
733 subdirectory at the top level. The .git directory contains, among other
734 things, a compressed object database representing the complete history
735 of the project, an "index" file which links that history to the current
736 contents of the working tree, and named pointers into that history such
737 as tags and branch heads.
738
739 The object database contains objects of three main types: blobs, which
740 hold file data; trees, which point to blobs and other trees to build up
741 directory heirarchies; and commits, which each reference a single tree
742 and some number of parent commits.
743
744 The commit, equivalent to what other systems call a "changeset" or
745 "version", represents a step in the project´s history, and each parent
746 represents an immediately preceding step. Commits with more than one
747 parent represent merges of independent lines of development.
748
749 All objects are named by the SHA1 hash of their contents, normally
750 written as a string of 40 hex digits. Such names are globally unique.
751 The entire history leading up to a commit can be vouched for by signing
752 just that commit. A fourth object type, the tag, is provided for this
753 purpose.
754
755 When first created, objects are stored in individual files, but for
756 efficiency may later be compressed together into "pack files".
757
758 Named pointers called refs mark interesting points in history. A ref
759 may contain the SHA1 name of an object or the name of another ref. Refs
760 with names beginning ref/head/ contain the SHA1 name of the most recent
761 commit (or "head") of a branch under developement. SHA1 names of tags
762 of interest are stored under ref/tags/. A special ref named HEAD
763 contains the name of the currently checked-out branch.
764
765 The index file is initialized with a list of all paths and, for each
766 path, a blob object and a set of attributes. The blob object represents
767 the contents of the file as of the head of the current branch. The
768 attributes (last modified time, size, etc.) are taken from the
769 corresponding file in the working tree. Subsequent changes to the
770 working tree can be found by comparing these attributes. The index may
771 be updated with new content, and new commits may be created from the
772 content stored in the index.
773
774 The index is also capable of storing multiple entries (called "stages")
775 for a given pathname. These stages are used to hold the various
776 unmerged version of a file when a merge is in progress.
777
779 · git´s founding father is Linus Torvalds <torvalds@osdl.org>.
780
781 · The current git nurse is Junio C Hamano <gitster@pobox.com>.
782
783 · The git potty was written by Andres Ericsson <ae@op5.se>.
784
785 · General upbringing is handled by the git-list
786 <git@vger.kernel.org>.
787
789 The documentation for git suite was started by David Greaves
790 <david@dgreaves.com>, and later enhanced greatly by the contributors on
791 the git-list <git@vger.kernel.org>.
792
794 Part of the git(7) suite
795
797 1. tutorial
798 tutorial.html
799
800 2. Everyday Git
801 everyday.html
802
803 3. CVS migration
804 cvs-migration.html
805
806 4. Git User's Manual
807 user-manual.html
808
809 5. git concepts chapter of the user-manual
810 user-manual.html#git-concepts
811
812 6. Core tutorial
813 core-tutorial.html
814
815 7. howto
816 howto-index.html
817
818 8. repository layout
819 repository-layout.html
820
821 9. hooks
822 hooks.html
823
824 10. glossary
825 glossary.html
826
827
828
829Git 1.5.3.3 10/09/2007 GIT(7)