Skip to content

Commit a1d4aa7

Browse files
author
Junio C Hamano
committed
Add repository-layout document.
... and link to it from both the main index and the tutorial. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2d56993 commit a1d4aa7

File tree

4 files changed

+148
-14
lines changed

4 files changed

+148
-14
lines changed

‎Documentation/Makefile‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ MAN7_TXT=git.txt
33

44
DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
55

6-
ARTICLES = tutorial cvs-migration diffcore howto-index
6+
ARTICLES = tutorial
7+
ARTICLES += cvs-migration
8+
ARTICLES += diffcore
9+
ARTICLES += howto-index
10+
ARTICLES += repository-layout
711
# with their own formatting rules.
812
SP_ARTICLES = glossary howto/revert-branch-rebase
913

‎Documentation/git.txt‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -412,24 +412,13 @@ HEAD::
412412

413413
File/Directory Structure
414414
------------------------
415-
The git-core manipulates the following areas in the directory:
416415

417-
.git/ The base (overridden with $GIT_DIR)
418-
objects/ The object base (overridden with $GIT_OBJECT_DIRECTORY)
419-
??/ 'First 2 chars of object' directories.
420-
pack/ Packed archives.
421-
422-
refs/ Directories containing symbolic names for objects
423-
(each file contains the hex SHA1 + newline)
424-
heads/ Commits which are heads of various sorts
425-
tags/ Tags, by the tag name (or some local renaming of it)
426-
*/ Any other subdirectory of refs/ can be used to store
427-
files similar to what are under refs/heads/.
428-
HEAD Symlink to refs/heads/<current-branch-name>
416+
Please see link:repository-layout.html[repository layout] document.
429417

430418
Higher level SCMs may provide and manage additional information in the
431419
GIT_DIR.
432420

421+
433422
Terminology
434423
-----------
435424
Please see link:glossary.html[glossary] document.
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
GIT repository layout
2+
=====================
3+
v0.99.5, Sep 2005
4+
5+
You may find these things in your git repository (`.git`
6+
directory for a repository associated with your working tree, or
7+
`'project'.git` directory for a public 'naked' repository).
8+
9+
objects::
10+
Object store associated with this repository. Usually
11+
an object store is self sufficient (i.e. all the objects
12+
that are referred to by an object found in it are also
13+
found in it), but there are couple of ways to violate
14+
it.
15+
+
16+
. You could populate the repository by running a commit walker
17+
without `-a` option. Depending on which options are given, you
18+
could have only commit objects without associated blobs and
19+
trees this way, for example. A repository with this kind of
20+
incomplete object store is not suitable to be published to the
21+
outside world but sometimes useful for private repository.
22+
. You can be using `objects/info/alternates` mechanism, or
23+
`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow'
24+
objects from other object stores. A repository with this kind
25+
of incompete object store is not suitable to be published for
26+
use with dumb transports but otherwise is OK as long as
27+
`objects/info/alternates` points at the right object stores
28+
it borrows from.
29+
30+
objects/[0-9a-f][0-9a-f]::
31+
Traditionally, each object is stored in its own file.
32+
They are split into 256 subdirectories using the first
33+
two letters from its object name to keep the number of
34+
directory entries `objects` directory itself needs to
35+
hold. Objects found here are often called 'unpacked'
36+
objects.
37+
38+
objects/pack::
39+
Packs (files that store many object in compressed form,
40+
along with index files to allow them to be randomly
41+
accessed) are found in this directory.
42+
43+
objects/info::
44+
Additional information about the object store is
45+
recorded in this directory.
46+
47+
objects/info/packs::
48+
This file is to help dumb transports discover what packs
49+
are available in this object store. Whenever a pack is
50+
added or removed, `git update-server-info` should be run
51+
to keep this file up-to-date if the repository is
52+
published for dumb transports. `git repack` does this
53+
by default.
54+
55+
objects/info/alternates::
56+
This file records absolute filesystem paths of alternate
57+
object stores that this object store borrows objects
58+
from, one pathname per line.
59+
60+
refs::
61+
References are stored in subdirectories of this
62+
directory. The `git prune` command knows to keep
63+
objects reachable from refs found in this directory and
64+
its subdirectories.
65+
66+
refs/heads/`name`::
67+
records tip-of-the-tree commit objects of branch `name`
68+
69+
refs/tags/`name`::
70+
records any object name (not necessarily a commit
71+
object, or a tag object that points at a commit object).
72+
73+
HEAD::
74+
A symlink of the form `refs/heads/'name'` to point at
75+
the current branch, if exists. It does not mean much if
76+
the repository is not associated with any working tree
77+
(i.e. 'naked' repository), but a valid git repository
78+
*must* have such a symlink here. It is legal if the
79+
named branch 'name' does not (yet) exist.
80+
81+
branches::
82+
A slightly deprecated way to store shorthands to be used
83+
to specify URL to `git fetch`, `git pull` and `git push`
84+
commands is to store a file in `branches/'name'` and
85+
give 'name' to these commands in place of 'repository'
86+
argument.
87+
88+
hooks::
89+
Hooks are customization scripts used by various git
90+
commands. A handful of sample hooks are installed when
91+
`git init-db` is run, but all of them are disabled by
92+
default. To enable, they need to be made executable.
93+
94+
index::
95+
The current index file for the repository. It is
96+
usually not found in a naked repository.
97+
98+
info::
99+
Additional information about the repository is recorded
100+
in this directory.
101+
102+
info/refs::
103+
This file is to help dumb transports to discover what
104+
refs are available in this repository. Whenever you
105+
create/delete a new branch or a new tag, `git
106+
update-server-info` should be run to keep this file
107+
up-to-date if the repository is published for dumb
108+
transports. The `git-receive-pack` command, which is
109+
run on a remote repository when you `git push` into it,
110+
runs `hooks/update` hook to help you achive this.
111+
112+
info/grafts::
113+
This file records fake commit ancestry information, to
114+
pretend the set of parents a commit has is different
115+
from how the commit was actually created. One record
116+
per line describes a commit and its fake parents by
117+
listing their 40-byte hexadecimal object names separated
118+
by a space and terminated by a newline.
119+
120+
info/rev-cache::
121+
No higher-level tool currently takes advantage of this
122+
file, but it is generated when `git update-server-info`
123+
is run. It records the commit ancestry information of
124+
the commits in this repository in a concise binary
125+
format, and can be read with `git-show-rev-cache`.
126+
127+
info/exclude::
128+
This file, by convention among Porcelains, stores the
129+
exclude pattern list. `git status` looks at it, but
130+
otherwise it is not looked at by any of the core GIT
131+
commands.
132+
133+
remotes::
134+
Stoers shorthands to be used to give URL and default
135+
refnames to interact with remote repository to `git
136+
fetch`, `git pull` and `git push` commands.

‎Documentation/tutorial.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ expect to see a number of 41-byte files containing these
9393
references in these `refs` subdirectories when you actually start
9494
populating your tree.
9595

96+
[NOTE]
97+
An advanced user may want to take a look at the
98+
link:repository-layout.html[repository layout] document
99+
after finishing this tutorial.
100+
96101
You have now created your first git repository. Of course, since it's
97102
empty, that's not very useful, so let's start populating it with data.
98103

0 commit comments

Comments
 (0)