]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/gitrepository-layout.txt
Documentation: the name of the system is 'Git', not 'git'
[thirdparty/git.git] / Documentation / gitrepository-layout.txt
CommitLineData
30eba7bf
CC
1gitrepository-layout(5)
2=======================
3
4NAME
5----
6gitrepository-layout - Git Repository Layout
7
8SYNOPSIS
9--------
10$GIT_DIR/*
11
12DESCRIPTION
13-----------
a1d4aa74 14
2de9b711 15You may find these things in your Git repository (`.git`
a1d4aa74 16directory for a repository associated with your working tree, or
30eba7bf 17`<project>.git` directory for a public 'bare' repository. It is
b44ebb19 18also possible to have a working tree where `.git` is a plain
6b677a28 19ASCII file containing `gitdir: <path>`, i.e. the path to the
2de9b711 20real Git repository).
a1d4aa74
JH
21
22objects::
23 Object store associated with this repository. Usually
24 an object store is self sufficient (i.e. all the objects
25 that are referred to by an object found in it are also
3d3d2821 26 found in it), but there are a few ways to violate it.
a1d4aa74 27+
3d3d2821
BW
28. You could have an incomplete but locally usable repository
29by creating a shallow clone. See linkgit:git-clone[1].
30. You could be using the `objects/info/alternates` or
31`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanisms to 'borrow'
a1d4aa74 32objects from other object stores. A repository with this kind
89438677 33of incomplete object store is not suitable to be published for
a1d4aa74 34use with dumb transports but otherwise is OK as long as
3d3d2821
BW
35`objects/info/alternates` points at the object stores it
36borrows from.
a1d4aa74
JH
37
38objects/[0-9a-f][0-9a-f]::
3d3d2821
BW
39 A newly created object is stored in its own file.
40 The objects are splayed over 256 subdirectories using
41 the first two characters of the sha1 object name to
42 keep the number of directory entries in `objects`
43 itself to a manageable number. Objects found
44 here are often called 'unpacked' (or 'loose') objects.
a1d4aa74
JH
45
46objects/pack::
47 Packs (files that store many object in compressed form,
48 along with index files to allow them to be randomly
49 accessed) are found in this directory.
50
51objects/info::
52 Additional information about the object store is
53 recorded in this directory.
54
55objects/info/packs::
56 This file is to help dumb transports discover what packs
57 are available in this object store. Whenever a pack is
58 added or removed, `git update-server-info` should be run
59 to keep this file up-to-date if the repository is
0b444cdb 60 published for dumb transports. 'git repack' does this
a1d4aa74
JH
61 by default.
62
63objects/info/alternates::
198a4f4f
PB
64 This file records paths to alternate object stores that
65 this object store borrows objects from, one pathname per
66 line. Note that not only native Git tools use it locally,
67 but the HTTP fetcher also tries to use it remotely; this
68 will usually work if you have relative paths (relative
69 to the object database, not to the repository!) in your
70 alternates file, but it will not work if you use absolute
71 paths unless the absolute path in filesystem and web URL
72 is the same. See also 'objects/info/http-alternates'.
73
74objects/info/http-alternates::
75 This file records URLs to alternate object stores that
76 this object store borrows objects from, to be used when
77 the repository is fetched over HTTP.
a1d4aa74
JH
78
79refs::
80 References are stored in subdirectories of this
3d3d2821 81 directory. The 'git prune' command knows to preserve
a1d4aa74
JH
82 objects reachable from refs found in this directory and
83 its subdirectories.
84
85refs/heads/`name`::
86 records tip-of-the-tree commit objects of branch `name`
87
88refs/tags/`name`::
89 records any object name (not necessarily a commit
90 object, or a tag object that points at a commit object).
91
2aa73a8f
JH
92refs/remotes/`name`::
93 records tip-of-the-tree commit objects of branches copied
94 from a remote repository.
95
11fbe18e
PO
96refs/replace/`<obj-sha1>`::
97 records the SHA1 of the object that replaces `<obj-sha1>`.
98 This is similar to info/grafts and is internally used and
99 maintained by linkgit:git-replace[1]. Such refs can be exchanged
100 between repositories while grafts are not.
101
2aa73a8f
JH
102packed-refs::
103 records the same information as refs/heads/, refs/tags/,
104 and friends record in a more efficient way. See
5162e697 105 linkgit:git-pack-refs[1].
2aa73a8f 106
a1d4aa74 107HEAD::
e3d457fb
PB
108 A symref (see glossary) to the `refs/heads/` namespace
109 describing the currently active branch. It does not mean
110 much if the repository is not associated with any working tree
2de9b711 111 (i.e. a 'bare' repository), but a valid Git repository
e3d457fb
PB
112 *must* have the HEAD file; some porcelains may use it to
113 guess the designated "default" branch of the repository
114 (usually 'master'). It is legal if the named branch
115 'name' does not (yet) exist. In some legacy setups, it is
116 a symbolic link instead of a symref that points at the current
117 branch.
5e1a2e8c
JH
118+
119HEAD can also record a specific commit directly, instead of
120being a symref to point at the current branch. Such a state
3d3d2821
BW
121is often called 'detached HEAD.' See linkgit:git-checkout[1]
122for details.
a1d4aa74
JH
123
124branches::
125 A slightly deprecated way to store shorthands to be used
3d3d2821
BW
126 to specify a URL to 'git fetch', 'git pull' and 'git push'.
127 A file can be stored as `branches/<name>` and then
128 'name' can be given to these commands in place of
129 'repository' argument. See the REMOTES section in
130 linkgit:git-fetch[1] for details. This mechanism is legacy
131 and not likely to be found in modern repositories.
a1d4aa74
JH
132
133hooks::
2de9b711 134 Hooks are customization scripts used by various Git
a1d4aa74 135 commands. A handful of sample hooks are installed when
0b444cdb 136 'git init' is run, but all of them are disabled by
d1983677
MH
137 default. To enable, the `.sample` suffix has to be
138 removed from the filename by renaming.
6998e4db 139 Read linkgit:githooks[5] for more details about
6250ad1e 140 each hook.
a1d4aa74
JH
141
142index::
143 The current index file for the repository. It is
87e80c4b 144 usually not found in a bare repository.
a1d4aa74
JH
145
146info::
147 Additional information about the repository is recorded
148 in this directory.
149
150info/refs::
ccf5aa8d
PR
151 This file helps dumb transports discover what refs are
152 available in this repository. If the repository is
153 published for dumb transports, this file should be
0b444cdb 154 regenerated by 'git update-server-info' every time a tag
ccf5aa8d
PR
155 or branch is created or modified. This is normally done
156 from the `hooks/update` hook, which is run by the
0b444cdb 157 'git-receive-pack' command when you 'git push' into the
ccf5aa8d 158 repository.
a1d4aa74
JH
159
160info/grafts::
161 This file records fake commit ancestry information, to
162 pretend the set of parents a commit has is different
163 from how the commit was actually created. One record
164 per line describes a commit and its fake parents by
165 listing their 40-byte hexadecimal object names separated
166 by a space and terminated by a newline.
167
a1d4aa74
JH
168info/exclude::
169 This file, by convention among Porcelains, stores the
ff4d7804 170 exclude pattern list. `.gitignore` is the per-directory
0b444cdb 171 ignore file. 'git status', 'git add', 'git rm' and
2de9b711 172 'git clean' look at it but the core Git commands do not look
5162e697 173 at it. See also: linkgit:gitignore[5].
a1d4aa74
JH
174
175remotes::
3d3d2821
BW
176 Stores shorthands for URL and default refnames for use
177 when interacting with remote repositories via 'git fetch',
178 'git pull' and 'git push' commands. See the REMOTES section
179 in linkgit:git-fetch[1] for details. This mechanism is legacy
180 and not likely to be found in modern repositories.
c22a7f0f
SP
181
182logs::
183 Records of changes made to refs are stored in this
483bc4f0 184 directory. See linkgit:git-update-ref[1]
c22a7f0f
SP
185 for more information.
186
187logs/refs/heads/`name`::
188 Records all changes made to the branch tip named `name`.
189
190logs/refs/tags/`name`::
191 Records all changes made to the tag named `name`.
428ddc5d
JH
192
193shallow::
194 This is similar to `info/grafts` but is internally used
195 and maintained by shallow clone mechanism. See `--depth`
5162e697 196 option to linkgit:git-clone[1] and linkgit:git-fetch[1].
30eba7bf
CC
197
198SEE ALSO
199--------
200linkgit:git-init[1],
201linkgit:git-clone[1],
202linkgit:git-fetch[1],
203linkgit:git-pack-refs[1],
204linkgit:git-gc[1],
205linkgit:git-checkout[1],
206linkgit:gitglossary[7],
207link:user-manual.html[The Git User's Manual]
208
209GIT
210---
9e1f0a85 211Part of the linkgit:git[1] suite.