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