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 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 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 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
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
105 is omitted, use the current working directory.
113 Update the work tree to the specified
115 The expected argument is a SHA1 hash which corresponds to a commit object.
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 ! Ta versioned file was expected on disk but is missing
125 .It ~ Ta versioned file is obstructed by a non-regular file
126 .It ? Ta unversioned item not tracked by
132 is specified, only show modifications within this path.
133 .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 ]
134 Display history of a repository.
137 is specified, show only commits which modified this path.
144 Start traversing history at the specified
146 The expected argument is the name of a branch or a SHA1 hash which corresponds
149 Set the number of context lines shown in diffs with
151 By default, 3 lines of context are shown.
153 Restrict history traversal to the first parent of each commit.
154 This shows the linear history of the current branch only.
155 Merge commits which affected the current branch will be shown but
156 individual commits which originated on other branches will be omitted.
158 Limit history traversal to a given number of commits.
160 Display the patch of modifications made in each commit.
161 .It Fl r Ar repository-path
162 Use the repository at the specified path.
163 If not specified, assume the repository is located at or above the current
165 If this directory is a
167 work tree, use the repository path associated with this work tree.
169 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 | Ar path ]
170 When invoked within a work tree with less than two arguments, display
171 uncommitted changes in the work tree.
174 is specified, only show changes within this path.
176 If two arguments are provided, treat each argument as a SHA1 hash which
177 corresponds to an object in the repository, and display differences
178 between these objects.
179 Both objects must be of the same type (blobs, trees, or commits).
186 Set the number of context lines shown in the diff.
187 By default, 3 lines of context are shown.
188 .It Fl r Ar repository-path
189 Use the repository at the specified path.
190 If not specified, assume the repository is located at or above the current
192 If this directory is a
194 work tree, use the repository path associated with this work tree.
196 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
197 Display line-by-line history of a file at the specified path.
204 Start traversing history at the specified
206 The expected argument is the name of a branch or a SHA1 hash which corresponds
208 .It Fl r Ar repository-path
209 Use the repository at the specified path.
210 If not specified, assume the repository is located at or above the current
212 If this directory is a
214 work tree, use the repository path associated with this work tree.
216 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
217 Display a listing of files and directories at the specified
218 directory path in the repository.
219 Entries shown in this listing may carry one of the following trailing
221 .Bl -column YXZ description
222 .It / Ta entry is a directory
223 .It * Ta entry is an executable file
228 is specified, list the repository path corresponding to the current
229 directory of the work tree, or the root directory of the repository
230 if there is no work tree.
237 List files and directories as they appear in the specified
239 The expected argument is the name of a branch or a SHA1 hash which corresponds
241 .It Fl r Ar repository-path
242 Use the repository at the specified path.
243 If not specified, assume the repository is located at or above the current
245 If this directory is a
247 work tree, use the repository path associated with this work tree.
249 Show object IDs of files (blob objects) and directories (tree objects).
251 Recurse into sub-directories in the repository.
253 .It Cm ref [ Fl r Ar repository-path ] [ Fl l ] [ Fl d Ar name ] [ Ar name Ar object ]
254 Manage references in a repository.
256 If no options are passed, expect two arguments and attempt to create,
257 or update, the reference with the given
259 and make it point at the given
261 The object argument is a SHA1 hash which corresponds to an existing
262 object in the repository.
268 .It Fl r Ar repository-path
269 Use the repository at the specified path.
270 If not specified, assume the repository is located at or above the current
272 If this directory is a
274 work tree, use the repository path associated with this work tree.
276 List all existing references in the repository.
278 Delete the reference with the specified name from the repository.
280 .It Cm add Ar file-path
281 Schedule an unversioned file in a work tree for addition to the
282 repository in the next commit.
283 .It Cm rm Ar file-path
284 Remove a versioned file from a work tree and schedule it for deletion
285 from the repository in the next commit.
292 Perform the operation even if the file contains uncommitted modifications.
298 Check out a work tree of
300 kernel sources from a Git repository at /var/repo/openbsd-src to ~/sys:
302 .Dl $ got checkout -p sys /var/repo/openbsd-src ~/sys
307 .An Stefan Sperling Aq Mt stsp@openbsd.org
308 .An Martin Pieuchot Aq Mt mpi@openbsd.org