Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 1 | gitrepository-layout(5) |
| 2 | ======================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | gitrepository-layout - Git Repository Layout |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | $GIT_DIR/* |
| 11 | |
| 12 | DESCRIPTION |
| 13 | ----------- |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 14 | |
| 15 | You may find these things in your git repository (`.git` |
| 16 | directory for a repository associated with your working tree, or |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 17 | `<project>.git` directory for a public 'bare' repository. It is |
Junio C Hamano | 47d68a5 | 2008-05-06 06:35:40 | [diff] [blame] | 18 | also possible to have a working tree where `.git` is a plain |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 19 | ASCII file containing `gitdir: <path>`, i.e. the path to the |
Junio C Hamano | 47d68a5 | 2008-05-06 06:35:40 | [diff] [blame] | 20 | real git repository). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 21 | |
| 22 | objects:: |
| 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 |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 26 | found in it), but there are a few ways to violate it. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 27 | + |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 28 | . You could have an incomplete but locally usable repository |
| 29 | by 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' |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 32 | objects from other object stores. A repository with this kind |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 33 | of incomplete object store is not suitable to be published for |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 34 | use with dumb transports but otherwise is OK as long as |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 35 | `objects/info/alternates` points at the object stores it |
| 36 | borrows from. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 37 | |
| 38 | objects/[0-9a-f][0-9a-f]:: |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 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. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 45 | |
| 46 | objects/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 | |
| 51 | objects/info:: |
| 52 | Additional information about the object store is |
| 53 | recorded in this directory. |
| 54 | |
| 55 | objects/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 |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 60 | published for dumb transports. 'git repack' does this |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 61 | by default. |
| 62 | |
| 63 | objects/info/alternates:: |
Junio C Hamano | 93ba9d3 | 2006-11-20 03:17:43 | [diff] [blame] | 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 | |
| 74 | objects/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. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 78 | |
| 79 | refs:: |
| 80 | References are stored in subdirectories of this |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 81 | directory. The 'git prune' command knows to preserve |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 82 | objects reachable from refs found in this directory and |
| 83 | 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 |
| 90 | object, or a tag object that points at a commit object). |
| 91 | |
Junio C Hamano | 4f9a605 | 2007-01-17 20:25:16 | [diff] [blame] | 92 | refs/remotes/`name`:: |
| 93 | records tip-of-the-tree commit objects of branches copied |
| 94 | from a remote repository. |
| 95 | |
| 96 | packed-refs:: |
| 97 | records the same information as refs/heads/, refs/tags/, |
| 98 | and friends record in a more efficient way. See |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 99 | linkgit:git-pack-refs[1]. |
Junio C Hamano | 4f9a605 | 2007-01-17 20:25:16 | [diff] [blame] | 100 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 101 | HEAD:: |
Junio C Hamano | 3a97102 | 2006-11-18 22:17:58 | [diff] [blame] | 102 | A symref (see glossary) to the `refs/heads/` namespace |
| 103 | describing the currently active branch. It does not mean |
| 104 | much if the repository is not associated with any working tree |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 105 | (i.e. a 'bare' repository), but a valid git repository |
Junio C Hamano | 3a97102 | 2006-11-18 22:17:58 | [diff] [blame] | 106 | *must* have the HEAD file; some porcelains may use it to |
| 107 | guess the designated "default" branch of the repository |
| 108 | (usually 'master'). It is legal if the named branch |
| 109 | 'name' does not (yet) exist. In some legacy setups, it is |
| 110 | a symbolic link instead of a symref that points at the current |
| 111 | branch. |
Junio C Hamano | 4f9a605 | 2007-01-17 20:25:16 | [diff] [blame] | 112 | + |
| 113 | HEAD can also record a specific commit directly, instead of |
| 114 | being a symref to point at the current branch. Such a state |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 115 | is often called 'detached HEAD.' See linkgit:git-checkout[1] |
| 116 | for details. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 117 | |
| 118 | branches:: |
| 119 | A slightly deprecated way to store shorthands to be used |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 120 | to specify a URL to 'git fetch', 'git pull' and 'git push'. |
| 121 | A file can be stored as `branches/<name>` and then |
| 122 | 'name' can be given to these commands in place of |
| 123 | 'repository' argument. See the REMOTES section in |
| 124 | linkgit:git-fetch[1] for details. This mechanism is legacy |
| 125 | and not likely to be found in modern repositories. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 126 | |
| 127 | hooks:: |
| 128 | Hooks are customization scripts used by various git |
| 129 | commands. A handful of sample hooks are installed when |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 130 | 'git init' is run, but all of them are disabled by |
Junio C Hamano | 116db35 | 2008-12-17 19:48:40 | [diff] [blame] | 131 | default. To enable, the `.sample` suffix has to be |
| 132 | removed from the filename by renaming. |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 133 | Read linkgit:githooks[5] for more details about |
Junio C Hamano | 818f7d6 | 2006-03-26 01:49:30 | [diff] [blame] | 134 | each hook. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 135 | |
| 136 | index:: |
| 137 | The current index file for the repository. It is |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 138 | usually not found in a bare repository. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 139 | |
| 140 | info:: |
| 141 | Additional information about the repository is recorded |
| 142 | in this directory. |
| 143 | |
| 144 | info/refs:: |
Junio C Hamano | 78ded48 | 2007-02-13 07:50:48 | [diff] [blame] | 145 | This file helps dumb transports discover what refs are |
| 146 | available in this repository. If the repository is |
| 147 | published for dumb transports, this file should be |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 148 | regenerated by 'git update-server-info' every time a tag |
Junio C Hamano | 78ded48 | 2007-02-13 07:50:48 | [diff] [blame] | 149 | or branch is created or modified. This is normally done |
| 150 | from the `hooks/update` hook, which is run by the |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 151 | 'git-receive-pack' command when you 'git push' into the |
Junio C Hamano | 78ded48 | 2007-02-13 07:50:48 | [diff] [blame] | 152 | repository. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 153 | |
| 154 | info/grafts:: |
| 155 | This file records fake commit ancestry information, to |
| 156 | pretend the set of parents a commit has is different |
| 157 | from how the commit was actually created. One record |
| 158 | per line describes a commit and its fake parents by |
| 159 | listing their 40-byte hexadecimal object names separated |
| 160 | by a space and terminated by a newline. |
| 161 | |
| 162 | info/exclude:: |
| 163 | This file, by convention among Porcelains, stores the |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 164 | exclude pattern list. `.gitignore` is the per-directory |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 165 | ignore file. 'git status', 'git add', 'git rm' and |
| 166 | 'git clean' look at it but the core git commands do not look |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 167 | at it. See also: linkgit:gitignore[5]. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 168 | |
| 169 | remotes:: |
Junio C Hamano | 6e41cb3 | 2011-08-29 07:12:49 | [diff] [blame] | 170 | Stores shorthands for URL and default refnames for use |
| 171 | when interacting with remote repositories via 'git fetch', |
| 172 | 'git pull' and 'git push' commands. See the REMOTES section |
| 173 | in linkgit:git-fetch[1] for details. This mechanism is legacy |
| 174 | and not likely to be found in modern repositories. |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 175 | |
| 176 | logs:: |
| 177 | Records of changes made to refs are stored in this |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 178 | directory. See linkgit:git-update-ref[1] |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 179 | for more information. |
| 180 | |
| 181 | logs/refs/heads/`name`:: |
| 182 | Records all changes made to the branch tip named `name`. |
| 183 | |
| 184 | logs/refs/tags/`name`:: |
| 185 | Records all changes made to the tag named `name`. |
Junio C Hamano | 4f9a605 | 2007-01-17 20:25:16 | [diff] [blame] | 186 | |
| 187 | shallow:: |
| 188 | This is similar to `info/grafts` but is internally used |
| 189 | and maintained by shallow clone mechanism. See `--depth` |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 190 | option to linkgit:git-clone[1] and linkgit:git-fetch[1]. |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 191 | |
| 192 | SEE ALSO |
| 193 | -------- |
| 194 | linkgit:git-init[1], |
| 195 | linkgit:git-clone[1], |
| 196 | linkgit:git-fetch[1], |
| 197 | linkgit:git-pack-refs[1], |
| 198 | linkgit:git-gc[1], |
| 199 | linkgit:git-checkout[1], |
| 200 | linkgit:gitglossary[7], |
| 201 | link:user-manual.html[The Git User's Manual] |
| 202 | |
| 203 | GIT |
| 204 | --- |
| 205 | Part of the linkgit:git[1] suite. |