1git repository layout
2=====================
34
You may find these things in your git repository (`.git`
5directory for a repository associated with your working tree, or
6`'project'.git` directory for a public 'bare' repository).
78
objects::
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.
21. You can be using `objects/info/alternates` mechanism, or
22`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow'
23objects from other object stores. A repository with this kind
24of incomplete object store is not suitable to be published for
25use with dumb transports but otherwise is OK as long as
26`objects/info/alternates` points at the right object stores
27it borrows from.
2829
objects/[0-9a-f][0-9a-f]::
30Traditionally, each object is stored in its own file.
31They are split into 256 subdirectories using the first
32two letters from its object name to keep the number of
33directory entries `objects` directory itself needs to
34hold. Objects found here are often called 'unpacked'
35objects.
3637
objects/pack::
38Packs (files that store many object in compressed form,
39along with index files to allow them to be randomly
40accessed) are found in this directory.
4142
objects/info::
43Additional information about the object store is
44recorded in this directory.
4546
objects/info/packs::
47This file is to help dumb transports discover what packs
48are available in this object store. Whenever a pack is
49added or removed, `git update-server-info` should be run
50to keep this file up-to-date if the repository is
51published for dumb transports. `git repack` does this
52by default.
5354
objects/info/alternates::
55This file records paths to alternate object stores that
56this object store borrows objects from, one pathname per
57line. Note that not only native Git tools use it locally,
58but the HTTP fetcher also tries to use it remotely; this
59will usually work if you have relative paths (relative
60to the object database, not to the repository!) in your
61alternates file, but it will not work if you use absolute
62paths unless the absolute path in filesystem and web URL
63is the same. See also 'objects/info/http-alternates'.
6465
objects/info/http-alternates::
66This file records URLs to alternate object stores that
67this object store borrows objects from, to be used when
68the repository is fetched over HTTP.
6970
refs::
71References are stored in subdirectories of this
72directory. The `git prune` command knows to keep
73objects reachable from refs found in this directory and
74its subdirectories.
7576
refs/heads/`name`::
77records tip-of-the-tree commit objects of branch `name`
7879
refs/tags/`name`::
80records any object name (not necessarily a commit
81object, or a tag object that points at a commit object).
8283
HEAD::
84A symref (see glossary) to the `refs/heads/` namespace
85describing the currently active branch. It does not mean
86much if the repository is not associated with any working tree
87(i.e. a 'bare' repository), but a valid git repository
88*must* have the HEAD file; some porcelains may use it to
89guess the designated "default" branch of the repository
90(usually 'master'). It is legal if the named branch
91'name' does not (yet) exist. In some legacy setups, it is
92a symbolic link instead of a symref that points at the current
93branch.
9495
branches::
96A slightly deprecated way to store shorthands to be used
97to specify URL to `git fetch`, `git pull` and `git push`
98commands is to store a file in `branches/'name'` and
99give 'name' to these commands in place of 'repository'
100argument.
101102
hooks::
103Hooks are customization scripts used by various git
104commands. A handful of sample hooks are installed when
105`git init-db` is run, but all of them are disabled by
106default. To enable, they need to be made executable.
107Read link:hooks.html[hooks] for more details about
108each hook.
109110
index::
111The current index file for the repository. It is
112usually not found in a bare repository.
113114
info::
115Additional information about the repository is recorded
116in this directory.
117118
info/refs::
119This file is to help dumb transports to discover what
120refs are available in this repository. Whenever you
121create/delete a new branch or a new tag, `git
122update-server-info` should be run to keep this file
123up-to-date if the repository is published for dumb
124transports. The `git-receive-pack` command, which is
125run on a remote repository when you `git push` into it,
126runs `hooks/update` hook to help you achieve this.
127128
info/grafts::
129This file records fake commit ancestry information, to
130pretend the set of parents a commit has is different
131from how the commit was actually created. One record
132per line describes a commit and its fake parents by
133listing their 40-byte hexadecimal object names separated
134by a space and terminated by a newline.
135136
info/exclude::
137This file, by convention among Porcelains, stores the
138exclude pattern list. `.gitignore` is the per-directory
139ignore file. `git status`, `git add`, `git rm` and `git
140clean` look at it but the core git commands do not look
141at it. See also: gitlink:git-ls-files[1] `--exclude-from`
142and `--exclude-per-directory`.
143144
remotes::
145Stores shorthands to be used to give URL and default
146refnames to interact with remote repository to `git
147fetch`, `git pull` and `git push` commands.
148149
logs::
150Records of changes made to refs are stored in this
151directory. See the documentation on git-update-ref
152for more information.
153154
logs/refs/heads/`name`::
155Records all changes made to the branch tip named `name`.
156157
logs/refs/tags/`name`::
158Records all changes made to the tag named `name`.