Blame


1 5e5560e1 2018-08-01 stsp .\"
2 5e5560e1 2018-08-01 stsp .\" Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 5e5560e1 2018-08-01 stsp .\"
4 5e5560e1 2018-08-01 stsp .\" Permission to use, copy, modify, and distribute this software for any
5 5e5560e1 2018-08-01 stsp .\" purpose with or without fee is hereby granted, provided that the above
6 5e5560e1 2018-08-01 stsp .\" copyright notice and this permission notice appear in all copies.
7 5e5560e1 2018-08-01 stsp .\"
8 5e5560e1 2018-08-01 stsp .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 5e5560e1 2018-08-01 stsp .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 5e5560e1 2018-08-01 stsp .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 5e5560e1 2018-08-01 stsp .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 5e5560e1 2018-08-01 stsp .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 5e5560e1 2018-08-01 stsp .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 5e5560e1 2018-08-01 stsp .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 5e5560e1 2018-08-01 stsp .\"
16 5e5560e1 2018-08-01 stsp .Dd $Mdocdate$
17 5e5560e1 2018-08-01 stsp .Dt GIT-REPOSITORY 5
18 5e5560e1 2018-08-01 stsp .Os
19 5e5560e1 2018-08-01 stsp .Sh NAME
20 5e5560e1 2018-08-01 stsp .Nm git-repository
21 4639d500 2018-08-01 stsp .Nd Git repository format
22 5e5560e1 2018-08-01 stsp .Sh DESCRIPTION
23 4639d500 2018-08-01 stsp A Git repository stores a series of versioned snapshots of a file hierarchy.
24 5e5560e1 2018-08-01 stsp The repository's core data model is a directed acyclic graph which
25 5e5560e1 2018-08-01 stsp contains three types of objects as nodes.
26 5e5560e1 2018-08-01 stsp .Pp
27 5e5560e1 2018-08-01 stsp The content of tracked files is stored in objects of type
28 5e5560e1 2018-08-01 stsp .Em blob .
29 5e5560e1 2018-08-01 stsp .Pp
30 5e5560e1 2018-08-01 stsp A
31 5e5560e1 2018-08-01 stsp .Em tree
32 5e5560e1 2018-08-01 stsp object points to any number of such blobs, and also to other trees in
33 4639d500 2018-08-01 stsp order to represent a hierarchy of files and directories.
34 5e5560e1 2018-08-01 stsp .Pp
35 5e5560e1 2018-08-01 stsp A
36 5e5560e1 2018-08-01 stsp .Em commit
37 5e5560e1 2018-08-01 stsp object points to the root element of one tree, and thus records the
38 5e5560e1 2018-08-01 stsp state of this entire tree as a snapshot.
39 4639d500 2018-08-01 stsp Commit objects are chained together to form a line of history of snapshots.
40 5e5560e1 2018-08-01 stsp A given commit can be suceeded by an arbitrary number of subsequent commits,
41 5e5560e1 2018-08-01 stsp such that diverging lines of version control history, known as
42 5e5560e1 2018-08-01 stsp .Em branches ,
43 5e5560e1 2018-08-01 stsp can be represented.
44 5e5560e1 2018-08-01 stsp A commit which preceeds another commit is referred to as that other commit's
45 5e5560e1 2018-08-01 stsp .Em parent commit .
46 5e5560e1 2018-08-01 stsp A commit with multiple parents reunites diverged lines of history and is
47 5e5560e1 2018-08-01 stsp known as a
48 5e5560e1 2018-08-01 stsp .Em merge commit .
49 5e5560e1 2018-08-01 stsp .Pp
50 4639d500 2018-08-01 stsp Each object is identified by a SHA1 hash calculated over the object's
51 4639d500 2018-08-01 stsp header and the data stored in the object.
52 4639d500 2018-08-01 stsp .Sh OBJECT STORAGE
53 4639d500 2018-08-01 stsp Loose objects are stored as individual files beneath the directory
54 4639d500 2018-08-01 stsp .Pa objects ,
55 4639d500 2018-08-01 stsp spread across 256 sub-directories named after the 256 possible hexadecimal
56 4639d500 2018-08-01 stsp values of the first byte of an object identifier.
57 e0486a23 2018-08-01 stsp The name of the loose object file corresponds to the remaining hexadecimal
58 e0486a23 2018-08-01 stsp byte values of the object's identifier.
59 4639d500 2018-08-01 stsp .Pp
60 4639d500 2018-08-01 stsp A loose object file begins with a header which specifies the type of object
61 4639d500 2018-08-01 stsp as an ASCII string, followed by an ASCII space character, followed by the
62 4639d500 2018-08-01 stsp object data's size encoded as an ASCII number string.
63 4639d500 2018-08-01 stsp The header is terminated by a
64 4639d500 2018-08-01 stsp .Sy NUL
65 4639d500 2018-08-01 stsp character, and the remainder of the file contains object data.
66 4639d500 2018-08-01 stsp Loose objects files are compressed with
67 5e5560e1 2018-08-01 stsp .Xr deflate 3 .
68 4639d500 2018-08-01 stsp .Pp
69 4639d500 2018-08-01 stsp Multiple objects can be bundled in a
70 5e5560e1 2018-08-01 stsp .Em pack file
71 4639d500 2018-08-01 stsp for better disk space efficiency and increased run-time performance.
72 4639d500 2018-08-01 stsp The pack file format adds two additional types of objects:
73 4639d500 2018-08-01 stsp offset delta objects and reference delta objects.
74 4639d500 2018-08-01 stsp .Pp
75 4639d500 2018-08-01 stsp TODO describe pack file format
76 4639d500 2018-08-01 stsp .Pp
77 5e5560e1 2018-08-01 stsp .Sh FILES
78 5e5560e1 2018-08-01 stsp .Bl -tag -width /etc/rpc -compact
79 5e5560e1 2018-08-01 stsp .It Pa HEAD
80 5e5560e1 2018-08-01 stsp .It Pa ORIG_HEAD
81 5e5560e1 2018-08-01 stsp .It Pa FETCH_HEAD
82 5e5560e1 2018-08-01 stsp .It Pa branches/
83 5e5560e1 2018-08-01 stsp .It Pa config
84 5e5560e1 2018-08-01 stsp .It Pa description
85 5e5560e1 2018-08-01 stsp .It Pa hooks/
86 5e5560e1 2018-08-01 stsp .It Pa index
87 5e5560e1 2018-08-01 stsp .It Pa info
88 5e5560e1 2018-08-01 stsp .It Pa logs/
89 5e5560e1 2018-08-01 stsp .It Pa objects/
90 5e5560e1 2018-08-01 stsp .It Pa packed-refs
91 5e5560e1 2018-08-01 stsp .It Pa refs/
92 5e5560e1 2018-08-01 stsp .El
93 5e5560e1 2018-08-01 stsp .Sh SEE ALSO
94 5e5560e1 2018-08-01 stsp .Xr got 1 ,
95 5e5560e1 2018-08-01 stsp .Xr deflate 3 ,
96 4639d500 2018-08-01 stsp .Xr SHA1 3 ,
97 5e5560e1 2018-08-01 stsp .Xr got-worktree 5
98 5e5560e1 2018-08-01 stsp .Sh HISTORY
99 4639d500 2018-08-01 stsp The Git repository format was initially designed by Linus Torvalds in 2005
100 4639d500 2018-08-01 stsp and has since been extended by various people involved in the development
101 4639d500 2018-08-01 stsp of the Git version control system.