2 .\" Copyright (c) 2017 Martin Pieuchot
3 .\" Copyright (c) 2018, 2019 Stefan Sperling
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.
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.
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 .
38 version control system because every copy of a repository is writeable.
39 Modifications made to files can be synchronized between repositories
44 must be checked out from the repository for modification.
45 Checked out files are stored in a
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
52 provides global and command-specific options.
53 Global options must preceed the command name, and are as follows:
54 .Bl -tag -width tenletters
56 Display usage information.
62 .Bl -tag -width checkout
63 .It Cm checkout [ Fl b Ar branch ] [ 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.
67 is not specified, either use the last component of
71 was specified use the last component of
79 Check out files from the specified
81 If this option is not specified, a branch resolved via the repository's HEAD
82 reference will be used.
84 Check out files from the specified
86 If this option is not specified, the most recent commit on the selected
88 .It Fl p Ar path-prefix
89 Restrict the work tree to a subset of the repository's tree hierarchy.
90 Only files beneath the specified
94 .It Cm update [ Fl b Ar branch ] [ Fl c Ar commit ] [ Ar path ]
95 Update an existing work tree to a different commit.
96 Show the status of each affected file, using the following status codes:
97 .Bl -column YXZ description
98 .It U Ta file was updated and contained no local changes
99 .It G Ta file was updated and local changes were merged cleanly
100 .It C Ta file was updated and conflicts occurred during merge
101 .It D Ta file was deleted
102 .It A Ta new file was added
103 .It ~ Ta versioned file is obstructed by a non-regular file
104 .It ! Ta a missing versioned file was restored
109 is specified, restrict the update operation to files at or within this path.
110 The path is required to exist in the update operation's target commit.
111 Files in the work tree outside this path will remain unchanged and will
112 retain their previously recorded base commit.
115 commands may refuse to run while the work tree contains files from
116 multiple base commits.
117 The base commit of such a work tree can be made consistent by running
119 across the entire work tree.
122 is incompatible with the
131 Switch the work tree's branch reference to the specified
133 before updating the work tree.
134 This option requires that all paths in the work tree are updated.
136 Update the work tree to the specified
138 The expected argument is a SHA1 hash which corresponds to a commit object.
139 If this option is not specified, the most recent commit on the work tree's
142 .It Cm status [ Ar path ]
143 Show the current modification status of files in a work tree,
144 using the following status codes:
145 .Bl -column YXZ description
146 .It M Ta modified file
147 .It A Ta file scheduled for addition in next commit
148 .It D Ta file scheduled for deletion in next commit
149 .It C Ta modified or added file which contains merge conflicts
150 .It ! Ta versioned file was expected on disk but is missing
151 .It ~ Ta versioned file is obstructed by a non-regular file
152 .It ? Ta unversioned item not tracked by
158 is specified, only show modifications within this path.
159 .It Cm log [ Fl b ] [ Fl c Ar commit ] [ Fl C Ar number ] [ Fl l Ar N ] [ Fl p ] [ Fl r Ar repository-path ] [ path ]
160 Display history of a repository.
163 is specified, show only commits which modified this path.
170 Show the linear line of history of the current branch.
171 This option restricts history traversal to the first parent of each commit.
172 Commits which the branch was based on and merge commits which affected the
173 branch will be shown, but individual commits created on parallel branches
176 Start traversing history at the specified
178 The expected argument is the name of a branch or a SHA1 hash which corresponds
180 If this option is not specified, default to the work tree's current branch
181 if invoked in a work tree, or to the repository's HEAD reference.
183 Set the number of context lines shown in diffs with
185 By default, 3 lines of context are shown.
187 Limit history traversal to a given number of commits.
189 Display the patch of modifications made in each commit.
190 .It Fl r Ar repository-path
191 Use the repository at the specified path.
192 If not specified, assume the repository is located at or above the current
194 If this directory is a
196 work tree, use the repository path associated with this work tree.
198 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 | Ar path ]
199 When invoked within a work tree with less than two arguments, display
200 uncommitted changes in the work tree.
203 is specified, only show changes within this path.
205 If two arguments are provided, treat each argument as a SHA1 hash which
206 corresponds to an object in the repository, and display differences
207 between these objects.
208 Both objects must be of the same type (blobs, trees, or commits).
215 Set the number of context lines shown in the diff.
216 By default, 3 lines of context are shown.
217 .It Fl r Ar repository-path
218 Use the repository at the specified path.
219 If not specified, assume the repository is located at or above the current
221 If this directory is a
223 work tree, use the repository path associated with this work tree.
225 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
226 Display line-by-line history of a file at the specified path.
233 Start traversing history at the specified
235 The expected argument is the name of a branch or a SHA1 hash which corresponds
237 .It Fl r Ar repository-path
238 Use the repository at the specified path.
239 If not specified, assume the repository is located at or above the current
241 If this directory is a
243 work tree, use the repository path associated with this work tree.
245 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
246 Display a listing of files and directories at the specified
247 directory path in the repository.
248 Entries shown in this listing may carry one of the following trailing
250 .Bl -column YXZ description
251 .It / Ta entry is a directory
252 .It * Ta entry is an executable file
257 is specified, list the repository path corresponding to the current
258 directory of the work tree, or the root directory of the repository
259 if there is no work tree.
266 List files and directories as they appear in the specified
268 The expected argument is the name of a branch or a SHA1 hash which corresponds
270 .It Fl r Ar repository-path
271 Use the repository at the specified path.
272 If not specified, assume the repository is located at or above the current
274 If this directory is a
276 work tree, use the repository path associated with this work tree.
278 Show object IDs of files (blob objects) and directories (tree objects).
280 Recurse into sub-directories in the repository.
282 .It Cm ref [ Fl r Ar repository-path ] [ Fl l ] [ Fl d Ar name ] [ Ar name Ar target ]
283 Manage references in a repository.
285 If no options are passed, expect two arguments and attempt to create,
286 or update, the reference with the given
288 and make it point at the given
290 The target may be a SHA1 hash which corresponds to an existing object ID
291 in the repository, or an existing reference which will be resolved to an
298 .It Fl r Ar repository-path
299 Use the repository at the specified path.
300 If not specified, assume the repository is located at or above the current
302 If this directory is a
304 work tree, use the repository path associated with this work tree.
306 List all existing references in the repository.
308 Delete the reference with the specified name from the repository.
310 .It Cm add Ar file-path ...
311 Schedule unversioned files in a work tree for addition to the
312 repository in the next commit.
313 .It Cm rm Ar file-path
314 Remove a versioned file from a work tree and schedule it for deletion
315 from the repository in the next commit.
322 Perform the operation even if the file contains uncommitted modifications.
324 .It Cm revert Ar file-path
325 Revert any uncommited changes in the file at the specified path.
326 File contents will be overwritten with those contained in the
327 work tree's base commit. There is no way to bring discarded
331 If the file was added with
333 it will become an unversioned file again.
334 If the file was deleted with
337 .It Cm commit [ Fl m Ar msg ] [ file-path ]
338 Create a new commit in the repository from local changes in a work tree
339 and use this commit as the new base commit for the work tree.
341 Show the status of each affected file, using the following status codes:
342 .Bl -column YXZ description
343 .It M Ta modified file
344 .It D Ta file was deleted
345 .It A Ta new file was added
348 Files without local changes will retain their previously recorded base
352 commands may refuse to run while the work tree contains files from
353 multiple base commits.
354 The base commit of such a work tree can be made consistent by running
356 across the entire work tree.
362 environment variable to be set.
369 Use the specified log message when creating the new commit.
374 opens a temporary file in an editor where a log message can be written.
378 .Bl -tag -width GOT_AUTHOR
380 The author's name and email address for
383 .An Stefan Sperling Aq Mt stsp@openbsd.org
384 .It Ev VISUAL, Ev EDITOR
385 The editor spawned by
391 Check out a work tree of
393 kernel sources from a Git repository at /var/git/openbsd-src to ~/sys:
395 .Dl $ got checkout -p sys /var/git/openbsd-src ~/sys
397 View local changes in a work tree directory:
400 .Dl $ got diff | less
402 Create a new commit from local changes in a work tree directory.
403 This new commit will become the head commit of the work tree's current branch:
407 In a work tree or a git repository directory, view changes committed in
408 the 3 most recent commits to the repository:
410 .Dl $ got log -p -l 3
412 In a work tree or a git repository directory, list all branch references:
414 .Dl $ got ref -l | grep ^refs/heads
416 In a work tree or a git repository directory, view changes committed in
417 the 3 most recent commits to the work tree's branch, or the branch resolved
418 via the repository's HEAD reference, respectively:
420 .Dl $ got log -p -l 3 -b
422 In a work tree or a git repository directory, create a new branch
423 .Dq unified-buffer-cache
424 which is forked off the
428 .Dl $ got ref refs/heads/unified-buffer-cache refs/heads/master
430 Switch an existing work tree to the branch
431 .Dq unified-buffer-cache .
432 Local changes in the work tree will be preserved and merged if necessary:
434 .Dl $ got update -b unified-buffer-cache
436 Add new files and remove obsolete files in a work tree directory:
438 .Dl $ got add uvm/uvm_ubc.c
439 .Dl $ got rm uvm/uvm_vnode.*
441 Create a new commit from local changes in a work tree directory
442 with a pre-defined log message.
444 .Dl $ got commit -m 'unify the buffer cache'
446 Update any work tree checked out from the
447 .Dq unified-buffer-cache
448 branch to the latest commit on this branch:
456 .An Stefan Sperling Aq Mt stsp@openbsd.org
457 .An Martin Pieuchot Aq Mt mpi@openbsd.org
458 .An joshua stein Aq Mt jcs@openbsd.org