1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
\r
4 <sect2 lang="en" id="gitrepository-layout(5)">
\r
5 <title>gitrepository-layout(5)</title>
\r
7 <primary>gitrepository-layout(5)</primary>
\r
9 <simplesect id="gitrepository-layout(5)__name">
\r
11 <simpara>gitrepository-layout - Git Repository Layout</simpara>
\r
13 <simplesect id="gitrepository-layout(5)__synopsis">
\r
14 <title>SYNOPSIS</title>
\r
15 <simpara>$GIT_DIR/*</simpara>
\r
17 <simplesect id="gitrepository-layout(5)__description">
\r
18 <title>DESCRIPTION</title>
\r
19 <simpara>A Git repository comes in two different flavours:</simpara>
\r
23 a <emphasis>.git</emphasis> directory at the root of the working tree;
\r
28 a <emphasis><project>.git</emphasis> directory that is a <emphasis>bare</emphasis> repository
\r
29 (i.e. without its own working tree), that is typically used for
\r
30 exchanging histories with others by pushing into it and fetching
\r
35 <simpara><emphasis role="strong">Note</emphasis>: Also you can have a plain text file <emphasis>.git</emphasis> at the root of
\r
36 your working tree, containing <emphasis>gitdir: <path></emphasis> to point at the real
\r
37 directory that has the repository. This mechanism is often used for
\r
38 a working tree of a submodule checkout, to allow you in the
\r
39 containing superproject to <emphasis>git checkout</emphasis> a branch that does not
\r
40 have the submodule. The <emphasis>checkout</emphasis> has to remove the entire
\r
41 submodule working tree, without losing the submodule repository.</simpara>
\r
42 <simpara>These things may exist in a Git repository.</simpara>
\r
50 Object store associated with this repository. Usually
\r
51 an object store is self sufficient (i.e. all the objects
\r
52 that are referred to by an object found in it are also
\r
53 found in it), but there are a few ways to violate it.
\r
55 <orderedlist numeration="arabic">
\r
58 You could have an incomplete but locally usable repository
\r
59 by creating a shallow clone. See <xref linkend="git-clone(1)" />.
\r
64 You could be using the <emphasis>objects/info/alternates</emphasis> or
\r
65 <emphasis>$GIT_ALTERNATE_OBJECT_DIRECTORIES</emphasis> mechanisms to <emphasis>borrow</emphasis>
\r
66 objects from other object stores. A repository with this kind
\r
67 of incomplete object store is not suitable to be published for
\r
68 use with dumb transports but otherwise is OK as long as
\r
69 <emphasis>objects/info/alternates</emphasis> points at the object stores it
\r
72 <simpara>This directory is ignored if $GIT_COMMON_DIR is set and
\r
73 "$GIT_COMMON_DIR/objects" will be used instead.</simpara>
\r
80 objects/[0-9a-f][0-9a-f]
\r
84 A newly created object is stored in its own file.
\r
85 The objects are splayed over 256 subdirectories using
\r
86 the first two characters of the sha1 object name to
\r
87 keep the number of directory entries in <emphasis>objects</emphasis>
\r
88 itself to a manageable number. Objects found
\r
89 here are often called <emphasis>unpacked</emphasis> (or <emphasis>loose</emphasis>) objects.
\r
99 Packs (files that store many object in compressed form,
\r
100 along with index files to allow them to be randomly
\r
101 accessed) are found in this directory.
\r
111 Additional information about the object store is
\r
112 recorded in this directory.
\r
122 This file is to help dumb transports discover what packs
\r
123 are available in this object store. Whenever a pack is
\r
124 added or removed, <emphasis>git update-server-info</emphasis> should be run
\r
125 to keep this file up-to-date if the repository is
\r
126 published for dumb transports. <emphasis>git repack</emphasis> does this
\r
133 objects/info/alternates
\r
137 This file records paths to alternate object stores that
\r
138 this object store borrows objects from, one pathname per
\r
139 line. Note that not only native Git tools use it locally,
\r
140 but the HTTP fetcher also tries to use it remotely; this
\r
141 will usually work if you have relative paths (relative
\r
142 to the object database, not to the repository!) in your
\r
143 alternates file, but it will not work if you use absolute
\r
144 paths unless the absolute path in filesystem and web URL
\r
145 is the same. See also <emphasis>objects/info/http-alternates</emphasis>.
\r
151 objects/info/http-alternates
\r
155 This file records URLs to alternate object stores that
\r
156 this object store borrows objects from, to be used when
\r
157 the repository is fetched over HTTP.
\r
167 References are stored in subdirectories of this
\r
168 directory. The <emphasis>git prune</emphasis> command knows to preserve
\r
169 objects reachable from refs found in this directory and
\r
170 its subdirectories. This directory is ignored if $GIT_COMMON_DIR
\r
171 is set and "$GIT_COMMON_DIR/refs" will be used instead.
\r
177 refs/heads/<emphasis>name</emphasis>
\r
181 records tip-of-the-tree commit objects of branch <emphasis>name</emphasis>
\r
187 refs/tags/<emphasis>name</emphasis>
\r
191 records any object name (not necessarily a commit
\r
192 object, or a tag object that points at a commit object).
\r
198 refs/remotes/<emphasis>name</emphasis>
\r
202 records tip-of-the-tree commit objects of branches copied
\r
203 from a remote repository.
\r
209 refs/replace/<emphasis><obj-sha1></emphasis>
\r
213 records the SHA-1 of the object that replaces <emphasis><obj-sha1></emphasis>.
\r
214 This is similar to info/grafts and is internally used and
\r
215 maintained by <xref linkend="git-replace(1)" />. Such refs can be exchanged
\r
216 between repositories while grafts are not.
\r
226 records the same information as refs/heads/, refs/tags/,
\r
227 and friends record in a more efficient way. See
\r
228 <xref linkend="git-pack-refs(1)" />. This file is ignored if $GIT_COMMON_DIR
\r
229 is set and "$GIT_COMMON_DIR/packed-refs" will be used instead.
\r
239 A symref (see glossary) to the <emphasis>refs/heads/</emphasis> namespace
\r
240 describing the currently active branch. It does not mean
\r
241 much if the repository is not associated with any working tree
\r
242 (i.e. a <emphasis>bare</emphasis> repository), but a valid Git repository
\r
243 <emphasis role="strong">must</emphasis> have the HEAD file; some porcelains may use it to
\r
244 guess the designated "default" branch of the repository
\r
245 (usually <emphasis>master</emphasis>). It is legal if the named branch
\r
246 <emphasis>name</emphasis> does not (yet) exist. In some legacy setups, it is
\r
247 a symbolic link instead of a symref that points at the current
\r
250 <simpara>HEAD can also record a specific commit directly, instead of
\r
251 being a symref to point at the current branch. Such a state
\r
252 is often called <emphasis>detached HEAD.</emphasis> See <xref linkend="git-checkout(1)" />
\r
253 for details.</simpara>
\r
262 Repository specific configuration file. This file is ignored
\r
263 if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/config" will be
\r
274 A slightly deprecated way to store shorthands to be used
\r
275 to specify a URL to <emphasis>git fetch</emphasis>, <emphasis>git pull</emphasis> and <emphasis>git push</emphasis>.
\r
276 A file can be stored as <emphasis>branches/<name></emphasis> and then
\r
277 <emphasis>name</emphasis> can be given to these commands in place of
\r
278 <emphasis>repository</emphasis> argument. See the REMOTES section in
\r
279 <xref linkend="git-fetch(1)" /> for details. This mechanism is legacy
\r
280 and not likely to be found in modern repositories. This
\r
281 directory is ignored if $GIT_COMMON_DIR is set and
\r
282 "$GIT_COMMON_DIR/branches" will be used instead.
\r
292 Hooks are customization scripts used by various Git
\r
293 commands. A handful of sample hooks are installed when
\r
294 <emphasis>git init</emphasis> is run, but all of them are disabled by
\r
295 default. To enable, the <emphasis>.sample</emphasis> suffix has to be
\r
296 removed from the filename by renaming.
\r
297 Read <xref linkend="githooks(5)" /> for more details about
\r
298 each hook. This directory is ignored if $GIT_COMMON_DIR is set
\r
299 and "$GIT_COMMON_DIR/hooks" will be used instead.
\r
309 The current index file for the repository. It is
\r
310 usually not found in a bare repository.
\r
316 sharedindex.<SHA-1>
\r
320 The shared index part, to be referenced by $GIT_DIR/index and
\r
321 other temporary index files. Only valid in split index mode.
\r
331 Additional information about the repository is recorded
\r
332 in this directory. This directory is ignored if $GIT_COMMON_DIR
\r
333 is set and "$GIT_COMMON_DIR/index" will be used instead.
\r
343 This file helps dumb transports discover what refs are
\r
344 available in this repository. If the repository is
\r
345 published for dumb transports, this file should be
\r
346 regenerated by <emphasis>git update-server-info</emphasis> every time a tag
\r
347 or branch is created or modified. This is normally done
\r
348 from the <emphasis>hooks/update</emphasis> hook, which is run by the
\r
349 <emphasis>git-receive-pack</emphasis> command when you <emphasis>git push</emphasis> into the
\r
360 This file records fake commit ancestry information, to
\r
361 pretend the set of parents a commit has is different
\r
362 from how the commit was actually created. One record
\r
363 per line describes a commit and its fake parents by
\r
364 listing their 40-byte hexadecimal object names separated
\r
365 by a space and terminated by a newline.
\r
367 <simpara>Note that the grafts mechanism is outdated and can lead to problems
\r
368 transferring objects between repositories; see <xref linkend="git-replace(1)" />
\r
369 for a more flexible and robust system to do the same thing.</simpara>
\r
378 This file, by convention among Porcelains, stores the
\r
379 exclude pattern list. <emphasis>.gitignore</emphasis> is the per-directory
\r
380 ignore file. <emphasis>git status</emphasis>, <emphasis>git add</emphasis>, <emphasis>git rm</emphasis> and
\r
381 <emphasis>git clean</emphasis> look at it but the core Git commands do not look
\r
382 at it. See also: <xref linkend="gitignore(5)" />.
\r
388 info/sparse-checkout
\r
392 This file stores sparse checkout patterns.
\r
393 See also: <xref linkend="git-read-tree(1)" />.
\r
403 Stores shorthands for URL and default refnames for use
\r
404 when interacting with remote repositories via <emphasis>git fetch</emphasis>,
\r
405 <emphasis>git pull</emphasis> and <emphasis>git push</emphasis> commands. See the REMOTES section
\r
406 in <xref linkend="git-fetch(1)" /> for details. This mechanism is legacy
\r
407 and not likely to be found in modern repositories. This
\r
408 directory is ignored if $GIT_COMMON_DIR is set and
\r
409 "$GIT_COMMON_DIR/remotes" will be used instead.
\r
419 Records of changes made to refs are stored in this directory.
\r
420 See <xref linkend="git-update-ref(1)" /> for more information. This
\r
421 directory is ignored if $GIT_COMMON_DIR is set and
\r
422 "$GIT_COMMON_DIR/logs" will be used instead.
\r
428 logs/refs/heads/<emphasis>name</emphasis>
\r
432 Records all changes made to the branch tip named <emphasis>name</emphasis>.
\r
438 logs/refs/tags/<emphasis>name</emphasis>
\r
442 Records all changes made to the tag named <emphasis>name</emphasis>.
\r
452 This is similar to <emphasis>info/grafts</emphasis> but is internally used
\r
453 and maintained by shallow clone mechanism. See <emphasis>--depth</emphasis>
\r
454 option to <xref linkend="git-clone(1)" /> and <xref linkend="git-fetch(1)" />. This
\r
455 file is ignored if $GIT_COMMON_DIR is set and
\r
456 "$GIT_COMMON_DIR/shallow" will be used instead.
\r
466 If this file exists, $GIT_COMMON_DIR (see <xref linkend="git(1)" />) will
\r
467 be set to the path specified in this file if it is not
\r
468 explicitly set. If the specified path is relative, it is
\r
469 relative to $GIT_DIR. The repository with commondir is
\r
470 incomplete without the repository pointed by "commondir".
\r
480 Contains the git-repositories of the submodules.
\r
490 Contains administrative data for linked
\r
491 working trees. Each subdirectory contains the working tree-related
\r
492 part of a linked working tree. This directory is ignored if
\r
493 $GIT_COMMON_DIR is set, in which case
\r
494 "$GIT_COMMON_DIR/worktrees" will be used instead.
\r
500 worktrees/<id>/gitdir
\r
504 A text file containing the absolute path back to the .git file
\r
505 that points to here. This is used to check if the linked
\r
506 repository has been manually removed and there is no need to
\r
507 keep this directory any more. The mtime of this file should be
\r
508 updated every time the linked repository is accessed.
\r
514 worktrees/<id>/locked
\r
518 If this file exists, the linked working tree may be on a
\r
519 portable device and not available. The presence of this file
\r
520 prevents <emphasis>worktrees/<id></emphasis> from being pruned either automatically
\r
521 or manually by <emphasis>git worktree prune</emphasis>. The file may contain a string
\r
522 explaining why the repository is locked.
\r
528 worktrees/<id>/link
\r
532 If this file exists, it is a hard link to the linked .git
\r
533 file. It is used to detect if the linked repository is
\r
540 <simplesect id="gitrepository-layout(5)__see_also">
\r
541 <title>SEE ALSO</title>
\r
542 <simpara><xref linkend="git-init(1)" />,
\r
543 <xref linkend="git-clone(1)" />,
\r
544 <xref linkend="git-fetch(1)" />,
\r
545 <xref linkend="git-pack-refs(1)" />,
\r
546 <xref linkend="git-gc(1)" />,
\r
547 <xref linkend="git-checkout(1)" />,
\r
548 <xref linkend="gitglossary(7)" />,
\r
549 link:user-manual.html[The Git User's Manual]</simpara>
\r
551 <simplesect id="gitrepository-layout(5)__git">
\r
553 <simpara>Part of the <xref linkend="git(1)" /> suite.</simpara>
\r