1GITREPOSITORY-LAYOU(5) Git Manual GITREPOSITORY-LAYOU(5)
2
3
4
6 gitrepository-layout - Git Repository Layout
7
9 $GIT_DIR/*
10
12 You may find these things in your git repository (.git directory for a
13 repository associated with your working tree, or <project>.git
14 directory for a public bare repository. It is also possible to have a
15 working tree where .git is a plain ascii file containing gitdir:
16 <path>, i.e. the path to the real git repository).
17
18 objects
19 Object store associated with this repository. Usually an object
20 store is self sufficient (i.e. all the objects that are referred to
21 by an object found in it are also found in it), but there are
22 couple of ways to violate it.
23
24 1. You could populate the repository by running a commit walker
25 without -a option. Depending on which options are given, you
26 could have only commit objects without associated blobs and
27 trees this way, for example. A repository with this kind of
28 incomplete object store is not suitable to be published to the
29 outside world but sometimes useful for private repository.
30
31 2. You also could have an incomplete but locally usable repository
32 by cloning shallowly. See git-clone(1).
33
34 3. You can be using objects/info/alternates mechanism, or
35 $GIT_ALTERNATE_OBJECT_DIRECTORIES mechanism to borrow objects
36 from other object stores. A repository with this kind of
37 incomplete object store is not suitable to be published for use
38 with dumb transports but otherwise is OK as long as
39 objects/info/alternates points at the right object stores it
40 borrows from.
41
42 objects/[0-9a-f][0-9a-f]
43 Traditionally, each object is stored in its own file. They are
44 split into 256 subdirectories using the first two letters from its
45 object name to keep the number of directory entries objects
46 directory itself needs to hold. Objects found here are often called
47 unpacked (or loose) objects.
48
49 objects/pack
50 Packs (files that store many object in compressed form, along with
51 index files to allow them to be randomly accessed) are found in
52 this directory.
53
54 objects/info
55 Additional information about the object store is recorded in this
56 directory.
57
58 objects/info/packs
59 This file is to help dumb transports discover what packs are
60 available in this object store. Whenever a pack is added or
61 removed, git update-server-info should be run to keep this file
62 up-to-date if the repository is published for dumb transports. git
63 repack does this by default.
64
65 objects/info/alternates
66 This file records paths to alternate object stores that this object
67 store borrows objects from, one pathname per line. Note that not
68 only native Git tools use it locally, but the HTTP fetcher also
69 tries to use it remotely; this will usually work if you have
70 relative paths (relative to the object database, not to the
71 repository!) in your alternates file, but it will not work if you
72 use absolute paths unless the absolute path in filesystem and web
73 URL is the same. See also objects/info/http-alternates.
74
75 objects/info/http-alternates
76 This file records URLs to alternate object stores that this object
77 store borrows objects from, to be used when the repository is
78 fetched over HTTP.
79
80 refs
81 References are stored in subdirectories of this directory. The git
82 prune command knows to keep objects reachable from refs found in
83 this directory and its subdirectories.
84
85 refs/heads/name
86 records tip-of-the-tree commit objects of branch name
87
88 refs/tags/name
89 records any object name (not necessarily a commit object, or a tag
90 object that points at a commit object).
91
92 refs/remotes/name
93 records tip-of-the-tree commit objects of branches copied from a
94 remote repository.
95
96 packed-refs
97 records the same information as refs/heads/, refs/tags/, and
98 friends record in a more efficient way. See git-pack-refs(1).
99
100 HEAD
101 A symref (see glossary) to the refs/heads/ namespace describing the
102 currently active branch. It does not mean much if the repository is
103 not associated with any working tree (i.e. a bare repository), but
104 a valid git repository must have the HEAD file; some porcelains may
105 use it to guess the designated "default" branch of the repository
106 (usually master). It is legal if the named branch name does not
107 (yet) exist. In some legacy setups, it is a symbolic link instead
108 of a symref that points at the current branch.
109
110 HEAD can also record a specific commit directly, instead of being a
111 symref to point at the current branch. Such a state is often called
112 detached HEAD, and almost all commands work identically as normal.
113 See git-checkout(1) for details.
114
115 branches
116 A slightly deprecated way to store shorthands to be used to specify
117 URL to git fetch, git pull and git push commands is to store a file
118 in branches/<name> and give name to these commands in place of
119 repository argument.
120
121 hooks
122 Hooks are customization scripts used by various git commands. A
123 handful of sample hooks are installed when git init is run, but all
124 of them are disabled by default. To enable, the .sample suffix has
125 to be removed from the filename by renaming. Read githooks(5) for
126 more details about each hook.
127
128 index
129 The current index file for the repository. It is usually not found
130 in a bare repository.
131
132 info
133 Additional information about the repository is recorded in this
134 directory.
135
136 info/refs
137 This file helps dumb transports discover what refs are available in
138 this repository. If the repository is published for dumb
139 transports, this file should be regenerated by git
140 update-server-info every time a tag or branch is created or
141 modified. This is normally done from the hooks/update hook, which
142 is run by the git-receive-pack command when you git push into the
143 repository.
144
145 info/grafts
146 This file records fake commit ancestry information, to pretend the
147 set of parents a commit has is different from how the commit was
148 actually created. One record per line describes a commit and its
149 fake parents by listing their 40-byte hexadecimal object names
150 separated by a space and terminated by a newline.
151
152 info/exclude
153 This file, by convention among Porcelains, stores the exclude
154 pattern list. .gitignore is the per-directory ignore file. git
155 status, git add, git rm and git clean look at it but the core git
156 commands do not look at it. See also: gitignore(5).
157
158 remotes
159 Stores shorthands to be used to give URL and default refnames to
160 interact with remote repository to git fetch, git pull and git push
161 commands.
162
163 logs
164 Records of changes made to refs are stored in this directory. See
165 git-update-ref(1) for more information.
166
167 logs/refs/heads/name
168 Records all changes made to the branch tip named name.
169
170 logs/refs/tags/name
171 Records all changes made to the tag named name.
172
173 shallow
174 This is similar to info/grafts but is internally used and
175 maintained by shallow clone mechanism. See --depth option to git-
176 clone(1) and git-fetch(1).
177
179 git-init(1), git-clone(1), git-fetch(1), git-pack-refs(1), git-gc(1),
180 git-checkout(1), gitglossary(7), The Git User’s Manual[1]
181
183 Part of the git(1) suite.
184
186 1. The Git User’s Manual
187 file:///usr/share/doc/git-1.7.1/user-manual.html
188
189
190
191Git 1.7.1 08/16/2017 GITREPOSITORY-LAYOU(5)