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