Blob


1 <!DOCTYPE html>
2 <html>
3 <!-- This is an automatically generated file. Do not edit.
4 Copyright (c) 2017 Martin Pieuchot
5 Copyright (c) 2018, 2019 Stefan Sperling
7 Permission to use, copy, modify, and distribute this software for any
8 purpose with or without fee is hereby granted, provided that the above
9 copyright notice and this permission notice appear in all copies.
11 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 -->
19 <head>
20 <meta charset="utf-8"/>
21 <style>
22 table.head, table.foot { width: 100%; }
23 td.head-rtitle, td.foot-os { text-align: right; }
24 td.head-vol { text-align: center; }
25 div.Pp { margin: 1ex 0ex; }
26 div.Nd, div.Bf, div.Op { display: inline; }
27 span.Pa, span.Ad { font-style: italic; }
28 span.Ms { font-weight: bold; }
29 dl.Bl-diag > dt { font-weight: bold; }
30 code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn,
31 code.Cd { font-weight: bold; font-family: inherit; }
32 </style>
33 <title>GOT(1)</title>
34 </head>
35 <body>
36 <table class="head">
37 <tr>
38 <td class="head-ltitle">GOT(1)</td>
39 <td class="head-vol">General Commands Manual</td>
40 <td class="head-rtitle">GOT(1)</td>
41 </tr>
42 </table>
43 <div class="manual-text">
44 <section class="Sh">
45 <h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
46 <code class="Nm">got</code> &#x2014;
47 <div class="Nd">Game of Trees</div>
48 </section>
49 <section class="Sh">
50 <h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
51 <table class="Nm">
52 <tr>
53 <td><code class="Nm">got</code></td>
54 <td><var class="Ar">command</var> [<code class="Fl">-h</code>]
55 [<var class="Ar">arg ...</var>]</td>
56 </tr>
57 </table>
58 </section>
59 <section class="Sh">
60 <h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
61 <code class="Nm">got</code> is a version control system which stores the history
62 of tracked files in a Git repository, as used by the Git version control
63 system. This repository format is described in
64 <a class="Xr">git-repository(5)</a>.
65 <p class="Pp"><code class="Nm">got</code> is a &#x201C;distributed&#x201D;
66 version control system because every copy of a repository is writeable.
67 Modifications made to files can be synchronized between repositories at any
68 time.</p>
69 <p class="Pp">Files managed by <code class="Nm">got</code> must be checked out
70 from the repository for modification. Checked out files are stored in a
71 <i class="Em">work tree</i> which can be placed at an arbitrary directory in
72 the filesystem hierarchy. The on-disk format of this work tree is described
73 in <a class="Xr">got-worktree(5)</a>.</p>
74 <p class="Pp"><code class="Nm">got</code> provides global and command-specific
75 options. Global options must preceed the command name, and are as
76 follows:</p>
77 <dl class="Bl-tag">
78 <dt><a class="permalink" href="#h"><code class="Fl" id="h">-h</code></a></dt>
79 <dd>Display usage information and exit immediately.</dd>
80 <dt><a class="permalink" href="#V"><code class="Fl" id="V">-V</code></a></dt>
81 <dd>Display program version and exit immediately.</dd>
82 </dl>
83 <p class="Pp">The commands for <code class="Nm">got</code> are as follows:</p>
84 <dl class="Bl-tag">
85 <dt><a class="permalink" href="#init"><code class="Cm" id="init">init</code></a>
86 <var class="Ar">repository-path</var></dt>
87 <dd>Create a new empty repository at the specified
88 <var class="Ar">repository-path</var>.
89 <p class="Pp">After <code class="Cm">got init</code>, the
90 <code class="Cm">got import</code> command must be used to populate the
91 empty repository before <code class="Cm">got checkout</code> can be
92 used.</p>
93 </dd>
94 <dt><a class="permalink" href="#in"><code class="Cm" id="in">in</code></a></dt>
95 <dd>Short alias for <code class="Cm">init</code>.</dd>
96 <dt><a class="permalink" href="#import"><code class="Cm" id="import">import</code></a>
97 [<code class="Fl">-b</code> <var class="Ar">branch</var>]
98 [<code class="Fl">-m</code> <var class="Ar">message</var>]
99 [<code class="Fl">-r</code> <var class="Ar">repository-path</var>]
100 [<code class="Fl">-I</code> <var class="Ar">pattern</var>]
101 <var class="Ar">directory</var></dt>
102 <dd>Create an initial commit in a repository from the file hierarchy within
103 the specified <var class="Ar">directory</var>. The created commit will not
104 have any parent commits, i.e. it will be a root commit. Also create a new
105 reference which provides a branch name for the newly created commit. Show
106 the path of each imported file to indicate progress.
107 <p class="Pp">The <code class="Cm">got import</code> command requires the
108 <code class="Ev">GOT_AUTHOR</code> environment variable to be set.</p>
109 <p class="Pp">The options for <code class="Cm">got import</code> are as
110 follows:</p>
111 <dl class="Bl-tag">
112 <dt><a class="permalink" href="#b"><code class="Fl" id="b">-b</code></a>
113 <var class="Ar">branch</var></dt>
114 <dd>Create the specified <var class="Ar">branch</var> instead of creating
115 the default branch &#x201C;master&#x201D;. Use of this option is
116 required if the &#x201C;master&#x201D; branch already exists.</dd>
117 <dt><a class="permalink" href="#m"><code class="Fl" id="m">-m</code></a>
118 <var class="Ar">message</var></dt>
119 <dd>Use the specified log message when creating the new commit. Without
120 the <code class="Fl">-m</code> option, <code class="Cm">got
121 import</code> opens a temporary file in an editor where a log message
122 can be written.</dd>
123 <dt><a class="permalink" href="#r"><code class="Fl" id="r">-r</code></a>
124 <var class="Ar">repository-path</var></dt>
125 <dd>Use the repository at the specified path. If not specified, assume the
126 repository is located at or above the current working directory.</dd>
127 <dt><a class="permalink" href="#I"><code class="Fl" id="I">-I</code></a>
128 <var class="Ar">pattern</var></dt>
129 <dd>Ignore files or directories with a name which matches the specified
130 <var class="Ar">pattern</var>. This option may be specified multiple
131 times to build a list of ignore patterns. The
132 <var class="Ar">pattern</var> follows the globbing rules documented in
133 <a class="Xr">glob(7)</a>.</dd>
134 </dl>
135 </dd>
136 <dt><a class="permalink" href="#im"><code class="Cm" id="im">im</code></a></dt>
137 <dd>Short alias for <code class="Cm">import</code>.</dd>
138 <dt><a class="permalink" href="#checkout"><code class="Cm" id="checkout">checkout</code></a>
139 [<code class="Fl">-b</code> <var class="Ar">branch</var>]
140 [<code class="Fl">-c</code> <var class="Ar">commit</var>]
141 [<code class="Fl">-p</code> <var class="Ar">path-prefix</var>]
142 <var class="Ar">repository-path</var>
143 [<var class="Ar">work-tree-path</var>]</dt>
144 <dd>Copy files from a repository into a new work tree. If the
145 <var class="Ar">work tree path</var> is not specified, either use the last
146 component of <var class="Ar">repository path</var>, or if a
147 <var class="Ar">path prefix</var> was specified use the last component of
148 <var class="Ar">path prefix</var>.
149 <p class="Pp">The options for <code class="Cm">got checkout</code> are as
150 follows:</p>
151 <dl class="Bl-tag">
152 <dt><a class="permalink" href="#b_2"><code class="Fl" id="b_2">-b</code></a>
153 <var class="Ar">branch</var></dt>
154 <dd>Check out files from a commit on the specified
155 <var class="Ar">branch</var>. If this option is not specified, a
156 branch resolved via the repository's HEAD reference will be used.</dd>
157 <dt><a class="permalink" href="#c"><code class="Fl" id="c">-c</code></a>
158 <var class="Ar">commit</var></dt>
159 <dd>Check out files from the specified <var class="Ar">commit</var> on the
160 selected branch. The expected argument is a commit ID SHA1 hash or an
161 existing reference which will be resolved to a commit ID. An
162 abbreviated hash argument will be expanded to a full SHA1 hash
163 automatically, provided the abbreviation is unique. If this option is
164 not specified, the most recent commit on the selected branch will be
165 used.</dd>
166 <dt><a class="permalink" href="#p"><code class="Fl" id="p">-p</code></a>
167 <var class="Ar">path-prefix</var></dt>
168 <dd>Restrict the work tree to a subset of the repository's tree hierarchy.
169 Only files beneath the specified <var class="Ar">path-prefix</var>
170 will be checked out.</dd>
171 </dl>
172 </dd>
173 <dt><a class="permalink" href="#co"><code class="Cm" id="co">co</code></a></dt>
174 <dd>Short alias for <code class="Cm">checkout</code>.</dd>
175 <dt><a class="permalink" href="#update"><code class="Cm" id="update">update</code></a>
176 [<code class="Fl">-b</code> <var class="Ar">branch</var>]
177 [<code class="Fl">-c</code> <var class="Ar">commit</var>]
178 [<var class="Ar">path ...</var>]</dt>
179 <dd>Update an existing work tree to a different commit. Show the status of
180 each affected file, using the following status codes:
181 <table class="Bl-column">
182 <tr>
183 <td>U</td>
184 <td>file was updated and contained no local changes</td>
185 </tr>
186 <tr>
187 <td>G</td>
188 <td>file was updated and local changes were merged cleanly</td>
189 </tr>
190 <tr>
191 <td>C</td>
192 <td>file was updated and conflicts occurred during merge</td>
193 </tr>
194 <tr>
195 <td>D</td>
196 <td>file was deleted</td>
197 </tr>
198 <tr>
199 <td>A</td>
200 <td>new file was added</td>
201 </tr>
202 <tr>
203 <td>~</td>
204 <td>versioned file is obstructed by a non-regular file</td>
205 </tr>
206 <tr>
207 <td>!</td>
208 <td>a missing versioned file was restored</td>
209 </tr>
210 </table>
211 <p class="Pp">If no <var class="Ar">path</var> is specified, update the
212 entire work tree. Otherwise, restrict the update operation to files at
213 or within the specified paths. Each path is required to exist in the
214 update operation's target commit. Files in the work tree outside
215 specified paths will remain unchanged and will retain their previously
216 recorded base commit. Some <code class="Nm">got</code> commands may
217 refuse to run while the work tree contains files from multiple base
218 commits. The base commit of such a work tree can be made consistent by
219 running <code class="Cm">got update</code> across the entire work tree.
220 Specifying a <var class="Ar">path</var> is incompatible with the
221 <code class="Fl">-b</code> option.</p>
222 <p class="Pp"><code class="Cm">got update</code> cannot update paths with
223 staged changes. If changes have been staged with <code class="Cm">got
224 stage</code>, these changes must first be comitted with
225 <code class="Cm">got commit</code> or unstaged with <code class="Cm">got
226 unstage</code>.</p>
227 <p class="Pp">The options for <code class="Cm">got update</code> are as
228 follows:</p>
229 <dl class="Bl-tag">
230 <dt><a class="permalink" href="#b_3"><code class="Fl" id="b_3">-b</code></a>
231 <var class="Ar">branch</var></dt>
232 <dd>Switch the work tree's branch reference to the specified
233 <var class="Ar">branch</var> before updating the work tree. This
234 option requires that all paths in the work tree are updated.</dd>
235 <dt><a class="permalink" href="#c_2"><code class="Fl" id="c_2">-c</code></a>
236 <var class="Ar">commit</var></dt>
237 <dd>Update the work tree to the specified <var class="Ar">commit</var>.
238 The expected argument is a commit ID SHA1 hash or an existing
239 reference which will be resolved to a commit ID. An abbreviated hash
240 argument will be expanded to a full SHA1 hash automatically, provided
241 the abbreviation is unique. If this option is not specified, the most
242 recent commit on the work tree's branch will be used.</dd>
243 </dl>
244 </dd>
245 <dt><a class="permalink" href="#up"><code class="Cm" id="up">up</code></a></dt>
246 <dd>Short alias for <code class="Cm">update</code>.</dd>
247 <dt><a class="permalink" href="#status"><code class="Cm" id="status">status</code></a>
248 [<var class="Ar">path ...</var>]</dt>
249 <dd>Show the current modification status of files in a work tree, using the
250 following status codes:
251 <table class="Bl-column">
252 <tr>
253 <td>M</td>
254 <td>modified file</td>
255 </tr>
256 <tr>
257 <td>A</td>
258 <td>file scheduled for addition in next commit</td>
259 </tr>
260 <tr>
261 <td>D</td>
262 <td>file scheduled for deletion in next commit</td>
263 </tr>
264 <tr>
265 <td>C</td>
266 <td>modified or added file which contains merge conflicts</td>
267 </tr>
268 <tr>
269 <td>!</td>
270 <td>versioned file was expected on disk but is missing</td>
271 </tr>
272 <tr>
273 <td>~</td>
274 <td>versioned file is obstructed by a non-regular file</td>
275 </tr>
276 <tr>
277 <td>?</td>
278 <td>unversioned item not tracked by <code class="Nm">got</code></td>
279 </tr>
280 </table>
281 <p class="Pp">If no <var class="Ar">path</var> is specified, show
282 modifications in the entire work tree. Otherwise, show modifications at
283 or within the specified paths.</p>
284 <p class="Pp">If changes have been staged with <code class="Cm">got
285 stage</code>, staged changes are shown in the second output column,
286 using the following status codes:</p>
287 <table class="Bl-column">
288 <tr>
289 <td>M</td>
290 <td>file modification is staged</td>
291 </tr>
292 <tr>
293 <td>A</td>
294 <td>file addition is staged</td>
295 </tr>
296 <tr>
297 <td>D</td>
298 <td>file deletion is staged</td>
299 </tr>
300 </table>
301 <p class="Pp">If a path has staged changes, modification status of files
302 shown in the first output column is relative to the staged changes:</p>
303 <table class="Bl-column">
304 <tr>
305 <td>MM</td>
306 <td>modified file was modified again after being staged</td>
307 </tr>
308 <tr>
309 <td>MA</td>
310 <td>added file was modified after being staged</td>
311 </tr>
312 </table>
313 </dd>
314 <dt><a class="permalink" href="#st"><code class="Cm" id="st">st</code></a></dt>
315 <dd>Short alias for <code class="Cm">status</code>.</dd>
316 <dt><a class="permalink" href="#log"><code class="Cm" id="log">log</code></a>
317 [<code class="Fl">-c</code> <var class="Ar">commit</var>]
318 [<code class="Fl">-C</code> <var class="Ar">number</var>]
319 [<code class="Fl">-f</code>] [<code class="Fl">-l</code>
320 <var class="Ar">N</var>] [<code class="Fl">-p</code>]
321 [<code class="Fl">-r</code> <var class="Ar">repository-path</var>]
322 [<var class="Ar">path</var>]</dt>
323 <dd>Display history of a repository. If a <var class="Ar">path</var> is
324 specified, show only commits which modified this path.
325 <p class="Pp">The options for <code class="Cm">got log</code> are as
326 follows:</p>
327 <dl class="Bl-tag">
328 <dt><a class="permalink" href="#c_3"><code class="Fl" id="c_3">-c</code></a>
329 <var class="Ar">commit</var></dt>
330 <dd>Start traversing history at the specified
331 <var class="Ar">commit</var>. The expected argument is a commit ID
332 SHA1 hash or an existing reference which will be resolved to a commit
333 ID. An abbreviated hash argument will be expanded to a full SHA1 hash
334 automatically, provided the abbreviation is unique. If this option is
335 not specified, default to the work tree's current branch if invoked in
336 a work tree, or to the repository's HEAD reference.</dd>
337 <dt><a class="permalink" href="#C"><code class="Fl" id="C">-C</code></a>
338 <var class="Ar">number</var></dt>
339 <dd>Set the number of context lines shown in diffs with
340 <code class="Fl">-p</code>. By default, 3 lines of context are
341 shown.</dd>
342 <dt><a class="permalink" href="#f"><code class="Fl" id="f">-f</code></a></dt>
343 <dd>Restrict history traversal to the first parent of each commit. This
344 shows the linear history of the current branch only. Merge commits
345 which affected the current branch will be shown but individual commits
346 which originated on other branches will be omitted.</dd>
347 <dt><a class="permalink" href="#l"><code class="Fl" id="l">-l</code></a>
348 <var class="Ar">N</var></dt>
349 <dd>Limit history traversal to a given number of commits.</dd>
350 <dt><a class="permalink" href="#p_2"><code class="Fl" id="p_2">-p</code></a></dt>
351 <dd>Display the patch of modifications made in each commit.</dd>
352 <dt><a class="permalink" href="#r_2"><code class="Fl" id="r_2">-r</code></a>
353 <var class="Ar">repository-path</var></dt>
354 <dd>Use the repository at the specified path. If not specified, assume the
355 repository is located at or above the current working directory. If
356 this directory is a <code class="Nm">got</code> work tree, use the
357 repository path associated with this work tree.</dd>
358 </dl>
359 </dd>
360 <dt><a class="permalink" href="#diff"><code class="Cm" id="diff">diff</code></a>
361 [<code class="Fl">-C</code> <var class="Ar">number</var>]
362 [<code class="Fl">-r</code> <var class="Ar">repository-path</var>]
363 [<code class="Fl">-s</code>] [<var class="Ar">object1</var>
364 <var class="Ar">object2</var> | <var class="Ar">path</var>]</dt>
365 <dd>When invoked within a work tree with less than two arguments, display
366 uncommitted changes in the work tree. If a <var class="Ar">path</var> is
367 specified, only show changes within this path.
368 <p class="Pp">If two arguments are provided, treat each argument as a
369 reference, or an object ID SHA1 hash, and display differences between
370 these objects. Both objects must be of the same type (blobs, trees, or
371 commits). An abbreviated hash argument will be expanded to a full SHA1
372 hash automatically, provided the abbreviation is unique.</p>
373 <p class="Pp">The options for <code class="Cm">got diff</code> are as
374 follows:</p>
375 <dl class="Bl-tag">
376 <dt><a class="permalink" href="#C_2"><code class="Fl" id="C_2">-C</code></a>
377 <var class="Ar">number</var></dt>
378 <dd>Set the number of context lines shown in the diff. By default, 3 lines
379 of context are shown.</dd>
380 <dt><a class="permalink" href="#r_3"><code class="Fl" id="r_3">-r</code></a>
381 <var class="Ar">repository-path</var></dt>
382 <dd>Use the repository at the specified path. If not specified, assume the
383 repository is located at or above the current working directory. If
384 this directory is a <code class="Nm">got</code> work tree, use the
385 repository path associated with this work tree.</dd>
386 <dt><a class="permalink" href="#s"><code class="Fl" id="s">-s</code></a></dt>
387 <dd>Show changes staged with <code class="Cm">got stage</code> instead of
388 showing local changes. This option is only valid when
389 <code class="Cm">got diff</code> is invoked in a work tree.</dd>
390 </dl>
391 </dd>
392 <dt><a class="permalink" href="#di"><code class="Cm" id="di">di</code></a></dt>
393 <dd>Short alias for <code class="Cm">diff</code>.</dd>
394 <dt><a class="permalink" href="#blame"><code class="Cm" id="blame">blame</code></a>
395 [<code class="Fl">-c</code> <var class="Ar">commit</var>]
396 [<code class="Fl">-r</code> <var class="Ar">repository-path</var>]
397 <var class="Ar">path</var></dt>
398 <dd>Display line-by-line history of a file at the specified path.
399 <p class="Pp">The options for <code class="Cm">got blame</code> are as
400 follows:</p>
401 <dl class="Bl-tag">
402 <dt><a class="permalink" href="#c_4"><code class="Fl" id="c_4">-c</code></a>
403 <var class="Ar">commit</var></dt>
404 <dd>Start traversing history at the specified
405 <var class="Ar">commit</var>. The expected argument is a commit ID
406 SHA1 hash or an existing reference which will be resolved to a commit
407 ID. An abbreviated hash argument will be expanded to a full SHA1 hash
408 automatically, provided the abbreviation is unique.</dd>
409 <dt><a class="permalink" href="#r_4"><code class="Fl" id="r_4">-r</code></a>
410 <var class="Ar">repository-path</var></dt>
411 <dd>Use the repository at the specified path. If not specified, assume the
412 repository is located at or above the current working directory. If
413 this directory is a <code class="Nm">got</code> work tree, use the
414 repository path associated with this work tree.</dd>
415 </dl>
416 </dd>
417 <dt><a class="permalink" href="#bl"><code class="Cm" id="bl">bl</code></a></dt>
418 <dd>Short alias for <code class="Cm">blame</code>.</dd>
419 <dt><a class="permalink" href="#tree"><code class="Cm" id="tree">tree</code></a>
420 [<code class="Fl">-c</code> <var class="Ar">commit</var>]
421 [<code class="Fl">-r</code> <var class="Ar">repository-path</var>]
422 [<code class="Fl">-i</code>] [<code class="Fl">-R]</code>
423 [<var class="Ar">path</var>]</dt>
424 <dd>Display a listing of files and directories at the specified directory path
425 in the repository. Entries shown in this listing may carry one of the
426 following trailing annotations:
427 <table class="Bl-column">
428 <tr>
429 <td>/</td>
430 <td>entry is a directory</td>
431 </tr>
432 <tr>
433 <td>*</td>
434 <td>entry is an executable file</td>
435 </tr>
436 </table>
437 <p class="Pp">If no <var class="Ar">path</var> is specified, list the
438 repository path corresponding to the current directory of the work tree,
439 or the root directory of the repository if there is no work tree.</p>
440 <p class="Pp">The options for <code class="Cm">got tree</code> are as
441 follows:</p>
442 <dl class="Bl-tag">
443 <dt><a class="permalink" href="#c_5"><code class="Fl" id="c_5">-c</code></a>
444 <var class="Ar">commit</var></dt>
445 <dd>List files and directories as they appear in the specified
446 <var class="Ar">commit</var>. The expected argument is a commit ID
447 SHA1 hash or an existing reference which will be resolved to a commit
448 ID. An abbreviated hash argument will be expanded to a full SHA1 hash
449 automatically, provided the abbreviation is unique.</dd>
450 <dt><a class="permalink" href="#r_5"><code class="Fl" id="r_5">-r</code></a>
451 <var class="Ar">repository-path</var></dt>
452 <dd>Use the repository at the specified path. If not specified, assume the
453 repository is located at or above the current working directory. If
454 this directory is a <code class="Nm">got</code> work tree, use the
455 repository path associated with this work tree.</dd>
456 <dt><a class="permalink" href="#i"><code class="Fl" id="i">-i</code></a></dt>
457 <dd>Show object IDs of files (blob objects) and directories (tree
458 objects).</dd>
459 <dt><a class="permalink" href="#R"><code class="Fl" id="R">-R</code></a></dt>
460 <dd>Recurse into sub-directories in the repository.</dd>
461 </dl>
462 </dd>
463 <dt><a class="permalink" href="#tr"><code class="Cm" id="tr">tr</code></a></dt>
464 <dd>Short alias for <code class="Cm">tree</code>.</dd>
465 <dt><a class="permalink" href="#ref"><code class="Cm" id="ref">ref</code></a>
466 [<code class="Fl">-r</code> <var class="Ar">repository-path</var>]
467 [<code class="Fl">-l</code>] [<code class="Fl">-d</code>
468 <var class="Ar">name</var>] [<var class="Ar">name</var>
469 <var class="Ar">target</var>]</dt>
470 <dd>Manage references in a repository.
471 <p class="Pp">If no options are passed, expect two arguments and attempt to
472 create, or update, the reference with the given
473 <var class="Ar">name</var>, and make it point at the given
474 <var class="Ar">target</var>. The target may be an object ID SHA1 hash
475 or an existing reference which will be resolved to an object ID. An
476 abbreviated hash argument will be expanded to a full SHA1 hash
477 automatically, provided the abbreviation is unique.</p>
478 <p class="Pp">The options for <code class="Cm">got ref</code> are as
479 follows:</p>
480 <dl class="Bl-tag">
481 <dt><a class="permalink" href="#r_6"><code class="Fl" id="r_6">-r</code></a>
482 <var class="Ar">repository-path</var></dt>
483 <dd>Use the repository at the specified path. If not specified, assume the
484 repository is located at or above the current working directory. If
485 this directory is a <code class="Nm">got</code> work tree, use the
486 repository path associated with this work tree.</dd>
487 <dt><a class="permalink" href="#l_2"><code class="Fl" id="l_2">-l</code></a></dt>
488 <dd>List all existing references in the repository.</dd>
489 <dt><a class="permalink" href="#d"><code class="Fl" id="d">-d</code></a>
490 <var class="Ar">name</var></dt>
491 <dd>Delete the reference with the specified name from the repository.</dd>
492 </dl>
493 </dd>
494 <dt><a class="permalink" href="#branch"><code class="Cm" id="branch">branch</code></a>
495 [<code class="Fl">-r</code> <var class="Ar">repository-path</var>]
496 [<code class="Fl">-l</code>] [<code class="Fl">-d</code>
497 <var class="Ar">name</var>] [<var class="Ar">name</var>
498 [<var class="Ar">base-branch</var>]]</dt>
499 <dd>Manage branches in a repository.
500 <p class="Pp">Branches are managed via references which live in the
501 &#x201C;refs/heads/&#x201D; reference namespace. The
502 <code class="Cm">got branch</code> command operates on references in
503 this namespace only.</p>
504 <p class="Pp">If no options are passed, expect one or two arguments and
505 attempt to create a branch with the given <var class="Ar">name</var>,
506 and make it point at the given <var class="Ar">base-branch</var>. If no
507 <var class="Ar">base-branch</var> is specified, default to the work
508 tree's current branch if invoked in a work tree, or to the repository's
509 HEAD reference.</p>
510 <p class="Pp">The options for <code class="Cm">got branch</code> are as
511 follows:</p>
512 <dl class="Bl-tag">
513 <dt><a class="permalink" href="#r_7"><code class="Fl" id="r_7">-r</code></a>
514 <var class="Ar">repository-path</var></dt>
515 <dd>Use the repository at the specified path. If not specified, assume the
516 repository is located at or above the current working directory. If
517 this directory is a <code class="Nm">got</code> work tree, use the
518 repository path associated with this work tree.</dd>
519 <dt><a class="permalink" href="#l_3"><code class="Fl" id="l_3">-l</code></a></dt>
520 <dd>List all existing branches in the repository. If invoked in a work
521 tree, the work tree's current branch is shown with one the following
522 annotations:
523 <table class="Bl-column">
524 <tr>
525 <td>*</td>
526 <td>work tree's base commit matches the branch tip</td>
527 </tr>
528 <tr>
529 <td>~</td>
530 <td>work tree's base commit is out-of-date</td>
531 </tr>
532 </table>
533 </dd>
534 <dt><a class="permalink" href="#d_2"><code class="Fl" id="d_2">-d</code></a>
535 <var class="Ar">name</var></dt>
536 <dd>Delete the branch with the specified name from the repository. Only
537 the branch reference is deleted. Any commit, tree, and blob objects
538 belonging to the branch remain in the repository and may be removed
539 separately with Git's garbage collector.</dd>
540 </dl>
541 </dd>
542 <dt><a class="permalink" href="#br"><code class="Cm" id="br">br</code></a></dt>
543 <dd>Short alias for <code class="Cm">branch</code>.</dd>
544 <dt><a class="permalink" href="#add"><code class="Cm" id="add">add</code></a>
545 <var class="Ar">file-path ...</var></dt>
546 <dd>Schedule unversioned files in a work tree for addition to the repository
547 in the next commit.</dd>
548 <dt><a class="permalink" href="#remove"><code class="Cm" id="remove">remove</code></a>
549 <var class="Ar">file-path ...</var></dt>
550 <dd>Remove versioned files from a work tree and schedule them for deletion
551 from the repository in the next commit.
552 <p class="Pp">The options for <code class="Cm">got remove</code> are as
553 follows:</p>
554 <dl class="Bl-tag">
555 <dt><a class="permalink" href="#f_2"><code class="Fl" id="f_2">-f</code></a></dt>
556 <dd>Perform the operation even if a file contains uncommitted
557 modifications.</dd>
558 </dl>
559 </dd>
560 <dt><a class="permalink" href="#rm"><code class="Cm" id="rm">rm</code></a></dt>
561 <dd>Short alias for <code class="Cm">remove</code>.</dd>
562 <dt><a class="permalink" href="#revert"><code class="Cm" id="revert">revert</code></a>
563 <var class="Ar">file-path ...</var></dt>
564 <dd>Revert any uncommited changes in files at the specified paths. File
565 contents will be overwritten with those contained in the work tree's base
566 commit. There is no way to bring discarded changes back after
567 <code class="Cm">got revert</code>!
568 <p class="Pp">If a file was added with <code class="Cm">got add</code> it
569 will become an unversioned file again. If a file was deleted with
570 <code class="Cm">got remove</code> it will be restored.</p>
571 </dd>
572 <dt><a class="permalink" href="#rv"><code class="Cm" id="rv">rv</code></a></dt>
573 <dd>Short alias for <code class="Cm">revert</code>.</dd>
574 <dt><a class="permalink" href="#commit"><code class="Cm" id="commit">commit</code></a>
575 [<code class="Fl">-m</code> <var class="Ar">message</var>]
576 [<var class="Ar">path ...</var>]</dt>
577 <dd>Create a new commit in the repository from changes in a work tree and use
578 this commit as the new base commit for the work tree. If no
579 <var class="Ar">path</var> is specified, commit all changes in the work
580 tree. Otherwise, commit changes at or within the specified paths.
581 <p class="Pp">If changes have been explicitly staged for commit with
582 <code class="Cm">got stage,</code> only commit staged changes and reject
583 any specified paths which have not been staged.</p>
584 <p class="Pp">Show the status of each affected file, using the following
585 status codes:</p>
586 <table class="Bl-column">
587 <tr>
588 <td>M</td>
589 <td>modified file</td>
590 </tr>
591 <tr>
592 <td>D</td>
593 <td>file was deleted</td>
594 </tr>
595 <tr>
596 <td>A</td>
597 <td>new file was added</td>
598 </tr>
599 </table>
600 <p class="Pp">Files which are not part of the new commit will retain their
601 previously recorded base commit. Some <code class="Nm">got</code>
602 commands may refuse to run while the work tree contains files from
603 multiple base commits. The base commit of such a work tree can be made
604 consistent by running <code class="Cm">got update</code> across the
605 entire work tree.</p>
606 <p class="Pp">The <code class="Cm">got commit</code> command requires the
607 <code class="Ev">GOT_AUTHOR</code> environment variable to be set.</p>
608 <p class="Pp">The options for <code class="Cm">got commit</code> are as
609 follows:</p>
610 <dl class="Bl-tag">
611 <dt><a class="permalink" href="#m_2"><code class="Fl" id="m_2">-m</code></a>
612 <var class="Ar">message</var></dt>
613 <dd>Use the specified log message when creating the new commit. Without
614 the <code class="Fl">-m</code> option, <code class="Cm">got
615 commit</code> opens a temporary file in an editor where a log message
616 can be written.</dd>
617 </dl>
618 <p class="Pp"><code class="Cm">got commit</code> will refuse to run if
619 certain preconditions are not met. If the work tree's current branch is
620 not in the &#x201C;refs/heads/&#x201D; reference namespace, new commits
621 may not be created on this branch. Local changes may only be committed
622 if they are based on file content found in the most recent commit on the
623 work tree's branch. If a path is found to be out of date,
624 <code class="Cm">got update</code> must be used first in order to merge
625 local changes with changes made in the repository.</p>
626 </dd>
627 <dt><a class="permalink" href="#ci"><code class="Cm" id="ci">ci</code></a></dt>
628 <dd>Short alias for <code class="Cm">commit</code>.</dd>
629 <dt><a class="permalink" href="#cherrypick"><code class="Cm" id="cherrypick">cherrypick</code></a>
630 <var class="Ar">commit</var></dt>
631 <dd>Merge changes from a single <var class="Ar">commit</var> into the work
632 tree. The specified <var class="Ar">commit</var> must be on a different
633 branch than the work tree's base commit. The expected argument is a
634 reference or a commit ID SHA1 hash. An abbreviated hash argument will be
635 expanded to a full SHA1 hash automatically, provided the abbreviation is
636 unique.
637 <p class="Pp">Show the status of each affected file, using the following
638 status codes:</p>
639 <table class="Bl-column">
640 <tr>
641 <td>G</td>
642 <td>file was merged</td>
643 </tr>
644 <tr>
645 <td>C</td>
646 <td>file was merged and conflicts occurred during merge</td>
647 </tr>
648 <tr>
649 <td>!</td>
650 <td>changes destined for a missing file were not merged</td>
651 </tr>
652 <tr>
653 <td>D</td>
654 <td>file was deleted</td>
655 </tr>
656 <tr>
657 <td>d</td>
658 <td>file's deletion was obstructed by local modifications</td>
659 </tr>
660 <tr>
661 <td>A</td>
662 <td>new file was added</td>
663 </tr>
664 <tr>
665 <td>~</td>
666 <td>changes destined for a non-regular file were not merged</td>
667 </tr>
668 </table>
669 <p class="Pp">The merged changes will appear as local changes in the work
670 tree, which may be viewed with <code class="Cm">got diff</code>, amended
671 manually or with further <code class="Cm">got cherrypick</code> comands,
672 committed with <code class="Cm">got commit</code>, or discarded again
673 with <code class="Cm">got revert</code>.</p>
674 <p class="Pp"><code class="Cm">got cherrypick</code> will refuse to run if
675 certain preconditions are not met. If the work tree contains multiple
676 base commits it must first be updated to a single base commit with
677 <code class="Cm">got update</code>. If the work tree already contains
678 files with merge conflicts, these conflicts must be resolved first.</p>
679 </dd>
680 <dt><a class="permalink" href="#cy"><code class="Cm" id="cy">cy</code></a></dt>
681 <dd>Short alias for <code class="Cm">cherrypick</code>.</dd>
682 <dt><a class="permalink" href="#backout"><code class="Cm" id="backout">backout</code></a>
683 <var class="Ar">commit</var></dt>
684 <dd>Reverse-merge changes from a single <var class="Ar">commit</var> into the
685 work tree. The specified <var class="Ar">commit</var> must be on the same
686 branch as the work tree's base commit. The expected argument is a
687 reference or a commit ID SHA1 hash. An abbreviated hash argument will be
688 expanded to a full SHA1 hash automatically, provided the abbreviation is
689 unique.
690 <p class="Pp">Show the status of each affected file, using the following
691 status codes:</p>
692 <table class="Bl-column">
693 <tr>
694 <td>G</td>
695 <td>file was merged</td>
696 </tr>
697 <tr>
698 <td>C</td>
699 <td>file was merged and conflicts occurred during merge</td>
700 </tr>
701 <tr>
702 <td>!</td>
703 <td>changes destined for a missing file were not merged</td>
704 </tr>
705 <tr>
706 <td>D</td>
707 <td>file was deleted</td>
708 </tr>
709 <tr>
710 <td>d</td>
711 <td>file's deletion was obstructed by local modifications</td>
712 </tr>
713 <tr>
714 <td>A</td>
715 <td>new file was added</td>
716 </tr>
717 <tr>
718 <td>~</td>
719 <td>changes destined for a non-regular file were not merged</td>
720 </tr>
721 </table>
722 <p class="Pp">The reverse-merged changes will appear as local changes in the
723 work tree, which may be viewed with <code class="Cm">got diff</code>,
724 amended manually or with further <code class="Cm">got backout</code>
725 comands, committed with <code class="Cm">got commit</code>, or discarded
726 again with <code class="Cm">got revert</code>.</p>
727 <p class="Pp"><code class="Cm">got backout</code> will refuse to run if
728 certain preconditions are not met. If the work tree contains multiple
729 base commits it must first be updated to a single base commit with
730 <code class="Cm">got update</code>. If the work tree already contains
731 files with merge conflicts, these conflicts must be resolved first.</p>
732 </dd>
733 <dt><a class="permalink" href="#bo"><code class="Cm" id="bo">bo</code></a></dt>
734 <dd>Short alias for <code class="Cm">backout</code>.</dd>
735 <dt><a class="permalink" href="#rebase"><code class="Cm" id="rebase">rebase</code></a>
736 [<code class="Fl">-a</code>] [<code class="Fl">-c]</code>
737 [<var class="Ar">branch</var>]</dt>
738 <dd>Rebase commits on the specified <var class="Ar">branch</var> onto the tip
739 of the current branch of the work tree. The <var class="Ar">branch</var>
740 must share common ancestry with the work tree's current branch. Rebasing
741 begins with the first descendent commit of the youngest common ancestor
742 commit shared by the specified <var class="Ar">branch</var> and the work
743 tree's current branch, and stops once the tip commit of the specified
744 <var class="Ar">branch</var> has been rebased.
745 <p class="Pp">Rebased commits are accumulated on a temporary branch which
746 the work tree will remain switched to throughout the entire rebase
747 operation. Commits on this branch represent the same changes with the
748 same log messages as their counterparts on the original
749 <var class="Ar">branch</var>, but with different commit IDs. Once
750 rebasing has completed successfully, the temporary branch becomes the
751 new version of the specified <var class="Ar">branch</var> and the work
752 tree is automatically switched to it.</p>
753 <p class="Pp">While rebasing commits, show the status of each affected file,
754 using the following status codes:</p>
755 <table class="Bl-column">
756 <tr>
757 <td>G</td>
758 <td>file was merged</td>
759 </tr>
760 <tr>
761 <td>C</td>
762 <td>file was merged and conflicts occurred during merge</td>
763 </tr>
764 <tr>
765 <td>!</td>
766 <td>changes destined for a missing file were not merged</td>
767 </tr>
768 <tr>
769 <td>D</td>
770 <td>file was deleted</td>
771 </tr>
772 <tr>
773 <td>d</td>
774 <td>file's deletion was obstructed by local modifications</td>
775 </tr>
776 <tr>
777 <td>A</td>
778 <td>new file was added</td>
779 </tr>
780 <tr>
781 <td>~</td>
782 <td>changes destined for a non-regular file were not merged</td>
783 </tr>
784 </table>
785 <p class="Pp">If merge conflicts occur the rebase operation is interrupted
786 and may be continued once conflicts have been resolved. Alternatively,
787 the rebase operation may be aborted which will leave
788 <var class="Ar">branch</var> unmodified and the work tree switched back
789 to its original branch.</p>
790 <p class="Pp">If a merge conflict is resolved in a way which renders the
791 merged change into a no-op change, the corresponding commit will be
792 elided when the rebase operation continues.</p>
793 <p class="Pp"><code class="Cm">got rebase</code> will refuse to run if
794 certain preconditions are not met. If the work tree contains multiple
795 base commits it must first be updated to a single base commit with
796 <code class="Cm">got update</code>. If changes have been staged with
797 <code class="Cm">got stage</code>, these changes must first be comitted
798 with <code class="Cm">got commit</code> or unstaged with
799 <code class="Cm">got unstage</code>. If the work tree contains local
800 changes, these changes must first be committed with <code class="Cm">got
801 commit</code> or reverted with <code class="Cm">got revert</code>. If
802 the <var class="Ar">branch</var> contains changes to files outside of
803 the work tree's path prefix, the work tree cannot be used to rebase this
804 branch.</p>
805 <p class="Pp">The <code class="Cm">got update</code> and
806 <code class="Cm">got commit</code> commands will refuse to run while a
807 rebase operation is in progress. Other commands which manipulate the
808 work tree may be used for conflict resolution purposes.</p>
809 <p class="Pp">The options for <code class="Cm">got rebase</code> are as
810 follows:</p>
811 <dl class="Bl-tag">
812 <dt><a class="permalink" href="#a"><code class="Fl" id="a">-a</code></a></dt>
813 <dd>Abort an interrupted rebase operation. If this option is used, no
814 further command-line arguments are allowed.</dd>
815 <dt><a class="permalink" href="#c_6"><code class="Fl" id="c_6">-c</code></a></dt>
816 <dd>Continue an interrupted rebase operation. If this option is used, no
817 further command-line arguments are allowed.</dd>
818 </dl>
819 </dd>
820 <dt><a class="permalink" href="#rb"><code class="Cm" id="rb">rb</code></a></dt>
821 <dd>Short alias for <code class="Cm">rebase</code>.</dd>
822 <dt><a class="permalink" href="#histedit"><code class="Cm" id="histedit">histedit</code></a>
823 [<code class="Fl">-a</code>] [<code class="Fl">-c]</code>
824 [<code class="Fl">-F</code> <var class="Ar">histedit-script</var>]</dt>
825 <dd>Edit commit history between the work tree's current base commit and the
826 tip commit of the work tree's current branch.
827 <p class="Pp">Editing of commit history is controlled via a
828 <var class="Ar">histedit script</var> which can be edited interactively
829 or passed on the command line. The format of the histedit script is
830 line-based. Each line in the script begins with a command name, followed
831 by whitespace and an argument. For most commands, the expected argument
832 is a commit ID SHA1 hash. Any remaining text on the line is ignored.
833 Lines which begin with the &#x2018;#&#x2019; character are ignored
834 entirely.</p>
835 <p class="Pp">The available commands are as follows:</p>
836 <table class="Bl-column">
837 <tr>
838 <td>pick <var class="Ar">commit</var></td>
839 <td>Use the specified commit as it is.</td>
840 </tr>
841 <tr>
842 <td>edit <var class="Ar">commit</var></td>
843 <td>Use the specified commit but once changes have been merged into the
844 work tree interrupt the histedit operation for amending.</td>
845 </tr>
846 <tr>
847 <td>fold <var class="Ar">commit</var></td>
848 <td>Combine the specified commit with the next commit listed further
849 below that will be used.</td>
850 </tr>
851 <tr>
852 <td>drop <var class="Ar">commit</var></td>
853 <td>Remove this commit from the edited history.</td>
854 </tr>
855 <tr>
856 <td>mesg <var class="Ar">log-message</var></td>
857 <td>Use the specified single-line log message for the commit on the
858 previous line. If the log message argument is left empty, open an
859 editor where a new log message can be written.</td>
860 </tr>
861 </table>
862 <p class="Pp">Every commit in the history being edited must be mentioned in
863 the script. Lines may be re-ordered to change the order of commits in
864 the edited history.</p>
865 <p class="Pp">Edited commits are accumulated on a temporary branch which the
866 work tree will remain switched to throughout the entire histedit
867 operation. Once history editing has completed successfully, the
868 temporary branch becomes the new version of the work tree's branch and
869 the work tree is automatically switched to it.</p>
870 <p class="Pp">While merging commits, show the status of each affected file,
871 using the following status codes:</p>
872 <table class="Bl-column">
873 <tr>
874 <td>G</td>
875 <td>file was merged</td>
876 </tr>
877 <tr>
878 <td>C</td>
879 <td>file was merged and conflicts occurred during merge</td>
880 </tr>
881 <tr>
882 <td>!</td>
883 <td>changes destined for a missing file were not merged</td>
884 </tr>
885 <tr>
886 <td>D</td>
887 <td>file was deleted</td>
888 </tr>
889 <tr>
890 <td>d</td>
891 <td>file's deletion was obstructed by local modifications</td>
892 </tr>
893 <tr>
894 <td>A</td>
895 <td>new file was added</td>
896 </tr>
897 <tr>
898 <td>~</td>
899 <td>changes destined for a non-regular file were not merged</td>
900 </tr>
901 </table>
902 <p class="Pp">If merge conflicts occur the histedit operation is interrupted
903 and may be continued once conflicts have been resolved. Alternatively,
904 the histedit operation may be aborted which will leave the work tree
905 switched back to its original branch.</p>
906 <p class="Pp">If a merge conflict is resolved in a way which renders the
907 merged change into a no-op change, the corresponding commit will be
908 elided when the histedit operation continues.</p>
909 <p class="Pp"><code class="Cm">got histedit</code> will refuse to run if
910 certain preconditions are not met. If the work tree's current branch is
911 not in the &#x201C;refs/heads/&#x201D; reference namespace, the history
912 of the branch may not be edited. If the work tree contains multiple base
913 commits it must first be updated to a single base commit with
914 <code class="Cm">got update</code>. If changes have been staged with
915 <code class="Cm">got stage</code>, these changes must first be comitted
916 with <code class="Cm">got commit</code> or unstaged with
917 <code class="Cm">got unstage</code>. If the work tree contains local
918 changes, these changes must first be committed with <code class="Cm">got
919 commit</code> or reverted with <code class="Cm">got revert</code>. If
920 the edited history contains changes to files outside of the work tree's
921 path prefix, the work tree cannot be used to edit the history of this
922 branch.</p>
923 <p class="Pp">The <code class="Cm">got update</code> command will refuse to
924 run while a histedit operation is in progress. Other commands which
925 manipulate the work tree may be used, and the <code class="Cm">got
926 commit</code> command may be used to commit arbitrary changes to the
927 temporary branch while the histedit operation is interrupted.</p>
928 <p class="Pp">The options for <code class="Cm">got histedit</code> are as
929 follows:</p>
930 <dl class="Bl-tag">
931 <dt><a class="permalink" href="#a_2"><code class="Fl" id="a_2">-a</code></a></dt>
932 <dd>Abort an interrupted histedit operation. If this option is used, no
933 further command-line arguments are allowed.</dd>
934 <dt><a class="permalink" href="#c_7"><code class="Fl" id="c_7">-c</code></a></dt>
935 <dd>Continue an interrupted histedit operation. If this option is used, no
936 further command-line arguments are allowed.</dd>
937 </dl>
938 </dd>
939 <dt><a class="permalink" href="#he"><code class="Cm" id="he">he</code></a></dt>
940 <dd>Short alias for <code class="Cm">histedit</code>.</dd>
941 <dt><a class="permalink" href="#stage"><code class="Cm" id="stage">stage</code></a>
942 [<code class="Fl">-l</code>] <var class="Ar">file-path ...</var></dt>
943 <dd>Stage local changes at the specified paths for inclusion in the next
944 commit. Paths may be staged if they are added, modified, or deleted
945 according to <code class="Cm">got status</code>.
946 <p class="Pp">Show the status of each affected file, using the following
947 status codes:</p>
948 <table class="Bl-column">
949 <tr>
950 <td>A</td>
951 <td>file addition has been staged</td>
952 </tr>
953 <tr>
954 <td>M</td>
955 <td>file modification has been staged</td>
956 </tr>
957 <tr>
958 <td>D</td>
959 <td>file deletion has been staged</td>
960 </tr>
961 </table>
962 <p class="Pp">Staged file contents are saved in newly created blob objects
963 in the repository. These blobs will be referred to by tree objects once
964 staged changes have been committed.</p>
965 <p class="Pp">Staged changes affect the behaviour of <code class="Cm">got
966 commit</code>, <code class="Cm">got status</code>, and
967 <code class="Cm">got diff</code>. While paths with staged changes exist,
968 the <code class="Cm">got commit</code> command will refuse to commit any
969 paths which do not have staged changes. Local changes created on top of
970 staged changes can only be committed if the path is staged again, or if
971 the staged changes are committed first. The <code class="Cm">got
972 status</code> command will show both local changes and staged changes.
973 The <code class="Cm">got diff</code> command is able to display local
974 changes relative to staged changes, and to display staged changes
975 relative to the repository. The <code class="Cm">got revert</code>
976 command cannot revert staged changes but may be used to revert local
977 changes relative to staged changes.</p>
978 <p class="Pp">The options for <code class="Cm">got stage</code> are as
979 follows:</p>
980 <dl class="Bl-tag">
981 <dt><a class="permalink" href="#l_4"><code class="Fl" id="l_4">-l</code></a></dt>
982 <dd>Instead of staging new changes, list paths which are already staged,
983 along with the IDs of staged blob objects and stage status codes. If
984 paths were provided in the command line show the staged paths among
985 the specified paths. Otherwise, show all staged paths.</dd>
986 </dl>
987 <p class="Pp"><code class="Cm">got stage</code> will refuse to run if
988 certain preconditions are not met. If a file contains merge conflicts,
989 these conflicts must be resolved first. If a file is found to be out of
990 date relative to the head commit on the work tree's current branch, the
991 file must be updated with <code class="Cm">got update</code> before it
992 can be staged (however, this does not prevent the file from becoming
993 out-of-date at some point after having been staged).</p>
994 <p class="Pp">The <code class="Cm">got update</code>, <code class="Cm">got
995 rebase</code>, and <code class="Cm">got histedit</code> commands will
996 refuse to run while staged changes exist. If staged changes cannot be
997 committed because a staged path is out of date, the path must be
998 unstaged with <code class="Cm">got unstage</code> before it can be
999 updated with <code class="Cm">got update</code>, and may then be staged
1000 again if necessary.</p>
1001 </dd>
1002 <dt><a class="permalink" href="#sg"><code class="Cm" id="sg">sg</code></a></dt>
1003 <dd>Short alias for <code class="Cm">stage</code>.</dd>
1004 <dt><a class="permalink" href="#unstage"><code class="Cm" id="unstage">unstage</code></a>
1005 [<var class="Ar">path ...</var>]</dt>
1006 <dd>Merge staged changes back into the work tree and put affected paths back
1007 into non-staged status. If no <var class="Ar">path</var> is specified,
1008 unstage all staged changes across the entire work tree.
1009 <p class="Pp">Show the status of each affected file, using the following
1010 status codes:</p>
1011 <table class="Bl-column">
1012 <tr>
1013 <td>G</td>
1014 <td>file was unstaged</td>
1015 </tr>
1016 <tr>
1017 <td>C</td>
1018 <td>file was unstaged and conflicts occurred during merge</td>
1019 </tr>
1020 <tr>
1021 <td>!</td>
1022 <td>changes destined for a missing file were not merged</td>
1023 </tr>
1024 <tr>
1025 <td>D</td>
1026 <td>file was staged as deleted and still is deleted</td>
1027 </tr>
1028 <tr>
1029 <td>d</td>
1030 <td>file's deletion was obstructed by local modifications</td>
1031 </tr>
1032 <tr>
1033 <td>~</td>
1034 <td>changes destined for a non-regular file were not merged</td>
1035 </tr>
1036 </table>
1037 </dd>
1038 <dt><a class="permalink" href="#ug"><code class="Cm" id="ug">ug</code></a></dt>
1039 <dd>Short alias for <code class="Cm">unstage</code>.</dd>
1040 </dl>
1041 </section>
1042 <section class="Sh">
1043 <h1 class="Sh" id="ENVIRONMENT"><a class="permalink" href="#ENVIRONMENT">ENVIRONMENT</a></h1>
1044 <dl class="Bl-tag">
1045 <dt><a class="permalink" href="#GOT_AUTHOR"><code class="Ev" id="GOT_AUTHOR">GOT_AUTHOR</code></a></dt>
1046 <dd>The author's name and email address for <code class="Cm">got commit</code>
1047 and <code class="Cm">got import</code>, for example: <span class="An">Flan
1048 Hacker</span>
1049 &lt;<a class="Mt" href="mailto:flan_hacker@openbsd.org">flan_hacker@openbsd.org</a>&gt;</dd>
1050 <dt><a class="permalink" href="#VISUAL,"><code class="Ev" id="VISUAL,">VISUAL,</code></a>
1051 <code class="Ev">EDITOR</code></dt>
1052 <dd>The editor spawned by <code class="Cm">got commit</code>.</dd>
1053 </dl>
1054 </section>
1055 <section class="Sh">
1056 <h1 class="Sh" id="EXIT_STATUS"><a class="permalink" href="#EXIT_STATUS">EXIT
1057 STATUS</a></h1>
1058 The <code class="Nm">got</code> utility exits&#x00A0;0 on success,
1059 and&#x00A0;&gt;0 if an error occurs.
1060 </section>
1061 <section class="Sh">
1062 <h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
1063 Clone an existing Git repository for use with <code class="Nm">got</code>. This
1064 step currently requires <a class="Xr">git(1)</a>:
1065 <p class="Pp"></p>
1066 <div class="Bd Bd-indent"><code class="Li">$ cd /var/git/</code></div>
1067 <div class="Bd Bd-indent"><code class="Li">$ git clone --bare
1068 https://github.com/openbsd/src.git</code></div>
1069 <p class="Pp">Alternatively, for quick and dirty local testing of
1070 <code class="Nm">got</code> a new Git repository could be created and
1071 populated with files, e.g. from a temporary CVS checkout located at
1072 <span class="Pa">/tmp/src</span>:</p>
1073 <p class="Pp"></p>
1074 <div class="Bd Bd-indent"><code class="Li">$ got init
1075 /var/git/src.git</code></div>
1076 <div class="Bd Bd-indent"><code class="Li">$ got import -r /var/git/src.git -I
1077 CVS -I obj /tmp/src</code></div>
1078 <p class="Pp">Check out a work tree from the Git repository to /usr/src:</p>
1079 <p class="Pp"></p>
1080 <div class="Bd Bd-indent"><code class="Li">$ got checkout /var/git/src.git
1081 /usr/src</code></div>
1082 <p class="Pp">View local changes in a work tree directory:</p>
1083 <p class="Pp"></p>
1084 <div class="Bd Bd-indent"><code class="Li">$ got status</code></div>
1085 <div class="Bd Bd-indent"><code class="Li">$ got diff | less</code></div>
1086 <p class="Pp">In a work tree or a git repository directory, list all branch
1087 references:</p>
1088 <p class="Pp"></p>
1089 <div class="Bd Bd-indent"><code class="Li">$ got branch -l</code></div>
1090 <p class="Pp">In a work tree or a git repository directory, create a new branch
1091 called &#x201C;unified-buffer-cache&#x201D; which is forked off the
1092 &#x201C;master&#x201D; branch:</p>
1093 <p class="Pp"></p>
1094 <div class="Bd Bd-indent"><code class="Li">$ got branch unified-buffer-cache
1095 master</code></div>
1096 <p class="Pp">Switch an existing work tree to the branch
1097 &#x201C;unified-buffer-cache&#x201D;. Local changes in the work tree will be
1098 preserved and merged if necessary:</p>
1099 <p class="Pp"></p>
1100 <div class="Bd Bd-indent"><code class="Li">$ got update -b
1101 unified-buffer-cache</code></div>
1102 <p class="Pp">Create a new commit from local changes in a work tree directory.
1103 This new commit will become the head commit of the work tree's current
1104 branch:</p>
1105 <p class="Pp"></p>
1106 <div class="Bd Bd-indent"><code class="Li">$ got commit</code></div>
1107 <p class="Pp">In a work tree or a git repository directory, view changes
1108 committed in the 3 most recent commits to the work tree's branch, or the
1109 branch resolved via the repository's HEAD reference, respectively:</p>
1110 <p class="Pp"></p>
1111 <div class="Bd Bd-indent"><code class="Li">$ got log -p -l 3 -f</code></div>
1112 <p class="Pp">Add new files and remove obsolete files in a work tree
1113 directory:</p>
1114 <p class="Pp"></p>
1115 <div class="Bd Bd-indent"><code class="Li">$ got add
1116 sys/uvm/uvm_ubc.c</code></div>
1117 <div class="Bd Bd-indent"><code class="Li">$ got remove
1118 sys/uvm/uvm_vnode.c</code></div>
1119 <p class="Pp">Create a new commit from local changes in a work tree directory
1120 with a pre-defined log message.</p>
1121 <p class="Pp"></p>
1122 <div class="Bd Bd-indent"><code class="Li">$ got commit -m 'unify the buffer
1123 cache'</code></div>
1124 <p class="Pp">Update any work tree checked out from the
1125 &#x201C;unified-buffer-cache&#x201D; branch to the latest commit on this
1126 branch:</p>
1127 <p class="Pp"></p>
1128 <div class="Bd Bd-indent"><code class="Li">$ got update</code></div>
1129 <p class="Pp">Roll file content on the unified-buffer-cache branch back by one
1130 commit, and then fetch the rolled-back change into the work tree as a local
1131 change to be amended and perhaps committed again:</p>
1132 <p class="Pp"></p>
1133 <div class="Bd Bd-indent"><code class="Li">$ got backout
1134 unified-buffer-cache</code></div>
1135 <div class="Bd Bd-indent"><code class="Li">$ got commit -m 'roll back
1136 previous'</code></div>
1137 <div class="Bd Bd-indent"><code class="Li">$ # now back out the previous backout
1138 :-)</code></div>
1139 <div class="Bd Bd-indent"><code class="Li">$ got backout
1140 unified-buffer-cache</code></div>
1141 <p class="Pp">Fetch new upstream commits into the local repository's master
1142 branch. This step currently requires <a class="Xr">git(1)</a>:</p>
1143 <p class="Pp"></p>
1144 <div class="Bd Bd-indent"><code class="Li">$ cd /var/git/src.git</code></div>
1145 <div class="Bd Bd-indent"><code class="Li">$ git fetch origin
1146 master:master</code></div>
1147 <p class="Pp">Rebase the &#x201C;unified-buffer-cache&#x201D; branch on top of
1148 the new head commit of the &#x201C;master&#x201D; branch.</p>
1149 <p class="Pp"></p>
1150 <div class="Bd Bd-indent"><code class="Li">$ got update -b master</code></div>
1151 <div class="Bd Bd-indent"><code class="Li">$ got rebase
1152 unified-buffer-cache</code></div>
1153 <p class="Pp">Create a patch from all changes on the unified-buffer-cache
1154 branch. The patch can be mailed out for review and applied to OpenBSD's CVS
1155 tree:</p>
1156 <p class="Pp"></p>
1157 <div class="Bd Bd-indent"><code class="Li">$ got diff master
1158 unified-buffer-cache &gt; /tmp/ubc.diff</code></div>
1159 <p class="Pp">Edit the entire commit history of the
1160 &#x201C;unified-buffer-cache&#x201D; branch:</p>
1161 <p class="Pp"></p>
1162 <div class="Bd Bd-indent"><code class="Li">$ got update -b
1163 unified-buffer-cache</code></div>
1164 <div class="Bd Bd-indent"><code class="Li">$ got update -c master</code></div>
1165 <div class="Bd Bd-indent"><code class="Li">$ got histedit</code></div>
1166 <p class="Pp">Additional steps are necessary if local changes need to be pushed
1167 back to the remote repository, which currently requires <code class="Cm">git
1168 fetch</code> and <code class="Cm">git push</code>. Before working against
1169 existing branches in a repository cloned with &#x201C;git clone
1170 --bare&#x201D;, a Git &#x201C;refspec&#x201D; must be configured to map all
1171 references in the remote repository into the &#x201C;refs/remotes&#x201D;
1172 namespace of the local repository. This can achieved by setting Git's
1173 <span class="Pa">remote.origin.fetch</span> configuration variable to the
1174 value &#x201C;+refs/heads/*:refs/remotes/origin/*&#x201D; with the
1175 <code class="Cm">git config</code> command:</p>
1176 <p class="Pp"></p>
1177 <div class="Bd Bd-indent"><code class="Li">$ cd /var/git/repo</code></div>
1178 <div class="Bd Bd-indent"><code class="Li">$ git config remote.origin.fetch
1179 '+refs/heads/*:refs/remotes/origin/*'</code></div>
1180 <p class="Pp">Alternatively, the following <span class="Pa">fetch</span>
1181 configuration item can be added manually to the Git repository's
1182 <span class="Pa">config</span> file:</p>
1183 <p class="Pp"></p>
1184 <div class="Bd Bd-indent"><code class="Li">[remote origin]</code></div>
1185 <div class="Bd Bd-indent"><code class="Li">url = ...</code></div>
1186 <div class="Bd Bd-indent"><code class="Li">fetch =
1187 +refs/heads/*:refs/remotes/origin/*</code></div>
1188 <p class="Pp">This configuration leaves the local repository's
1189 &#x201C;refs/heads&#x201D; namespace free for use by local branches checked
1190 out with <code class="Cm">got checkout</code> and, if needed, created with
1191 <code class="Cm">got branch</code>.</p>
1192 <p class="Pp">Branches in the &#x201C;remotes/origin&#x201D; namespace can be
1193 updated with incoming changes from the remote repository with
1194 <code class="Cm">git fetch</code>:</p>
1195 <p class="Pp"></p>
1196 <div class="Bd Bd-indent"><code class="Li">$ cd /var/git/repo</code></div>
1197 <div class="Bd Bd-indent"><code class="Li">$ git fetch</code></div>
1198 <p class="Pp">Before outgoing changes on the local &#x201C;master&#x201D; branch
1199 can be pushed to the remote repository, the local &#x201C;master&#x201D;
1200 branch must be rebased onto the &#x201C;origin/master&#x201D; branch:</p>
1201 <p class="Pp"></p>
1202 <div class="Bd Bd-indent"><code class="Li">$ got update -b
1203 origin/master</code></div>
1204 <div class="Bd Bd-indent"><code class="Li">$ got rebase master</code></div>
1205 <p class="Pp">Changes on the local &#x201C;master&#x201D; branch can then be
1206 pushed to the remote repository with <code class="Cm">git push</code>:</p>
1207 <p class="Pp"></p>
1208 <div class="Bd Bd-indent"><code class="Li">$ cd /var/git/repo</code></div>
1209 <div class="Bd Bd-indent"><code class="Li">$ git push origin master</code></div>
1210 </section>
1211 <section class="Sh">
1212 <h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
1213 ALSO</a></h1>
1214 <a class="Xr">tog(1)</a>, <a class="Xr">git-repository(5)</a>,
1215 <a class="Xr">got-worktree(5)</a>
1216 </section>
1217 <section class="Sh">
1218 <h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
1219 <span class="An">Stefan Sperling</span>
1220 &lt;<a class="Mt" href="mailto:stsp@openbsd.org">stsp@openbsd.org</a>&gt;
1221 <br/>
1222 <span class="An">Martin Pieuchot</span>
1223 &lt;<a class="Mt" href="mailto:mpi@openbsd.org">mpi@openbsd.org</a>&gt;
1224 <br/>
1225 <span class="An">joshua stein</span>
1226 &lt;<a class="Mt" href="mailto:jcs@openbsd.org">jcs@openbsd.org</a>&gt;
1227 </section>
1228 <section class="Sh">
1229 <h1 class="Sh" id="CAVEATS"><a class="permalink" href="#CAVEATS">CAVEATS</a></h1>
1230 <code class="Nm">got</code> is a work-in-progress and many commands remain to be
1231 implemented. At present, the user has to fall back on <a class="Xr">git(1)</a>
1232 to perform many tasks, in particular tasks related to repository
1233 administration and tasks which require a network connection.
1234 </section>
1235 </div>
1236 <table class="foot">
1237 <tr>
1238 <td class="foot-date">August 6, 2019</td>
1239 <td class="foot-os">OpenBSD 6.5</td>
1240 </tr>
1241 </table>
1242 </body>
1243 </html>