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