blob: 79653f313474fa658f072c97d8744e5afccb77d7 [file] [log] [blame]
Junio C Hamanof7c042d2008-06-06 22:50:531gitrepository-layout(5)
2=======================
3
4NAME
5----
6gitrepository-layout - Git Repository Layout
7
8SYNOPSIS
9--------
10$GIT_DIR/*
11
12DESCRIPTION
13-----------
Junio C Hamano1a4e8412005-12-27 08:17:2314
Junio C Hamano076ffcc2013-02-06 05:13:2115A Git repository comes in two different flavours:
16
17 * a `.git` directory at the root of the working tree;
18
19 * a `<project>.git` directory that is a 'bare' repository
20 (i.e. without its own working tree), that is typically used for
21 exchanging histories with others by pushing into it and fetching
22 from it.
23
24*Note*: Also you can have a plain text file `.git` at the root of
25your working tree, containing `gitdir: <path>` to point at the real
26directory that has the repository. This mechanism is often used for
27a working tree of a submodule checkout, to allow you in the
28containing superproject to `git checkout` a branch that does not
29have the submodule. The `checkout` has to remove the entire
30submodule working tree, without losing the submodule repository.
31
32These things may exist in a Git repository.
Junio C Hamano1a4e8412005-12-27 08:17:2333
34objects::
35Object store associated with this repository. Usually
36an object store is self sufficient (i.e. all the objects
37that are referred to by an object found in it are also
Junio C Hamano6e41cb32011-08-29 07:12:4938found in it), but there are a few ways to violate it.
Junio C Hamano1a4e8412005-12-27 08:17:2339+
Junio C Hamano6e41cb32011-08-29 07:12:4940. You could have an incomplete but locally usable repository
41by creating a shallow clone. See linkgit:git-clone[1].
42. You could be using the `objects/info/alternates` or
43`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanisms to 'borrow'
Junio C Hamano1a4e8412005-12-27 08:17:2344objects from other object stores. A repository with this kind
Junio C Hamano235a91e2006-01-07 01:13:5845of incomplete object store is not suitable to be published for
Junio C Hamano1a4e8412005-12-27 08:17:2346use with dumb transports but otherwise is OK as long as
Junio C Hamano6e41cb32011-08-29 07:12:4947`objects/info/alternates` points at the object stores it
48borrows from.
Junio C Hamano1a4e8412005-12-27 08:17:2349
50objects/[0-9a-f][0-9a-f]::
Junio C Hamano6e41cb32011-08-29 07:12:4951A newly created object is stored in its own file.
52The objects are splayed over 256 subdirectories using
53the first two characters of the sha1 object name to
54keep the number of directory entries in `objects`
55itself to a manageable number. Objects found
56here are often called 'unpacked' (or 'loose') objects.
Junio C Hamano1a4e8412005-12-27 08:17:2357
58objects/pack::
59Packs (files that store many object in compressed form,
60along with index files to allow them to be randomly
61accessed) are found in this directory.
62
63objects/info::
64Additional information about the object store is
65recorded in this directory.
66
67objects/info/packs::
68This file is to help dumb transports discover what packs
69are available in this object store. Whenever a pack is
70added or removed, `git update-server-info` should be run
71to keep this file up-to-date if the repository is
Junio C Hamano1aa40d22010-01-21 17:46:4372published for dumb transports. 'git repack' does this
Junio C Hamano1a4e8412005-12-27 08:17:2373by default.
74
75objects/info/alternates::
Junio C Hamano93ba9d32006-11-20 03:17:4376This file records paths to alternate object stores that
77this object store borrows objects from, one pathname per
78line. Note that not only native Git tools use it locally,
79but the HTTP fetcher also tries to use it remotely; this
80will usually work if you have relative paths (relative
81to the object database, not to the repository!) in your
82alternates file, but it will not work if you use absolute
83paths unless the absolute path in filesystem and web URL
84is the same. See also 'objects/info/http-alternates'.
85
86objects/info/http-alternates::
87This file records URLs to alternate object stores that
88this object store borrows objects from, to be used when
89the repository is fetched over HTTP.
Junio C Hamano1a4e8412005-12-27 08:17:2390
91refs::
92References are stored in subdirectories of this
Junio C Hamano6e41cb32011-08-29 07:12:4993directory. The 'git prune' command knows to preserve
Junio C Hamano1a4e8412005-12-27 08:17:2394objects reachable from refs found in this directory and
95its subdirectories.
96
97refs/heads/`name`::
98records tip-of-the-tree commit objects of branch `name`
99
100refs/tags/`name`::
101records any object name (not necessarily a commit
102object, or a tag object that points at a commit object).
103
Junio C Hamano4f9a6052007-01-17 20:25:16104refs/remotes/`name`::
105records tip-of-the-tree commit objects of branches copied
106from a remote repository.
107
Junio C Hamanoa1295452012-11-13 22:32:04108refs/replace/`<obj-sha1>`::
Junio C Hamanoe3f080d2013-04-22 02:27:13109records the SHA-1 of the object that replaces `<obj-sha1>`.
Junio C Hamanoa1295452012-11-13 22:32:04110This is similar to info/grafts and is internally used and
111maintained by linkgit:git-replace[1]. Such refs can be exchanged
112between repositories while grafts are not.
113
Junio C Hamano4f9a6052007-01-17 20:25:16114packed-refs::
115records the same information as refs/heads/, refs/tags/,
116and friends record in a more efficient way. See
Junio C Hamano35738e82008-01-07 07:55:46117linkgit:git-pack-refs[1].
Junio C Hamano4f9a6052007-01-17 20:25:16118
Junio C Hamano1a4e8412005-12-27 08:17:23119HEAD::
Junio C Hamano3a971022006-11-18 22:17:58120A symref (see glossary) to the `refs/heads/` namespace
121describing the currently active branch. It does not mean
122much if the repository is not associated with any working tree
Junio C Hamano076ffcc2013-02-06 05:13:21123(i.e. a 'bare' repository), but a valid Git repository
Junio C Hamano3a971022006-11-18 22:17:58124*must* have the HEAD file; some porcelains may use it to
125guess the designated "default" branch of the repository
126(usually 'master'). It is legal if the named branch
127'name' does not (yet) exist. In some legacy setups, it is
128a symbolic link instead of a symref that points at the current
129branch.
Junio C Hamano4f9a6052007-01-17 20:25:16130+
131HEAD can also record a specific commit directly, instead of
132being a symref to point at the current branch. Such a state
Junio C Hamano6e41cb32011-08-29 07:12:49133is often called 'detached HEAD.' See linkgit:git-checkout[1]
134for details.
Junio C Hamano1a4e8412005-12-27 08:17:23135
136branches::
137A slightly deprecated way to store shorthands to be used
Junio C Hamano6e41cb32011-08-29 07:12:49138to specify a URL to 'git fetch', 'git pull' and 'git push'.
139A file can be stored as `branches/<name>` and then
140'name' can be given to these commands in place of
141'repository' argument. See the REMOTES section in
142linkgit:git-fetch[1] for details. This mechanism is legacy
143and not likely to be found in modern repositories.
Junio C Hamano1a4e8412005-12-27 08:17:23144
145hooks::
Junio C Hamano076ffcc2013-02-06 05:13:21146Hooks are customization scripts used by various Git
Junio C Hamano1a4e8412005-12-27 08:17:23147commands. A handful of sample hooks are installed when
Junio C Hamano1aa40d22010-01-21 17:46:43148'git init' is run, but all of them are disabled by
Junio C Hamano116db352008-12-17 19:48:40149default. To enable, the `.sample` suffix has to be
150removed from the filename by renaming.
Junio C Hamanofce7c7e2008-07-02 03:06:38151Read linkgit:githooks[5] for more details about
Junio C Hamano818f7d62006-03-26 01:49:30152each hook.
Junio C Hamano1a4e8412005-12-27 08:17:23153
154index::
155The current index file for the repository. It is
Junio C Hamanoe663a7a2006-01-25 12:37:28156usually not found in a bare repository.
Junio C Hamano1a4e8412005-12-27 08:17:23157
Junio C Hamano6f0c9442014-07-16 21:51:32158sharedindex.<SHA-1>::
159The shared index part, to be referenced by $GIT_DIR/index and
160other temporary index files. Only valid in split index mode.
161
Junio C Hamano1a4e8412005-12-27 08:17:23162info::
163Additional information about the repository is recorded
164in this directory.
165
166info/refs::
Junio C Hamano78ded482007-02-13 07:50:48167This file helps dumb transports discover what refs are
168available in this repository. If the repository is
169published for dumb transports, this file should be
Junio C Hamano1aa40d22010-01-21 17:46:43170regenerated by 'git update-server-info' every time a tag
Junio C Hamano78ded482007-02-13 07:50:48171or branch is created or modified. This is normally done
172from the `hooks/update` hook, which is run by the
Junio C Hamano1aa40d22010-01-21 17:46:43173'git-receive-pack' command when you 'git push' into the
Junio C Hamano78ded482007-02-13 07:50:48174repository.
Junio C Hamano1a4e8412005-12-27 08:17:23175
176info/grafts::
177This file records fake commit ancestry information, to
178pretend the set of parents a commit has is different
179from how the commit was actually created. One record
180per line describes a commit and its fake parents by
181listing their 40-byte hexadecimal object names separated
182by a space and terminated by a newline.
Junio C Hamano3b0cdc22014-03-18 22:06:16183+
184Note that the grafts mechanism is outdated and can lead to problems
185transferring objects between repositories; see linkgit:git-replace[1]
186for a more flexible and robust system to do the same thing.
Junio C Hamano1a4e8412005-12-27 08:17:23187
188info/exclude::
189This file, by convention among Porcelains, stores the
Junio C Hamano7ccb9fd2006-07-15 01:38:40190exclude pattern list. `.gitignore` is the per-directory
Junio C Hamano1aa40d22010-01-21 17:46:43191ignore file. 'git status', 'git add', 'git rm' and
Junio C Hamano076ffcc2013-02-06 05:13:21192'git clean' look at it but the core Git commands do not look
Junio C Hamano35738e82008-01-07 07:55:46193at it. See also: linkgit:gitignore[5].
Junio C Hamano1a4e8412005-12-27 08:17:23194
Junio C Hamanoc79bc672013-04-22 19:12:47195info/sparse-checkout::
196This file stores sparse checkout patterns.
197See also: linkgit:git-read-tree[1].
198
Junio C Hamano1a4e8412005-12-27 08:17:23199remotes::
Junio C Hamano6e41cb32011-08-29 07:12:49200Stores shorthands for URL and default refnames for use
201when interacting with remote repositories via 'git fetch',
202'git pull' and 'git push' commands. See the REMOTES section
203in linkgit:git-fetch[1] for details. This mechanism is legacy
204and not likely to be found in modern repositories.
Junio C Hamano341071d2006-06-04 07:24:48205
206logs::
207Records of changes made to refs are stored in this
Junio C Hamanofce7c7e2008-07-02 03:06:38208directory. See linkgit:git-update-ref[1]
Junio C Hamano341071d2006-06-04 07:24:48209for more information.
210
211logs/refs/heads/`name`::
212Records all changes made to the branch tip named `name`.
213
214logs/refs/tags/`name`::
215Records all changes made to the tag named `name`.
Junio C Hamano4f9a6052007-01-17 20:25:16216
217shallow::
218This is similar to `info/grafts` but is internally used
219and maintained by shallow clone mechanism. See `--depth`
Junio C Hamano35738e82008-01-07 07:55:46220option to linkgit:git-clone[1] and linkgit:git-fetch[1].
Junio C Hamanof7c042d2008-06-06 22:50:53221
Junio C Hamano8d74cd32013-06-10 19:54:55222modules::
223Contains the git-repositories of the submodules.
224
Junio C Hamanof7c042d2008-06-06 22:50:53225SEE ALSO
226--------
227linkgit:git-init[1],
228linkgit:git-clone[1],
229linkgit:git-fetch[1],
230linkgit:git-pack-refs[1],
231linkgit:git-gc[1],
232linkgit:git-checkout[1],
233linkgit:gitglossary[7],
234link:user-manual.html[The Git User's Manual]
235
236GIT
237---
238Part of the linkgit:git[1] suite.