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 prioritizes ease of use and simplicity
31 over flexibility.
32 .Pp
33 .Nm
34 stores the history of tracked files in a repository which uses
35 the same on-disk format as
36 .Dq bare
37 repositories used by the Git version control system.
38 This repository format is described in
39 .Xr git-repository 5 .
40 .Pp
41 .Nm
42 is a
43 .Em distributed
44 version control system because every copy of a repository is writeable.
45 Modifications made to files can be synchronized between repositories
46 at any time.
47 .Pp
48 Files managed by
49 .Nm
50 must be checked out from the repository for modification.
51 Checked out files are stored in a
52 .Em work tree
53 which can be placed at an arbitrary directory in the filesystem hierarchy.
54 The on-disk format of a
55 .Nm
56 work tree is described in
57 .Xr got-worktree 5 .
58 .Pp
59 .Nm
60 provides global and command-specific options.
61 Global options must preceed the command name, and are as follows:
62 .Bl -tag -width tenletters
63 .It Fl h
64 Display usage information.
65 .El
66 .Pp
67 The commands for
68 .Nm
69 are as follows:
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.
73 If the
74 .Ar work tree path
75 is not specified, either use the last component of
76 .Ar repository path ,
77 or if a
78 .Ar path prefix
79 was specified use the last component of
80 .Ar path prefix .
81 .Pp
82 The options for
83 .Cm got checkout
84 are as follows:
85 .Bl -tag -width Ds
86 .It Fl c Ar commit
87 Check out files from the specified
88 .Ar commit .
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
94 .Ar path-prefix
95 will be checked out.
96 .El
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.
100 Show the status of each affected file, using the following status codes:
101 .Bl -column YXZ description
102 .It U Ta file was updated and contained no local changes
103 .It G Ta file was updated and local changes were merged cleanly
104 .It C Ta file was updated and conflicts occurred during merge
105 .It D Ta file was deleted
106 .It A Ta new file was added
107 .It ~ Ta versioned file is obstructed by a non-regular file
108 .El
109 .Pp
110 If the
111 .Ar work tree path
112 is omitted, use the current working directory.
113 .Pp
114 .Pp
115 The options for
116 .Cm got update
117 are as follows:
118 .Bl -tag -width Ds
119 .It Fl c Ar commit
120 Update the work tree to the specified
121 .Ar commit .
122 The expected argument is a SHA1 hash which corresponds to a commit object.
123 .El
124 .It Cm status [ Ar worktree-path ]
125 Show the current modification status of files in a worktree,
126 using the following status codes:
127 .Bl -column YXZ description
128 .It M Ta modified file
129 .It ! Ta versioned file was expected on disk but is missing
130 .It ~ Ta versioned file is obstructed by a non-regular file
131 .It ? Ta unversioned item not tracked by
132 .Nm
133 .El
134 .Pp
135 If the
136 .Ar work tree path
137 is omitted, use the current working directory.
138 .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 ]
139 Display history of a repository.
140 If a
141 .Ar path
142 is specified, show only commits which modified this path.
143 .Pp
144 The options for
145 .Cm got log
146 are as follows:
147 .Bl -tag -width Ds
148 .It Fl c Ar commit
149 Start traversing history at the specified
150 .Ar commit .
151 The expected argument is the name of a branch or a SHA1 hash which corresponds
152 to a commit object.
153 .It Fl C Ar number
154 Set the number of context lines shown in diffs with
155 .Fl p .
156 By default, 3 lines of context are shown.
157 .It Fl f
158 Restrict history traversal to the first parent of each commit.
159 This shows the linear history of the current branch only.
160 Merge commits which affected the current branch will be shown but
161 individual commits which originated on other branches will be omitted.
162 .It Fl l Ar N
163 Limit history traversal to a given number of commits.
164 .It Fl p
165 Display the patch of modifications made in each commit.
166 .It Fl r Ar repository-path
167 Use the repository at the specified path.
168 If not specified, assume the repository is located at or above the current
169 working directory.
170 If this directory is a
171 .Nm
172 work tree, use the repository path associated with this work tree.
173 .El
174 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 ]
175 Display differences between blobs in the repository and files in the
176 work tree, or between two specified objects in a repository.
177 If specified, each
178 .Ar object
179 argument is a SHA1 hash which corresponds to the object.
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 If no
221 .Ar path
222 is specified, list the repository path corresponding to the current
223 directory of the work tree, or the root directory of the repository
224 if there is no work tree.
225 .Pp
226 The options for
227 .Cm got tree
228 are as follows:
229 .Bl -tag -width Ds
230 .It Fl c Ar commit
231 List files and directories as they appear in the specified
232 .Ar commit .
233 The expected argument is the name of a branch or a SHA1 hash which corresponds
234 to a commit object.
235 .It Fl r Ar repository-path
236 Use the repository at the specified path.
237 If not specified, assume the repository is located at or above the current
238 working directory.
239 If this directory is a
240 .Nm
241 work tree, use the repository path associated with this work tree.
242 .It Fl i
243 Show object IDs of files (blob objects) and directories (tree objects).
244 .It Fl R
245 Recurse into sub-directories in the repository.
246 .El
247 .Sh EXIT STATUS
248 .Ex -std got
249 .Sh EXAMPLES
250 Check out a work tree of
251 .Ox
252 kernel sources from a Git repository at /var/repo/openbsd-src to ~/sys:
253 .Pp
254 .Dl $ got checkout -p sys /var/repo/openbsd-src ~/sys
255 .Sh SEE ALSO
256 .Xr git-repository 5
257 .Xr got-worktree 5
258 .Sh AUTHORS
259 .An Stefan Sperling Aq Mt stsp@openbsd.org
260 .An Martin Pieuchot Aq Mt mpi@openbsd.org