blob: 863cb6710a836036b79ef9ee97f6e8886b7c42e9 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git repository layout
2=====================
3
4You may find these things in your git repository (`.git`
5directory for a repository associated with your working tree, or
Junio C Hamanoe663a7a2006-01-25 12:37:286`'project'.git` directory for a public 'bare' repository).
Junio C Hamano1a4e8412005-12-27 08:17:237
8objects::
9Object store associated with this repository. Usually
10an object store is self sufficient (i.e. all the objects
11that are referred to by an object found in it are also
12found in it), but there are couple of ways to violate
13it.
14+
15. You could populate the repository by running a commit walker
16without `-a` option. Depending on which options are given, you
17could have only commit objects without associated blobs and
18trees this way, for example. A repository with this kind of
19incomplete object store is not suitable to be published to the
20outside world but sometimes useful for private repository.
Junio C Hamano4f9a6052007-01-17 20:25:1621. You also could have an incomplete but locally usable repository
22by cloning shallowly. See gitlink:git-clone[1].
Junio C Hamano1a4e8412005-12-27 08:17:2323. You can be using `objects/info/alternates` mechanism, or
24`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow'
25objects from other object stores. A repository with this kind
Junio C Hamano235a91e2006-01-07 01:13:5826of incomplete object store is not suitable to be published for
Junio C Hamano1a4e8412005-12-27 08:17:2327use with dumb transports but otherwise is OK as long as
28`objects/info/alternates` points at the right object stores
29it borrows from.
30
31objects/[0-9a-f][0-9a-f]::
32Traditionally, each object is stored in its own file.
33They are split into 256 subdirectories using the first
34two letters from its object name to keep the number of
35directory entries `objects` directory itself needs to
36hold. Objects found here are often called 'unpacked'
Junio C Hamano4f9a6052007-01-17 20:25:1637(or 'loose') objects.
Junio C Hamano1a4e8412005-12-27 08:17:2338
39objects/pack::
40Packs (files that store many object in compressed form,
41along with index files to allow them to be randomly
42accessed) are found in this directory.
43
44objects/info::
45Additional information about the object store is
46recorded in this directory.
47
48objects/info/packs::
49This file is to help dumb transports discover what packs
50are available in this object store. Whenever a pack is
51added or removed, `git update-server-info` should be run
52to keep this file up-to-date if the repository is
53published for dumb transports. `git repack` does this
54by default.
55
56objects/info/alternates::
Junio C Hamano93ba9d32006-11-20 03:17:4357This file records paths to alternate object stores that
58this object store borrows objects from, one pathname per
59line. Note that not only native Git tools use it locally,
60but the HTTP fetcher also tries to use it remotely; this
61will usually work if you have relative paths (relative
62to the object database, not to the repository!) in your
63alternates file, but it will not work if you use absolute
64paths unless the absolute path in filesystem and web URL
65is the same. See also 'objects/info/http-alternates'.
66
67objects/info/http-alternates::
68This file records URLs to alternate object stores that
69this object store borrows objects from, to be used when
70the repository is fetched over HTTP.
Junio C Hamano1a4e8412005-12-27 08:17:2371
72refs::
73References are stored in subdirectories of this
74directory. The `git prune` command knows to keep
75objects reachable from refs found in this directory and
76its subdirectories.
77
78refs/heads/`name`::
79records tip-of-the-tree commit objects of branch `name`
80
81refs/tags/`name`::
82records any object name (not necessarily a commit
83object, or a tag object that points at a commit object).
84
Junio C Hamano4f9a6052007-01-17 20:25:1685refs/remotes/`name`::
86records tip-of-the-tree commit objects of branches copied
87from a remote repository.
88
89packed-refs::
90records the same information as refs/heads/, refs/tags/,
91and friends record in a more efficient way. See
92gitlink:git-pack-refs[1].
93
Junio C Hamano1a4e8412005-12-27 08:17:2394HEAD::
Junio C Hamano3a971022006-11-18 22:17:5895A symref (see glossary) to the `refs/heads/` namespace
96describing the currently active branch. It does not mean
97much if the repository is not associated with any working tree
Junio C Hamanoe663a7a2006-01-25 12:37:2898(i.e. a 'bare' repository), but a valid git repository
Junio C Hamano3a971022006-11-18 22:17:5899*must* have the HEAD file; some porcelains may use it to
100guess the designated "default" branch of the repository
101(usually 'master'). It is legal if the named branch
102'name' does not (yet) exist. In some legacy setups, it is
103a symbolic link instead of a symref that points at the current
104branch.
Junio C Hamano4f9a6052007-01-17 20:25:16105+
106HEAD can also record a specific commit directly, instead of
107being a symref to point at the current branch. Such a state
108is often called 'detached HEAD', and almost all commands work
109identically as normal. See gitlink:git-checkout[1] for
110details.
Junio C Hamano1a4e8412005-12-27 08:17:23111
112branches::
113A slightly deprecated way to store shorthands to be used
114to specify URL to `git fetch`, `git pull` and `git push`
115commands is to store a file in `branches/'name'` and
116give 'name' to these commands in place of 'repository'
117argument.
118
119hooks::
120Hooks are customization scripts used by various git
121commands. A handful of sample hooks are installed when
Junio C Hamano24351a82007-01-13 08:09:17122`git init` is run, but all of them are disabled by
Junio C Hamano1a4e8412005-12-27 08:17:23123default. To enable, they need to be made executable.
Junio C Hamano818f7d62006-03-26 01:49:30124Read link:hooks.html[hooks] for more details about
125each hook.
Junio C Hamano1a4e8412005-12-27 08:17:23126
127index::
128The current index file for the repository. It is
Junio C Hamanoe663a7a2006-01-25 12:37:28129usually not found in a bare repository.
Junio C Hamano1a4e8412005-12-27 08:17:23130
131info::
132Additional information about the repository is recorded
133in this directory.
134
135info/refs::
136This file is to help dumb transports to discover what
137refs are available in this repository. Whenever you
138create/delete a new branch or a new tag, `git
139update-server-info` should be run to keep this file
140up-to-date if the repository is published for dumb
141transports. The `git-receive-pack` command, which is
142run on a remote repository when you `git push` into it,
Junio C Hamano235a91e2006-01-07 01:13:58143runs `hooks/update` hook to help you achieve this.
Junio C Hamano1a4e8412005-12-27 08:17:23144
145info/grafts::
146This file records fake commit ancestry information, to
147pretend the set of parents a commit has is different
148from how the commit was actually created. One record
149per line describes a commit and its fake parents by
150listing their 40-byte hexadecimal object names separated
151by a space and terminated by a newline.
152
153info/exclude::
154This file, by convention among Porcelains, stores the
Junio C Hamano7ccb9fd2006-07-15 01:38:40155exclude pattern list. `.gitignore` is the per-directory
156ignore file. `git status`, `git add`, `git rm` and `git
157clean` look at it but the core git commands do not look
158at it. See also: gitlink:git-ls-files[1] `--exclude-from`
159and `--exclude-per-directory`.
Junio C Hamano1a4e8412005-12-27 08:17:23160
161remotes::
162Stores shorthands to be used to give URL and default
163refnames to interact with remote repository to `git
164fetch`, `git pull` and `git push` commands.
Junio C Hamano341071d2006-06-04 07:24:48165
166logs::
167Records of changes made to refs are stored in this
168directory. See the documentation on git-update-ref
169for more information.
170
171logs/refs/heads/`name`::
172Records all changes made to the branch tip named `name`.
173
174logs/refs/tags/`name`::
175Records all changes made to the tag named `name`.
Junio C Hamano4f9a6052007-01-17 20:25:16176
177shallow::
178This is similar to `info/grafts` but is internally used
179and maintained by shallow clone mechanism. See `--depth`
180option to gitlink:git-clone[1] and gitlink:git-fetch[1].
181