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.
22 .Nd version control system
30 is a version control system which prioritizes ease of use and simplicity
34 stores the history of tracked files in a repository which uses
35 the same on-disk format as
37 repositories used by the Git version control system.
38 This repository format is described in
39 .Xr git-repository 5 .
44 version control system because every copy of a repository is writeable.
45 Modifications made to files can be synchronized between repositories
50 must be checked out from the repository for modification.
51 Checked out files are stored in a
53 which can be placed at an arbitrary directory in the filesystem hierarchy.
54 The on-disk format of a
56 work tree is described in
60 provides global and command-specific options.
61 Global options must preceed the command name, and are as follows:
62 .Bl -tag -width tenletters
64 Display usage information.
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.
75 is not specified, either use the last component of
79 was specified use the last component of
87 Check out files from the specified
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
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.
102 is omitted, use the current working directory.
109 Update the work tree to the specified
111 The expected argument is a SHA1 hash which corresponds to a commit object.
113 .It Cm status [ Ar worktree-path ]
114 Show the current modification status of files in a worktree,
115 using the following status codes:
116 .Bl -column YXZ description
117 .It M Ta modified file
118 .It ! Ta versioned file was expected on disk but is missing
119 .It ~ Ta versioned file is obstructed by a non-regular file
120 .It ? Ta unversioned item not tracked by
126 is omitted, use the current working directory.
127 .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 ]
128 Display history of a repository.
131 is specified, show only commits which modified this path.
138 Start traversing history at the specified
140 The expected argument is the name of a branch or a SHA1 hash which corresponds
143 Set the number of context lines shown in diffs with
145 By default, 3 lines of context are shown.
147 Restrict history traversal to the first parent of each commit.
148 This shows the linear history of the current branch only.
149 Merge commits which affected the current branch will be shown but
150 individual commits which originated on other branches will be omitted.
152 Limit history traversal to a given number of commits.
154 Display the patch of modifications made in each commit.
155 .It Fl r Ar repository-path
156 Use the repository at the specified path.
157 If not specified, assume the repository is located at or above the current
159 If this directory is a
161 work tree, use the repository path associated with this work tree.
163 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 ]
164 Display differences between blobs in the repository and files in the
165 work tree, or between two specified objects in a repository.
168 argument is a SHA1 hash which corresponds to the object.
169 Both objects must be of the same type (blobs, trees, or commits).
176 Set the number of context lines shown in the diff.
177 By default, 3 lines of context are shown.
178 .It Fl r Ar repository-path
179 Use the repository at the specified path.
180 If not specified, assume the repository is located at or above the current
182 If this directory is a
184 work tree, use the repository path associated with this work tree.
186 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
187 Display line-by-line history of a file at the specified path.
194 Start traversing history at the specified
196 The expected argument is the name of a branch or a SHA1 hash which corresponds
198 .It Fl r Ar repository-path
199 Use the repository at the specified path.
200 If not specified, assume the repository is located at or above the current
202 If this directory is a
204 work tree, use the repository path associated with this work tree.
206 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
207 Display a listing of files and directories at the specified
208 directory path in the repository.
211 is specified, list the repository path corresponding to the current
212 directory of the work tree, or the root directory of the repository
213 if there is no work tree.
220 List files and directories as they appear in the specified
222 The expected argument is the name of a branch or a SHA1 hash which corresponds
224 .It Fl r Ar repository-path
225 Use the repository at the specified path.
226 If not specified, assume the repository is located at or above the current
228 If this directory is a
230 work tree, use the repository path associated with this work tree.
232 Show object IDs of files (blob objects) and directories (tree objects).
234 Recurse into sub-directories in the repository.
239 Check out a work tree of
241 kernel sources from a Git repository at /var/repo/openbsd-src to ~/sys:
243 .Dl $ got checkout -p sys /var/repo/openbsd-src ~/sys
248 .An Stefan Sperling Aq Mt stsp@openbsd.org
249 .An Martin Pieuchot Aq Mt mpi@openbsd.org