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 last component of
76 .Ar repository path ,
77 or if a
78 .Ar path prefix
79 was specified use the last component of
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 If this option is not specified, a commit resolved via the repository's HEAD
90 reference will be used.
91 .It Fl p Ar path-prefix
92 Restrict the work tree to a subset of the repository's tree hierarchy.
93 Only files beneath the specified
94 .Ar path-prefix
95 will be checked out.
96 .El
97 .It Cm update [ Fl c Ar commit ] [ work-tree-path ]
98 Update an existing work tree to another commit on the current branch.
99 By default, the latest commit on the current branch is assumed.
100 Show the status of each affected file, using the following status codes:
101 .Bl -column YXZ description
102 .It U Ta file was updated and contained no local changes
103 .It G Ta file was updated and local changes were merged cleanly
104 .It C Ta file was updated and conflicts occurred during merge
105 .It D Ta file was deleted
106 .It A Ta new file was added
107 .It ~ Ta versioned file is obstructed by a non-regular file
108 .It ! Ta a missing versioned file was restored
109 .El
110 .Pp
111 If the
112 .Ar work tree path
113 is omitted, use the current working directory.
114 .Pp
115 .Pp
116 The options for
117 .Cm got update
118 are as follows:
119 .Bl -tag -width Ds
120 .It Fl c Ar commit
121 Update the work tree to the specified
122 .Ar commit .
123 The expected argument is a SHA1 hash which corresponds to a commit object.
124 .El
125 .It Cm status [ Ar path ]
126 Show the current modification status of files in a worktree,
127 using the following status codes:
128 .Bl -column YXZ description
129 .It M Ta modified file
130 .It ! Ta versioned file was expected on disk but is missing
131 .It ~ Ta versioned file is obstructed by a non-regular file
132 .It ? Ta unversioned item not tracked by
133 .Nm
134 .El
135 .Pp
136 If a
137 .Ar path
138 is specified, only show modifications within this path.
139 .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 ]
140 Display history of a repository.
141 If a
142 .Ar path
143 is specified, show only commits which modified this path.
144 .Pp
145 The options for
146 .Cm got log
147 are as follows:
148 .Bl -tag -width Ds
149 .It Fl c Ar commit
150 Start traversing history at the specified
151 .Ar commit .
152 The expected argument is the name of a branch or a SHA1 hash which corresponds
153 to a commit object.
154 .It Fl C Ar number
155 Set the number of context lines shown in diffs with
156 .Fl p .
157 By default, 3 lines of context are shown.
158 .It Fl f
159 Restrict history traversal to the first parent of each commit.
160 This shows the linear history of the current branch only.
161 Merge commits which affected the current branch will be shown but
162 individual commits which originated on other branches will be omitted.
163 .It Fl l Ar N
164 Limit history traversal to a given number of commits.
165 .It Fl p
166 Display the patch of modifications made in each commit.
167 .It Fl r Ar repository-path
168 Use the repository at the specified path.
169 If not specified, assume the repository is located at or above the current
170 working directory.
171 If this directory is a
172 .Nm
173 work tree, use the repository path associated with this work tree.
174 .El
175 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 | Ar path ]
176 When invoked within a work tree with less than two arguments, display
177 uncommitted changes in the work tree.
178 If a
179 .Ar path
180 is specified, only show changes within this path.
181 .Pp
182 If two arguments are provided, treat each argument as a SHA1 hash which
183 corresponds to an object in the repository, and display differences
184 between these objects.
185 Both objects must be of the same type (blobs, trees, or commits).
186 .Pp
187 The options for
188 .Cm got diff
189 are as follows:
190 .Bl -tag -width Ds
191 .It Fl C Ar number
192 Set the number of context lines shown in the diff.
193 By default, 3 lines of context are shown.
194 .It Fl r Ar repository-path
195 Use the repository at the specified path.
196 If not specified, assume the repository is located at or above the current
197 working directory.
198 If this directory is a
199 .Nm
200 work tree, use the repository path associated with this work tree.
201 .El
202 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
203 Display line-by-line history of a file at the specified path.
204 .Pp
205 The options for
206 .Cm got blame
207 are as follows:
208 .Bl -tag -width Ds
209 .It Fl c Ar commit
210 Start traversing history at the specified
211 .Ar commit .
212 The expected argument is the name of a branch or a SHA1 hash which corresponds
213 to a commit object.
214 .It Fl r Ar repository-path
215 Use the repository at the specified path.
216 If not specified, assume the repository is located at or above the current
217 working directory.
218 If this directory is a
219 .Nm
220 work tree, use the repository path associated with this work tree.
221 .El
222 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
223 Display a listing of files and directories at the specified
224 directory path in the repository.
225 Entries shown in this listing may carry one of the following trailing
226 annotations:
227 .Bl -column YXZ description
228 .It / Ta entry is a directory
229 .It * Ta entry is an executable file
230 .El
231 .Pp
232 If no
233 .Ar path
234 is specified, list the repository path corresponding to the current
235 directory of the work tree, or the root directory of the repository
236 if there is no work tree.
237 .Pp
238 The options for
239 .Cm got tree
240 are as follows:
241 .Bl -tag -width Ds
242 .It Fl c Ar commit
243 List files and directories as they appear in the specified
244 .Ar commit .
245 The expected argument is the name of a branch or a SHA1 hash which corresponds
246 to a commit object.
247 .It Fl r Ar repository-path
248 Use the repository at the specified path.
249 If not specified, assume the repository is located at or above the current
250 working directory.
251 If this directory is a
252 .Nm
253 work tree, use the repository path associated with this work tree.
254 .It Fl i
255 Show object IDs of files (blob objects) and directories (tree objects).
256 .It Fl R
257 Recurse into sub-directories in the repository.
258 .El
259 .It Cm ref [ Fl r Ar repository-path ] [ Fl l ] [ Fl d Ar name ] [ Ar name Ar object ]
260 Manage references in a repository.
261 .Pp
262 If no options are passed, expect two arguments and attempt to create,
263 or update, the reference with the given
264 .Ar name ,
265 and make it point at the given
266 .Ar object .
267 The object argument is a SHA1 hash which corresponds to an existing
268 object in the repository.
269 .Pp
270 The options for
271 .Cm got ref
272 are as follows:
273 .Bl -tag -width Ds
274 .It Fl r Ar repository-path
275 Use the repository at the specified path.
276 If not specified, assume the repository is located at or above the current
277 working directory.
278 If this directory is a
279 .Nm
280 work tree, use the repository path associated with this work tree.
281 .It Fl l
282 List all existing references in the repository.
283 .It Fl d Ar name
284 Delete the reference with the specified name from the repository.
285 .El
286 .El
287 .Sh EXIT STATUS
288 .Ex -std got
289 .Sh EXAMPLES
290 Check out a work tree of
291 .Ox
292 kernel sources from a Git repository at /var/repo/openbsd-src to ~/sys:
293 .Pp
294 .Dl $ got checkout -p sys /var/repo/openbsd-src ~/sys
295 .Sh SEE ALSO
296 .Xr git-repository 5
297 .Xr got-worktree 5
298 .Sh AUTHORS
299 .An Stefan Sperling Aq Mt stsp@openbsd.org
300 .An Martin Pieuchot Aq Mt mpi@openbsd.org