1GITREPOSITORY-LAYOU(5)            Git Manual            GITREPOSITORY-LAYOU(5)
2
3
4

NAME

6       gitrepository-layout - Git Repository Layout
7

SYNOPSIS

9       $GIT_DIR/*
10

DESCRIPTION

12       A Git repository comes in two different flavours:
13
14       ·   a .git directory at the root of the working tree;
15
16       ·   a <project>.git directory that is a bare repository (i.e. without
17           its own working tree), that is typically used for exchanging
18           histories with others by pushing into it and fetching from it.
19
20       Note: Also you can have a plain text file .git at the root of your
21       working tree, containing gitdir: <path> to point at the real directory
22       that has the repository. This mechanism is often used for a working
23       tree of a submodule checkout, to allow you in the containing
24       superproject to git checkout a branch that does not have the submodule.
25       The checkout has to remove the entire submodule working tree, without
26       losing the submodule repository.
27
28       These things may exist in a Git repository.
29
30       objects
31           Object store associated with this repository. Usually an object
32           store is self sufficient (i.e. all the objects that are referred to
33           by an object found in it are also found in it), but there are a few
34           ways to violate it.
35
36            1. You could have an incomplete but locally usable repository by
37               creating a shallow clone. See git-clone(1).
38
39            2. You could be using the objects/info/alternates or
40               $GIT_ALTERNATE_OBJECT_DIRECTORIES mechanisms to borrow objects
41               from other object stores. A repository with this kind of
42               incomplete object store is not suitable to be published for use
43               with dumb transports but otherwise is OK as long as
44               objects/info/alternates points at the object stores it borrows
45               from.
46
47               This directory is ignored if $GIT_COMMON_DIR is set and
48               "$GIT_COMMON_DIR/objects" will be used instead.
49
50       objects/[0-9a-f][0-9a-f]
51           A newly created object is stored in its own file. The objects are
52           splayed over 256 subdirectories using the first two characters of
53           the sha1 object name to keep the number of directory entries in
54           objects itself to a manageable number. Objects found here are often
55           called unpacked (or loose) objects.
56
57       objects/pack
58           Packs (files that store many object in compressed form, along with
59           index files to allow them to be randomly accessed) are found in
60           this directory.
61
62       objects/info
63           Additional information about the object store is recorded in this
64           directory.
65
66       objects/info/packs
67           This file is to help dumb transports discover what packs are
68           available in this object store. Whenever a pack is added or
69           removed, git update-server-info should be run to keep this file up
70           to date if the repository is published for dumb transports.  git
71           repack does this by default.
72
73       objects/info/alternates
74           This file records paths to alternate object stores that this object
75           store borrows objects from, one pathname per line. Note that not
76           only native Git tools use it locally, but the HTTP fetcher also
77           tries to use it remotely; this will usually work if you have
78           relative paths (relative to the object database, not to the
79           repository!) in your alternates file, but it will not work if you
80           use absolute paths unless the absolute path in filesystem and web
81           URL is the same. See also objects/info/http-alternates.
82
83       objects/info/http-alternates
84           This file records URLs to alternate object stores that this object
85           store borrows objects from, to be used when the repository is
86           fetched over HTTP.
87
88       refs
89           References are stored in subdirectories of this directory. The git
90           prune command knows to preserve objects reachable from refs found
91           in this directory and its subdirectories. This directory is ignored
92           if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/refs" will be used
93           instead.
94
95       refs/heads/name
96           records tip-of-the-tree commit objects of branch name
97
98       refs/tags/name
99           records any object name (not necessarily a commit object, or a tag
100           object that points at a commit object).
101
102       refs/remotes/name
103           records tip-of-the-tree commit objects of branches copied from a
104           remote repository.
105
106       refs/replace/<obj-sha1>
107           records the SHA-1 of the object that replaces <obj-sha1>. This is
108           similar to info/grafts and is internally used and maintained by
109           git-replace(1). Such refs can be exchanged between repositories
110           while grafts are not.
111
112       packed-refs
113           records the same information as refs/heads/, refs/tags/, and
114           friends record in a more efficient way. See git-pack-refs(1). This
115           file is ignored if $GIT_COMMON_DIR is set and
116           "$GIT_COMMON_DIR/packed-refs" will be used instead.
117
118       HEAD
119           A symref (see glossary) to the refs/heads/ namespace describing the
120           currently active branch. It does not mean much if the repository is
121           not associated with any working tree (i.e. a bare repository), but
122           a valid Git repository must have the HEAD file; some porcelains may
123           use it to guess the designated "default" branch of the repository
124           (usually master). It is legal if the named branch name does not
125           (yet) exist. In some legacy setups, it is a symbolic link instead
126           of a symref that points at the current branch.
127
128           HEAD can also record a specific commit directly, instead of being a
129           symref to point at the current branch. Such a state is often called
130           detached HEAD.  See git-checkout(1) for details.
131
132       config
133           Repository specific configuration file. This file is ignored if
134           $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/config" will be used
135           instead.
136
137       branches
138           A slightly deprecated way to store shorthands to be used to specify
139           a URL to git fetch, git pull and git push. A file can be stored as
140           branches/<name> and then name can be given to these commands in
141           place of repository argument. See the REMOTES section in git-
142           fetch(1) for details. This mechanism is legacy and not likely to be
143           found in modern repositories. This directory is ignored if
144           $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/branches" will be used
145           instead.
146
147       hooks
148           Hooks are customization scripts used by various Git commands. A
149           handful of sample hooks are installed when git init is run, but all
150           of them are disabled by default. To enable, the .sample suffix has
151           to be removed from the filename by renaming. Read githooks(5) for
152           more details about each hook. This directory is ignored if
153           $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/hooks" will be used
154           instead.
155
156       index
157           The current index file for the repository. It is usually not found
158           in a bare repository.
159
160       sharedindex.<SHA-1>
161           The shared index part, to be referenced by $GIT_DIR/index and other
162           temporary index files. Only valid in split index mode.
163
164       info
165           Additional information about the repository is recorded in this
166           directory. This directory is ignored if $GIT_COMMON_DIR is set and
167           "$GIT_COMMON_DIR/info" will be used instead.
168
169       info/refs
170           This file helps dumb transports discover what refs are available in
171           this repository. If the repository is published for dumb
172           transports, this file should be regenerated by git
173           update-server-info every time a tag or branch is created or
174           modified. This is normally done from the hooks/update hook, which
175           is run by the git-receive-pack command when you git push into the
176           repository.
177
178       info/grafts
179           This file records fake commit ancestry information, to pretend the
180           set of parents a commit has is different from how the commit was
181           actually created. One record per line describes a commit and its
182           fake parents by listing their 40-byte hexadecimal object names
183           separated by a space and terminated by a newline.
184
185           Note that the grafts mechanism is outdated and can lead to problems
186           transferring objects between repositories; see git-replace(1) for a
187           more flexible and robust system to do the same thing.
188
189       info/exclude
190           This file, by convention among Porcelains, stores the exclude
191           pattern list.  .gitignore is the per-directory ignore file.  git
192           status, git add, git rm and git clean look at it but the core Git
193           commands do not look at it. See also: gitignore(5).
194
195       info/attributes
196           Defines which attributes to assign to a path, similar to
197           per-directory .gitattributes files. See also: gitattributes(5).
198
199       info/sparse-checkout
200           This file stores sparse checkout patterns. See also: git-read-
201           tree(1).
202
203       remotes
204           Stores shorthands for URL and default refnames for use when
205           interacting with remote repositories via git fetch, git pull and
206           git push commands. See the REMOTES section in git-fetch(1) for
207           details. This mechanism is legacy and not likely to be found in
208           modern repositories. This directory is ignored if $GIT_COMMON_DIR
209           is set and "$GIT_COMMON_DIR/remotes" will be used instead.
210
211       logs
212           Records of changes made to refs are stored in this directory. See
213           git-update-ref(1) for more information. This directory is ignored
214           if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/logs" will be used
215           instead.
216
217       logs/refs/heads/name
218           Records all changes made to the branch tip named name.
219
220       logs/refs/tags/name
221           Records all changes made to the tag named name.
222
223       shallow
224           This is similar to info/grafts but is internally used and
225           maintained by shallow clone mechanism. See --depth option to git-
226           clone(1) and git-fetch(1). This file is ignored if $GIT_COMMON_DIR
227           is set and "$GIT_COMMON_DIR/shallow" will be used instead.
228
229       commondir
230           If this file exists, $GIT_COMMON_DIR (see git(1)) will be set to
231           the path specified in this file if it is not explicitly set. If the
232           specified path is relative, it is relative to $GIT_DIR. The
233           repository with commondir is incomplete without the repository
234           pointed by "commondir".
235
236       modules
237           Contains the git-repositories of the submodules.
238
239       worktrees
240           Contains administrative data for linked working trees. Each
241           subdirectory contains the working tree-related part of a linked
242           working tree. This directory is ignored if $GIT_COMMON_DIR is set,
243           in which case "$GIT_COMMON_DIR/worktrees" will be used instead.
244
245       worktrees/<id>/gitdir
246           A text file containing the absolute path back to the .git file that
247           points to here. This is used to check if the linked repository has
248           been manually removed and there is no need to keep this directory
249           any more. The mtime of this file should be updated every time the
250           linked repository is accessed.
251
252       worktrees/<id>/locked
253           If this file exists, the linked working tree may be on a portable
254           device and not available. The presence of this file prevents
255           worktrees/<id> from being pruned either automatically or manually
256           by git worktree prune. The file may contain a string explaining why
257           the repository is locked.
258

SEE ALSO

260       git-init(1), git-clone(1), git-fetch(1), git-pack-refs(1), git-gc(1),
261       git-checkout(1), gitglossary(7), The Git User’s Manual[1]
262

GIT

264       Part of the git(1) suite
265

NOTES

267        1. The Git User’s Manual
268           file:///usr/share/doc/git/user-manual.html
269
270
271
272Git 2.18.1                        05/14/2019            GITREPOSITORY-LAYOU(5)
Impressum