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. |
| 21 | . You can be using `objects/info/alternates` mechanism, or |
| 22 | `$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow' |
| 23 | objects from other object stores. A repository with this kind |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 24 | of incomplete object store is not suitable to be published for |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 25 | use with dumb transports but otherwise is OK as long as |
| 26 | `objects/info/alternates` points at the right object stores |
| 27 | it borrows from. |
| 28 | |
| 29 | objects/[0-9a-f][0-9a-f]:: |
| 30 | Traditionally, each object is stored in its own file. |
| 31 | They are split into 256 subdirectories using the first |
| 32 | two letters from its object name to keep the number of |
| 33 | directory entries `objects` directory itself needs to |
| 34 | hold. Objects found here are often called 'unpacked' |
| 35 | objects. |
| 36 | |
| 37 | objects/pack:: |
| 38 | Packs (files that store many object in compressed form, |
| 39 | along with index files to allow them to be randomly |
| 40 | accessed) are found in this directory. |
| 41 | |
| 42 | objects/info:: |
| 43 | Additional information about the object store is |
| 44 | recorded in this directory. |
| 45 | |
| 46 | objects/info/packs:: |
| 47 | This file is to help dumb transports discover what packs |
| 48 | are available in this object store. Whenever a pack is |
| 49 | added or removed, `git update-server-info` should be run |
| 50 | to keep this file up-to-date if the repository is |
| 51 | published for dumb transports. `git repack` does this |
| 52 | by default. |
| 53 | |
| 54 | objects/info/alternates:: |
Junio C Hamano | 93ba9d3 | 2006-11-20 03:17:43 | [diff] [blame] | 55 | This file records paths to alternate object stores that |
| 56 | this object store borrows objects from, one pathname per |
| 57 | line. Note that not only native Git tools use it locally, |
| 58 | but the HTTP fetcher also tries to use it remotely; this |
| 59 | will usually work if you have relative paths (relative |
| 60 | to the object database, not to the repository!) in your |
| 61 | alternates file, but it will not work if you use absolute |
| 62 | paths unless the absolute path in filesystem and web URL |
| 63 | is the same. See also 'objects/info/http-alternates'. |
| 64 | |
| 65 | objects/info/http-alternates:: |
| 66 | This file records URLs to alternate object stores that |
| 67 | this object store borrows objects from, to be used when |
| 68 | the repository is fetched over HTTP. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 69 | |
| 70 | refs:: |
| 71 | References are stored in subdirectories of this |
| 72 | directory. The `git prune` command knows to keep |
| 73 | objects reachable from refs found in this directory and |
| 74 | its subdirectories. |
| 75 | |
| 76 | refs/heads/`name`:: |
| 77 | records tip-of-the-tree commit objects of branch `name` |
| 78 | |
| 79 | refs/tags/`name`:: |
| 80 | records any object name (not necessarily a commit |
| 81 | object, or a tag object that points at a commit object). |
| 82 | |
| 83 | HEAD:: |
Junio C Hamano | 3a97102 | 2006-11-18 22:17:58 | [diff] [blame] | 84 | A symref (see glossary) to the `refs/heads/` namespace |
| 85 | describing the currently active branch. It does not mean |
| 86 | much if the repository is not associated with any working tree |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 87 | (i.e. a 'bare' repository), but a valid git repository |
Junio C Hamano | 3a97102 | 2006-11-18 22:17:58 | [diff] [blame] | 88 | *must* have the HEAD file; some porcelains may use it to |
| 89 | guess 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 |
| 92 | a symbolic link instead of a symref that points at the current |
| 93 | branch. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 94 | |
| 95 | branches:: |
| 96 | A slightly deprecated way to store shorthands to be used |
| 97 | to specify URL to `git fetch`, `git pull` and `git push` |
| 98 | commands is to store a file in `branches/'name'` and |
| 99 | give 'name' to these commands in place of 'repository' |
| 100 | argument. |
| 101 | |
| 102 | hooks:: |
| 103 | Hooks are customization scripts used by various git |
| 104 | commands. A handful of sample hooks are installed when |
| 105 | `git init-db` is run, but all of them are disabled by |
| 106 | default. To enable, they need to be made executable. |
Junio C Hamano | 818f7d6 | 2006-03-26 01:49:30 | [diff] [blame] | 107 | Read link:hooks.html[hooks] for more details about |
| 108 | each hook. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 109 | |
| 110 | index:: |
| 111 | The current index file for the repository. It is |
Junio C Hamano | e663a7a | 2006-01-25 12:37:28 | [diff] [blame] | 112 | usually not found in a bare repository. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 113 | |
| 114 | info:: |
| 115 | Additional information about the repository is recorded |
| 116 | in this directory. |
| 117 | |
| 118 | info/refs:: |
| 119 | This file is to help dumb transports to discover what |
| 120 | refs are available in this repository. Whenever you |
| 121 | create/delete a new branch or a new tag, `git |
| 122 | update-server-info` should be run to keep this file |
| 123 | up-to-date if the repository is published for dumb |
| 124 | transports. The `git-receive-pack` command, which is |
| 125 | run on a remote repository when you `git push` into it, |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 126 | runs `hooks/update` hook to help you achieve this. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 127 | |
| 128 | info/grafts:: |
| 129 | This file records fake commit ancestry information, to |
| 130 | pretend the set of parents a commit has is different |
| 131 | from how the commit was actually created. One record |
| 132 | per line describes a commit and its fake parents by |
| 133 | listing their 40-byte hexadecimal object names separated |
| 134 | by a space and terminated by a newline. |
| 135 | |
| 136 | info/exclude:: |
| 137 | This file, by convention among Porcelains, stores the |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 138 | exclude pattern list. `.gitignore` is the per-directory |
| 139 | ignore file. `git status`, `git add`, `git rm` and `git |
| 140 | clean` look at it but the core git commands do not look |
| 141 | at it. See also: gitlink:git-ls-files[1] `--exclude-from` |
| 142 | and `--exclude-per-directory`. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 143 | |
| 144 | remotes:: |
| 145 | Stores shorthands to be used to give URL and default |
| 146 | refnames to interact with remote repository to `git |
| 147 | fetch`, `git pull` and `git push` commands. |
Junio C Hamano | 341071d | 2006-06-04 07:24:48 | [diff] [blame] | 148 | |
| 149 | logs:: |
| 150 | Records of changes made to refs are stored in this |
| 151 | directory. See the documentation on git-update-ref |
| 152 | for more information. |
| 153 | |
| 154 | logs/refs/heads/`name`:: |
| 155 | Records all changes made to the branch tip named `name`. |
| 156 | |
| 157 | logs/refs/tags/`name`:: |
| 158 | Records all changes made to the tag named `name`. |