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 c Ar commit ] [ Fl C Ar number ] [ Fl f ] [ 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 Start traversing history at the specified
172 The expected argument is the name of a branch or a SHA1 hash which corresponds
174 If this option is not specified, default to the work tree's current branch
175 if invoked in a work tree, or to the repository's HEAD reference.
177 Set the number of context lines shown in diffs with
179 By default, 3 lines of context are shown.
181 Restrict history traversal to the first parent of each commit.
182 This shows the linear history of the current branch only.
183 Merge commits which affected the current branch will be shown but
184 individual commits which originated on other branches will be omitted.
186 Limit history traversal to a given number of commits.
188 Display the patch of modifications made in each commit.
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
193 If this directory is a
195 work tree, use the repository path associated with this work tree.
197 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 | Ar path ]
198 When invoked within a work tree with less than two arguments, display
199 uncommitted changes in the work tree.
202 is specified, only show changes within this path.
204 If two arguments are provided, treat each argument as a SHA1 hash which
205 corresponds to an object in the repository, and display differences
206 between these objects.
207 Both objects must be of the same type (blobs, trees, or commits).
214 Set the number of context lines shown in the diff.
215 By default, 3 lines of context are shown.
216 .It Fl r Ar repository-path
217 Use the repository at the specified path.
218 If not specified, assume the repository is located at or above the current
220 If this directory is a
222 work tree, use the repository path associated with this work tree.
224 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
225 Display line-by-line history of a file at the specified path.
232 Start traversing history at the specified
234 The expected argument is the name of a branch or a SHA1 hash which corresponds
236 .It Fl r Ar repository-path
237 Use the repository at the specified path.
238 If not specified, assume the repository is located at or above the current
240 If this directory is a
242 work tree, use the repository path associated with this work tree.
244 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
245 Display a listing of files and directories at the specified
246 directory path in the repository.
247 Entries shown in this listing may carry one of the following trailing
249 .Bl -column YXZ description
250 .It / Ta entry is a directory
251 .It * Ta entry is an executable file
256 is specified, list the repository path corresponding to the current
257 directory of the work tree, or the root directory of the repository
258 if there is no work tree.
265 List files and directories as they appear in the specified
267 The expected argument is the name of a branch or a SHA1 hash which corresponds
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
273 If this directory is a
275 work tree, use the repository path associated with this work tree.
277 Show object IDs of files (blob objects) and directories (tree objects).
279 Recurse into sub-directories in the repository.
281 .It Cm ref [ Fl r Ar repository-path ] [ Fl l ] [ Fl d Ar name ] [ Ar name Ar target ]
282 Manage references in a repository.
284 If no options are passed, expect two arguments and attempt to create,
285 or update, the reference with the given
287 and make it point at the given
289 The target may be a SHA1 hash which corresponds to an existing object ID
290 in the repository, or an existing reference which will be resolved to an
297 .It Fl r Ar repository-path
298 Use the repository at the specified path.
299 If not specified, assume the repository is located at or above the current
301 If this directory is a
303 work tree, use the repository path associated with this work tree.
305 List all existing references in the repository.
307 Delete the reference with the specified name from the repository.
309 .It Cm add Ar file-path ...
310 Schedule unversioned files in a work tree for addition to the
311 repository in the next commit.
312 .It Cm rm Ar file-path
313 Remove a versioned file from a work tree and schedule it for deletion
314 from the repository in the next commit.
321 Perform the operation even if the file contains uncommitted modifications.
323 .It Cm revert Ar file-path
324 Revert any uncommited changes in the file at the specified path.
325 File contents will be overwritten with those contained in the
326 work tree's base commit. There is no way to bring discarded
330 If the file was added with
332 it will become an unversioned file again.
333 If the file was deleted with
336 .It Cm commit [ Fl m Ar msg ] [ file-path ]
337 Create a new commit in the repository from local changes in a work tree
338 and use this commit as the new base commit for the work tree.
340 Show the status of each affected file, using the following status codes:
341 .Bl -column YXZ description
342 .It M Ta modified file
343 .It D Ta file was deleted
344 .It A Ta new file was added
347 Files without local changes will retain their previously recorded base
351 commands may refuse to run while the work tree contains files from
352 multiple base commits.
353 The base commit of such a work tree can be made consistent by running
355 across the entire work tree.
361 environment variable to be set.
368 Use the specified log message when creating the new commit.
373 opens a temporary file in an editor where a log message can be written.
377 .Bl -tag -width GOT_AUTHOR
379 The author's name and email address for
382 .An Stefan Sperling Aq Mt stsp@openbsd.org
383 .It Ev VISUAL, Ev EDITOR
384 The editor spawned by
390 Check out a work tree of
392 kernel sources from a Git repository at /var/repo/openbsd-src to ~/sys:
394 .Dl $ got checkout -p sys /var/repo/openbsd-src ~/sys
398 which is forked off the
402 .Dl $ got ref refs/heads/mybranch refs/heads/master
407 .An Stefan Sperling Aq Mt stsp@openbsd.org
408 .An Martin Pieuchot Aq Mt mpi@openbsd.org
409 .An joshua stein Aq Mt jcs@openbsd.org