Blob


1 .\"
2 .\" Copyright (c) 2017 Martin Pieuchot
3 .\" Copyright (c) 2018, 2019 Stefan Sperling
4 .\"
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
8 .\"
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .\"
17 .Dd $Mdocdate$
18 .Dt GOT 1
19 .Os
20 .Sh NAME
21 .Nm got
22 .Nd version control system
23 .Sh SYNOPSIS
24 .Nm
25 .Ar command
26 .Op Fl h
27 .Op Ar arg ...
28 .Sh DESCRIPTION
29 .Nm
30 is a version control system which prioritizes ease of use and simplicity
31 over flexibility.
32 .Pp
33 .Nm
34 stores the history of tracked files in a repository which uses
35 the same on-disk format as
36 .Dq bare
37 repositories used by the Git version control system.
38 This repository format is described in
39 .Xr git-repository 5 .
40 .Pp
41 .Nm
42 is a
43 .Em distributed
44 version control system because every copy of a repository is writeable.
45 Modifications made to files can be synchronized between repositories
46 at any time.
47 .Pp
48 Files managed by
49 .Nm
50 must be checked out from the repository for modification.
51 Checked out files are stored in a
52 .Em work tree
53 which can be placed at an arbitrary directory in the filesystem hierarchy.
54 The on-disk format of a
55 .Nm
56 work tree is described in
57 .Xr got-worktree 5 .
58 .Pp
59 .Nm
60 provides global and command-specific options.
61 Global options must preceed the command name, and are as follows:
62 .Bl -tag -width tenletters
63 .It Fl h
64 Display usage information.
65 .El
66 .Pp
67 The commands for
68 .Nm
69 are as follows:
70 .Bl -tag -width checkout
71 .It Cm checkout [ Fl c Ar commit ] [ Fl p Ar path-prefix ] repository-path [ work-tree-path ]
72 Copy files from a repository into a new work tree.
73 If the
74 .Ar work tree path
75 is not specified, either use the base name of the
76 .Ar repository path ,
77 or if a
78 .Ar path prefix
79 was specified use the base name of the
80 .Ar path prefix .
81 .Pp
82 The options for
83 .Cm got checkout
84 are as follows:
85 .Bl -tag -width Ds
86 .It Fl c Ar commit
87 Check out files from the specified
88 .Ar commit .
89 By default, the HEAD commit is used.
90 .It Fl p Ar path-prefix
91 Restrict the work tree to a subset of the repository's tree hierarchy.
92 Only files beneath the specified
93 .Ar path-prefix
94 will be checked out.
95 .El
96 .It Cm update [ Fl c Ar commit ] [ work-tree-path ]
97 Update an existing work tree to another commit on the current branch.
98 By default, the latest commit on the current branch is assumed.
99 If the
100 .Ar work tree path
101 is omitted, use the current working directory.
102 .Pp
103 The options for
104 .Cm got update
105 are as follows:
106 .Bl -tag -width Ds
107 .It Fl c Ar commit
108 Update the work tree to the specified
109 .Ar commit .
110 The expected argument is a SHA1 hash which corresponds to a commit object.
111 .El
112 .It Cm status [ Ar worktree-path ]
113 Show the current modification status of files in a worktree,
114 using the following status codes:
115 .Bl -column YXZ description
116 .It M Ta modified file
117 .It ! Ta versioned file was expected on disk but is missing
118 .It ~ Ta versioned file is obstructed by a non-regular file
119 .It ? Ta unversioned item not tracked by
120 .Nm
121 .El
122 .Pp
123 If the
124 .Ar work tree path
125 is omitted, use the current working directory.
126 .It Cm log [ Fl c Ar commit ] [ Fl C Ar number ] [ Fl f ] [ Fl l Ar N ] [ Fl p ] [ Fl r Ar repository-path ] [ path ]
127 Display history of a repository.
128 If a
129 .Ar path
130 is specified, show only commits which modified this path.
131 .Pp
132 The options for
133 .Cm got log
134 are as follows:
135 .Bl -tag -width Ds
136 .It Fl c Ar commit
137 Start traversing history at the specified
138 .Ar commit .
139 The expected argument is the name of a branch or a SHA1 hash which corresponds
140 to a commit object.
141 .It Fl C Ar number
142 Set the number of context lines shown in diffs with
143 .Fl p .
144 By default, 3 lines of context are shown.
145 .It Fl f
146 Restrict history traversal to the first parent of each commit.
147 This shows the linear history of the current branch only.
148 Merge commits which affected the current branch will be shown but
149 individual commits which originated on other branches will be omitted.
150 .It Fl l Ar N
151 Limit history traversal to a given number of commits.
152 .It Fl p
153 Display the patch of modifications made in each commit.
154 .It Fl r Ar repository-path
155 Use the repository at the specified path.
156 If not specified, assume the repository is located at or above the current
157 working directory.
158 If this directory is a
159 .Nm
160 work tree, use the repository path associated with this work tree.
161 .El
162 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 ]
163 Display differences between blobs in the repository and files in the
164 work tree, or between two specified objects in a repository.
165 If specified, each
166 .Ar object
167 argument is a SHA1 hash which corresponds to the object.
168 Both objects must be of the same type (blobs, trees, or commits).
169 .Pp
170 The options for
171 .Cm got diff
172 are as follows:
173 .Bl -tag -width Ds
174 .It Fl C Ar number
175 Set the number of context lines shown in the diff.
176 By default, 3 lines of context are shown.
177 .It Fl r Ar repository-path
178 Use the repository at the specified path.
179 If not specified, assume the repository is located at or above the current
180 working directory.
181 If this directory is a
182 .Nm
183 work tree, use the repository path associated with this work tree.
184 .El
185 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
186 Display line-by-line history of a file at the specified path.
187 .Pp
188 The options for
189 .Cm got blame
190 are as follows:
191 .Bl -tag -width Ds
192 .It Fl c Ar commit
193 Start traversing history at the specified
194 .Ar commit .
195 The expected argument is the name of a branch or a SHA1 hash which corresponds
196 to a commit object.
197 .It Fl r Ar repository-path
198 Use the repository at the specified path.
199 If not specified, assume the repository is located at or above the current
200 working directory.
201 If this directory is a
202 .Nm
203 work tree, use the repository path associated with this work tree.
204 .El
205 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
206 Display a listing of files and directories at the specified
207 directory path in the repository.
208 If no
209 .Ar path
210 is specified, list the repository path corresponding to the current
211 directory of the work tree, or the root directory of the repository
212 if there is no work tree.
213 .Pp
214 The options for
215 .Cm got tree
216 are as follows:
217 .Bl -tag -width Ds
218 .It Fl c Ar commit
219 List files and directories as they appear in the specified
220 .Ar commit .
221 The expected argument is the name of a branch or a SHA1 hash which corresponds
222 to a commit object.
223 .It Fl r Ar repository-path
224 Use the repository at the specified path.
225 If not specified, assume the repository is located at or above the current
226 working directory.
227 If this directory is a
228 .Nm
229 work tree, use the repository path associated with this work tree.
230 .It Fl i
231 Show object IDs of files (blob objects) and directories (tree objects).
232 .It Fl R
233 Recurse into sub-directories in the repository.
234 .El
235 .Sh EXIT STATUS
236 .Ex -std got
237 .Sh EXAMPLES
238 Check out a work tree of
239 .Ox
240 kernel sources from a Git repository at /var/repo/openbsd-src to ~/sys:
241 .Pp
242 .Dl $ got checkout -p sys /var/repo/openbsd-src ~/sys
243 .Sh SEE ALSO
244 .Xr git-repository 5
245 .Xr got-worktree 5
246 .Sh AUTHORS
247 .An Stefan Sperling Aq Mt stsp@openbsd.org
248 .An Martin Pieuchot Aq Mt mpi@openbsd.org