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 game of trees
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 stores the history of tracked files
31 in a Git repository, as used by the Git version control system.
32 This repository format is described in
33 .Xr git-repository 5 .
34 .Pp
35 .Nm
36 is a
37 .Dq distributed
38 version control system because every copy of a repository is writeable.
39 Modifications made to files can be synchronized between repositories
40 at any time.
41 .Pp
42 Files managed by
43 .Nm
44 must be checked out from the repository for modification.
45 Checked out files are stored in a
46 .Em work tree
47 which can be placed at an arbitrary directory in the filesystem hierarchy.
48 The on-disk format of this work tree is described in
49 .Xr got-worktree 5 .
50 .Pp
51 .Nm
52 provides global and command-specific options.
53 Global options must preceed the command name, and are as follows:
54 .Bl -tag -width tenletters
55 .It Fl h
56 Display usage information.
57 .El
58 .Pp
59 The commands for
60 .Nm
61 are as follows:
62 .Bl -tag -width checkout
63 .It Cm checkout [ Fl c Ar commit ] [ Fl p Ar path-prefix ] repository-path [ work-tree-path ]
64 Copy files from a repository into a new work tree.
65 If the
66 .Ar work tree path
67 is not specified, either use the last component of
68 .Ar repository path ,
69 or if a
70 .Ar path prefix
71 was specified use the last component of
72 .Ar path prefix .
73 .Pp
74 The options for
75 .Cm got checkout
76 are as follows:
77 .Bl -tag -width Ds
78 .It Fl c Ar commit
79 Check out files from the specified
80 .Ar commit .
81 If this option is not specified, a commit resolved via the repository's HEAD
82 reference will be used.
83 .It Fl p Ar path-prefix
84 Restrict the work tree to a subset of the repository's tree hierarchy.
85 Only files beneath the specified
86 .Ar path-prefix
87 will be checked out.
88 .El
89 .It Cm update [ Fl c Ar commit ] [ Ar path ]
90 Update an existing work tree to another commit on the current branch.
91 By default, the latest commit on the current branch is assumed.
92 Show the status of each affected file, using the following status codes:
93 .Bl -column YXZ description
94 .It U Ta file was updated and contained no local changes
95 .It G Ta file was updated and local changes were merged cleanly
96 .It C Ta file was updated and conflicts occurred during merge
97 .It D Ta file was deleted
98 .It A Ta new file was added
99 .It ~ Ta versioned file is obstructed by a non-regular file
100 .It ! Ta a missing versioned file was restored
101 .El
102 .Pp
103 If a
104 .Ar path
105 is specified, restrict the update operation to files at or within this path.
106 The path is required to exist in the update operation's target commit.
107 Files in the work tree outside this path will remain unchanged and will
108 retain their previously recorded base commit.
109 Some
110 .Nm
111 commands may refuse to run while the work tree contains files from
112 multiple base commits.
113 The base commit of such a work tree can be made consistent by running
114 .Cm got update
115 across the entire work tree.
116 .Pp
117 The options for
118 .Cm got update
119 are as follows:
120 .Bl -tag -width Ds
121 .It Fl c Ar commit
122 Update the work tree to the specified
123 .Ar commit .
124 The expected argument is a SHA1 hash which corresponds to a commit object.
125 .El
126 .It Cm status [ Ar path ]
127 Show the current modification status of files in a work tree,
128 using the following status codes:
129 .Bl -column YXZ description
130 .It M Ta modified file
131 .It A Ta file scheduled for addition in next commit
132 .It D Ta file scheduled for deletion in next commit
133 .It C Ta modified or added file which contains merge conflicts
134 .It ! Ta versioned file was expected on disk but is missing
135 .It ~ Ta versioned file is obstructed by a non-regular file
136 .It ? Ta unversioned item not tracked by
137 .Nm
138 .El
139 .Pp
140 If a
141 .Ar path
142 is specified, only show modifications within this path.
143 .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 ]
144 Display history of a repository.
145 If a
146 .Ar path
147 is specified, show only commits which modified this path.
148 .Pp
149 The options for
150 .Cm got log
151 are as follows:
152 .Bl -tag -width Ds
153 .It Fl c Ar commit
154 Start traversing history at the specified
155 .Ar commit .
156 The expected argument is the name of a branch or a SHA1 hash which corresponds
157 to a commit object.
158 .It Fl C Ar number
159 Set the number of context lines shown in diffs with
160 .Fl p .
161 By default, 3 lines of context are shown.
162 .It Fl f
163 Restrict history traversal to the first parent of each commit.
164 This shows the linear history of the current branch only.
165 Merge commits which affected the current branch will be shown but
166 individual commits which originated on other branches will be omitted.
167 .It Fl l Ar N
168 Limit history traversal to a given number of commits.
169 .It Fl p
170 Display the patch of modifications made in each commit.
171 .It Fl r Ar repository-path
172 Use the repository at the specified path.
173 If not specified, assume the repository is located at or above the current
174 working directory.
175 If this directory is a
176 .Nm
177 work tree, use the repository path associated with this work tree.
178 .El
179 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 | Ar path ]
180 When invoked within a work tree with less than two arguments, display
181 uncommitted changes in the work tree.
182 If a
183 .Ar path
184 is specified, only show changes within this path.
185 .Pp
186 If two arguments are provided, treat each argument as a SHA1 hash which
187 corresponds to an object in the repository, and display differences
188 between these objects.
189 Both objects must be of the same type (blobs, trees, or commits).
190 .Pp
191 The options for
192 .Cm got diff
193 are as follows:
194 .Bl -tag -width Ds
195 .It Fl C Ar number
196 Set the number of context lines shown in the diff.
197 By default, 3 lines of context are shown.
198 .It Fl r Ar repository-path
199 Use the repository at the specified path.
200 If not specified, assume the repository is located at or above the current
201 working directory.
202 If this directory is a
203 .Nm
204 work tree, use the repository path associated with this work tree.
205 .El
206 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
207 Display line-by-line history of a file at the specified path.
208 .Pp
209 The options for
210 .Cm got blame
211 are as follows:
212 .Bl -tag -width Ds
213 .It Fl c Ar commit
214 Start traversing history at the specified
215 .Ar commit .
216 The expected argument is the name of a branch or a SHA1 hash which corresponds
217 to a commit object.
218 .It Fl r Ar repository-path
219 Use the repository at the specified path.
220 If not specified, assume the repository is located at or above the current
221 working directory.
222 If this directory is a
223 .Nm
224 work tree, use the repository path associated with this work tree.
225 .El
226 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
227 Display a listing of files and directories at the specified
228 directory path in the repository.
229 Entries shown in this listing may carry one of the following trailing
230 annotations:
231 .Bl -column YXZ description
232 .It / Ta entry is a directory
233 .It * Ta entry is an executable file
234 .El
235 .Pp
236 If no
237 .Ar path
238 is specified, list the repository path corresponding to the current
239 directory of the work tree, or the root directory of the repository
240 if there is no work tree.
241 .Pp
242 The options for
243 .Cm got tree
244 are as follows:
245 .Bl -tag -width Ds
246 .It Fl c Ar commit
247 List files and directories as they appear in the specified
248 .Ar commit .
249 The expected argument is the name of a branch or a SHA1 hash which corresponds
250 to a commit object.
251 .It Fl r Ar repository-path
252 Use the repository at the specified path.
253 If not specified, assume the repository is located at or above the current
254 working directory.
255 If this directory is a
256 .Nm
257 work tree, use the repository path associated with this work tree.
258 .It Fl i
259 Show object IDs of files (blob objects) and directories (tree objects).
260 .It Fl R
261 Recurse into sub-directories in the repository.
262 .El
263 .It Cm ref [ Fl r Ar repository-path ] [ Fl l ] [ Fl d Ar name ] [ Ar name Ar object ]
264 Manage references in a repository.
265 .Pp
266 If no options are passed, expect two arguments and attempt to create,
267 or update, the reference with the given
268 .Ar name ,
269 and make it point at the given
270 .Ar object .
271 The object argument is a SHA1 hash which corresponds to an existing
272 object in the repository.
273 .Pp
274 The options for
275 .Cm got ref
276 are as follows:
277 .Bl -tag -width Ds
278 .It Fl r Ar repository-path
279 Use the repository at the specified path.
280 If not specified, assume the repository is located at or above the current
281 working directory.
282 If this directory is a
283 .Nm
284 work tree, use the repository path associated with this work tree.
285 .It Fl l
286 List all existing references in the repository.
287 .It Fl d Ar name
288 Delete the reference with the specified name from the repository.
289 .El
290 .It Cm add Ar file-path ...
291 Schedule unversioned files in a work tree for addition to the
292 repository in the next commit.
293 .It Cm rm Ar file-path
294 Remove a versioned file from a work tree and schedule it for deletion
295 from the repository in the next commit.
296 .Pp
297 The options for
298 .Cm got rm
299 are as follows:
300 .Bl -tag -width Ds
301 .It Fl f
302 Perform the operation even if the file contains uncommitted modifications.
303 .El
304 .It Cm revert Ar file-path
305 Revert any uncommited changes in the file at the specified path.
306 File contents will be overwritten with those contained in the
307 work tree's base commit. There is no way to bring discarded
308 changes back after
309 .Cm got revert !
310 .Pp
311 If the file was added with
312 .Cm got add
313 it will become an unversioned file again.
314 If the file was deleted with
315 .Cm got rm
316 it will be restored.
317 .It Cm commit [ Fl m Ar msg ] [ file-path ]
318 Create a new commit in the repository from local changes in a work tree
319 and use this commit as the new base commit for the work tree.
320 .Pp
321 Show the status of each affected file, using the following status codes:
322 .Bl -column YXZ description
323 .It M Ta modified file
324 .It D Ta file was deleted
325 .It A Ta new file was added
326 .El
327 .Pp
328 Files without local changes will retain their previously recorded base
329 commit.
330 Some
331 .Nm
332 commands may refuse to run while the work tree contains files from
333 multiple base commits.
334 The base commit of such a work tree can be made consistent by running
335 .Cm got update
336 across the entire work tree.
337 .Pp
338 The
339 .Cm got commit
340 command requires the
341 .Ev GOT_AUTHOR
342 environment variable to be set.
343 .Pp
344 The options for
345 .Cm got commit
346 are as follows:
347 .Bl -tag -width Ds
348 .It Fl m Ar msg
349 Use the specified log message when creating the new commit.
350 .El
351 .El
352 .Sh ENVIRONMENT
353 .Bl -tag -width GOT_AUTHOR
354 .It Ev GOT_AUTHOR
355 The author's name and email address for
356 .Cm got commit ,
357 for example:
358 .An Stefan Sperling Aq Mt stsp@openbsd.org
359 .El
360 .Sh EXIT STATUS
361 .Ex -std got
362 .Sh EXAMPLES
363 Check out a work tree of
364 .Ox
365 kernel sources from a Git repository at /var/repo/openbsd-src to ~/sys:
366 .Pp
367 .Dl $ got checkout -p sys /var/repo/openbsd-src ~/sys
368 .Sh SEE ALSO
369 .Xr git-repository 5
370 .Xr got-worktree 5
371 .Sh AUTHORS
372 .An Stefan Sperling Aq Mt stsp@openbsd.org
373 .An Martin Pieuchot Aq Mt mpi@openbsd.org