Blob


1 .\"
2 .\" Copyright (c) 2017 Martin Pieuchot
3 .\" Copyright (c) 2018, 2019, 2020 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 Game of Trees
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 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 .
34 .Pp
35 .Nm
36 is a
37 .Dq distributed
38 version control system because every copy of a repository is writeable.
39 Modifications made to files can be synchronized between repositories
40 at any time.
41 .Pp
42 Files managed by
43 .Nm
44 must be checked out from the repository for modification.
45 Checked out files are stored in a
46 .Em work tree
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
49 .Xr got-worktree 5 .
50 .Pp
51 .Nm
52 provides global and command-specific options.
53 Global options must precede the command name, and are as follows:
54 .Bl -tag -width tenletters
55 .It Fl h
56 Display usage information and exit immediately.
57 .It Fl V, -version
58 Display program version and exit immediately.
59 .El
60 .Pp
61 The commands for
62 .Nm
63 are as follows:
64 .Bl -tag -width checkout
65 .It Cm init Ar repository-path
66 Create a new empty repository at the specified
67 .Ar repository-path .
68 .Pp
69 After
70 .Cm got init ,
71 the
72 .Cm got import
73 command must be used to populate the empty repository before
74 .Cm got checkout
75 can be used.
76 .It Cm in
77 Short alias for
78 .Cm init .
79 .It Cm import Oo Fl b Ar branch Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl I Ar pattern Oc Ar directory
80 Create an initial commit in a repository from the file hierarchy
81 within the specified
82 .Ar directory .
83 The created commit will not have any parent commits, i.e. it will be a
84 root commit.
85 Also create a new reference which provides a branch name for the newly
86 created commit.
87 Show the path of each imported file to indicate progress.
88 .Pp
89 The
90 .Cm got import
91 command requires the
92 .Ev GOT_AUTHOR
93 environment variable to be set,
94 unless Git's
95 .Dv user.name
96 and
97 .Dv user.email
98 configuration settings can be obtained from the repository's
99 .Pa .git/config
100 file or from Git's global
101 .Pa ~/.gitconfig
102 configuration file.
103 .Pp
104 The options for
105 .Cm got import
106 are as follows:
107 .Bl -tag -width Ds
108 .It Fl b Ar branch
109 Create the specified
110 .Ar branch
111 instead of creating the default branch
112 .Dq main .
113 Use of this option is required if the
114 .Dq main
115 branch already exists.
116 .It Fl m Ar message
117 Use the specified log message when creating the new commit.
118 Without the
119 .Fl m
120 option,
121 .Cm got import
122 opens a temporary file in an editor where a log message can be written.
123 .It Fl r Ar repository-path
124 Use the repository at the specified path.
125 If not specified, assume the repository is located at or above the current
126 working directory.
127 .It Fl I Ar pattern
128 Ignore files or directories with a name which matches the specified
129 .Ar pattern .
130 This option may be specified multiple times to build a list of ignore patterns.
131 The
132 .Ar pattern
133 follows the globbing rules documented in
134 .Xr glob 7 .
135 .El
136 .It Cm im
137 Short alias for
138 .Cm import .
139 .It Cm clone Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl l Oc Oo Fl m Oc Oo Fl q Oc Oo Fl v Oc Ar repository-URL Op Ar directory
140 Clone a Git repository at the specified
141 .Ar repository-URL
142 into the specified
143 .Ar directory .
144 If no
145 .Ar directory
146 is specified the directory name will be derived from the name of the
147 cloned repository.
148 .Cm got clone
149 will refuse to run if the
150 .Ar directory
151 already exists.
152 .Pp
153 The
154 .Ar repository-URL
155 specifies a protocol scheme, a server hostname, an optional port number
156 separated from the hostname by a colon, and a path to the repository on
157 the server:
158 .Lk scheme://hostname:port/path/to/repository
159 .Pp
160 The following protocol schemes are supported:
161 .Bl -tag -width git+ssh
162 .It git
163 The Git protocol as implemented by the
164 .Xr git-daemon 1
165 server.
166 Use of this protocol is discouraged since it supports neither authentication
167 nor encryption.
168 .It git+ssh
169 The Git protocol wrapped in an authenticated and encrypted
170 .Xr ssh 1
171 tunnel.
172 With this protocol the hostname may contain an embedded username for
173 .Xr ssh 1
174 to use:
175 .Mt user@hostname
176 .It ssh
177 Short alias for git+ssh.
178 .El
179 .Pp
180 Objects in the cloned repository are stored in a pack file which is downloaded
181 from the server.
182 This pack file will then be indexed to facilitate access to the objects stored
183 within.
184 If any objects in the pack file are stored in deltified form, all deltas will
185 be fully resolved in order to compute the ID of such objects.
186 This can take some time.
187 More details about the pack file format are documented in
188 .Xr git-repository 5 .
189 .Pp
190 .Cm got clone
191 creates a remote repository entry in the
192 .Pa config
193 file of the cloned repository to store the
194 .Ar repository-url
195 for future use by
196 .Cm got fetch
197 and
198 .Xr git-fetch 1 .
199 .Pp
200 The options for
201 .Cm got clone
202 are as follows:
203 .Bl -tag -width Ds
204 .It Fl a
205 Fetch all branches from the remote repository.
206 If this option is not specified, a branch resolved via the remote
207 repository's HEAD reference will be fetched.
208 Cannot be used together with the
209 .Fl b
210 option.
211 .It Fl b Ar branch
212 Fetch the specified
213 .Ar branch
214 from the remote repository.
215 This option may be specified multiple times to build a list of branches
216 to fetch.
217 If the branch corresponding to the remote repository's HEAD reference is not
218 in this list, the cloned repository's HEAD reference will be set to the first
219 branch which was fetched.
220 If this option is not specified, a branch resolved via the remote
221 repository's HEAD reference will be fetched.
222 Cannot be used together with the
223 .Fl a
224 option.
225 .It Fl l
226 List branches and tags available for cloning from the remote repository
227 and exit immediately.
228 Cannot be used together with any of the other options except
229 .Fl v .
230 .It Fl m
231 Create the cloned repository as a mirror of the original repository.
232 This is useful if the cloned repository will not be used to store
233 local changes as created by
234 .Cm got commit .
235 .Pp
236 The repository's
237 .Pa config
238 file will be set up with the
239 .Dq mirror
240 option enabled, such that
241 .Cm got fetch
242 or
243 .Xr git-fetch 1
244 will write incoming changes directly to branches in the
245 .Dq refs/heads/
246 reference namespace, rather than to branches in the
247 .Dq refs/remotes/
248 namespace.
249 This avoids the usual requirement of having to run
250 .Cm got rebase
251 after
252 .Cm got fetch
253 in order to make incoming changes appear on branches in the
254 .Dq refs/heads/
255 namespace.
256 But maintaining custom branches with local changes in the cloned
257 repository becomes difficult since local changes are at risk of
258 being discarded whenever incoming changes are fetched.
259 .It Fl q
260 Suppress progress reporting output.
261 The same option will be passed to
262 .Xr ssh 1
263 if applicable.
264 .It Fl v
265 Increase the verbosity of progress reporting output.
266 The same option will be passed to
267 .Xr ssh 1
268 if applicable.
269 Multiple -v options increase the verbosity.
270 The maximum is 3.
271 .El
272 .It Cm cl
273 Short alias for
274 .Cm clone .
275 .It Cm fetch Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl l Oc Oo Fl r Ar repository-path Oc Oo Fl q Oc Oo Fl v Oc Op Ar remote-repository
276 Fetch new changes from a remote repository.
277 If no
278 .Ar remote-repository
279 is specified,
280 .Dq origin
281 will be used.
282 The remote repository's URL is obtained from the corresponding entry in the
283 .Pa config
284 file of the local repository, as created by
285 .Cm got clone .
286 .Pp
287 New changes will be stored in a separate pack file downloaded from the server.
288 Optionally, separate pack files stored in the repository can be combined with
289 .Xr git-repack 1 .
290 .Pp
291 Branch references in the
292 .Dq refs/remotes/
293 reference namespace will be updated to point at the newly fetched commits,
294 and the
295 .Cm got rebase
296 command can then be used to make new changes visible on branches in the
297 .Dq refs/heads/
298 reference namespace, merging incoming changes with local changes as necessary.
299 .Pp
300 However, if the repository is configured as a mirror then all references will
301 be updated as needed to match the corresponding references in the remote
302 repository, including branches in the
303 .Dq refs/heads/
304 reference namespace.
305 If those branches contained local commits, these commits will no longer be
306 reachable via a reference and will therefore be at risk of being discarded
307 by Git's garbage collector.
308 .Pp
309 In any case, existing references in the
310 .Dq refs/tags/
311 namespace will always be changed to match tags contained in the remote
312 repository.
313 .Pp
314 The options for
315 .Cm got fetch
316 are as follows:
317 .Bl -tag -width Ds
318 .It Fl a
319 Fetch all branches from the remote repository.
320 If this option is not specified, a branch resolved via the remote
321 repository's HEAD reference will be fetched.
322 Cannot be used together with the
323 .Fl b
324 option.
325 .It Fl b Ar branch
326 Fetch the specified
327 .Ar branch
328 from the remote repository.
329 This option may be specified multiple times to build a list of branches
330 to fetch.
331 If this option is not specified, a branch resolved via the remote
332 repository's HEAD reference will be fetched.
333 Cannot be used together with the
334 .Fl a
335 option.
336 .It Fl l
337 List branches and tags available for fetching from the remote repository
338 and exit immediately.
339 Cannot be used together with any of the other options except
340 .Fl v
341 and
342 .Fl r .
343 .It Fl r Ar repository-path
344 Use the repository at the specified path.
345 If not specified, assume the repository is located at or above the current
346 working directory.
347 If this directory is a
348 .Nm
349 work tree, use the repository path associated with this work tree.
350 .It Fl q
351 Suppress progress reporting output.
352 The same option will be passed to
353 .Xr ssh 1
354 if applicable.
355 .It Fl v
356 Increase the verbosity of progress reporting output.
357 The same option will be passed to
358 .Xr ssh 1
359 if applicable.
360 Multiple -v options increase the verbosity.
361 The maximum is 3.
362 .El
363 .It Cm fe
364 Short alias for
365 .Cm fetch .
366 .It Cm checkout Oo Fl E Oc Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Oo Fl p Ar path-prefix Oc Ar repository-path Op Ar work-tree-path
367 Copy files from a repository into a new work tree.
368 Show the status of each affected file, using the following status codes:
369 .Bl -column YXZ description
370 .It A Ta new file was added
371 .It E Ta file already exists in work tree's meta-data
372 .El
373 .Pp
374 If the
375 .Ar work tree path
376 is not specified, either use the last component of
377 .Ar repository path ,
378 or if a
379 .Ar path prefix
380 was specified use the last component of
381 .Ar path prefix .
382 .Pp
383 The options for
384 .Cm got checkout
385 are as follows:
386 .Bl -tag -width Ds
387 .It Fl E
388 Proceed with the checkout operation even if the directory at
389 .Ar work-tree-path
390 is not empty.
391 Existing files will be left intact.
392 .It Fl b Ar branch
393 Check out files from a commit on the specified
394 .Ar branch .
395 If this option is not specified, a branch resolved via the repository's HEAD
396 reference will be used.
397 .It Fl c Ar commit
398 Check out files from the specified
399 .Ar commit
400 on the selected branch.
401 The expected argument is a commit ID SHA1 hash or an existing reference
402 or tag name which will be resolved to a commit ID.
403 An abbreviated hash argument will be expanded to a full SHA1 hash
404 automatically, provided the abbreviation is unique.
405 If this option is not specified, the most recent commit on the selected
406 branch will be used.
407 .Pp
408 If the specified
409 .Ar commit
410 is not contained in the selected branch, a different branch which contains
411 this commit must be specified with the
412 .Fl b
413 option.
414 If no such branch is known a new branch must be created for this
415 commit with
416 .Cm got branch
417 before
418 .Cm got checkout
419 can be used.
420 Checking out work trees with an unknown branch is intentionally not supported.
421 .It Fl p Ar path-prefix
422 Restrict the work tree to a subset of the repository's tree hierarchy.
423 Only files beneath the specified
424 .Ar path-prefix
425 will be checked out.
426 .El
427 .It Cm co
428 Short alias for
429 .Cm checkout .
430 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
431 Update an existing work tree to a different commit.
432 Show the status of each affected file, using the following status codes:
433 .Bl -column YXZ description
434 .It U Ta file was updated and contained no local changes
435 .It G Ta file was updated and local changes were merged cleanly
436 .It C Ta file was updated and conflicts occurred during merge
437 .It D Ta file was deleted
438 .It A Ta new file was added
439 .It \(a~ Ta versioned file is obstructed by a non-regular file
440 .It ! Ta a missing versioned file was restored
441 .El
442 .Pp
443 If no
444 .Ar path
445 is specified, update the entire work tree.
446 Otherwise, restrict the update operation to files at or within the
447 specified paths.
448 Each path is required to exist in the update operation's target commit.
449 Files in the work tree outside specified paths will remain unchanged and
450 will retain their previously recorded base commit.
451 Some
452 .Nm
453 commands may refuse to run while the work tree contains files from
454 multiple base commits.
455 The base commit of such a work tree can be made consistent by running
456 .Cm got update
457 across the entire work tree.
458 Specifying a
459 .Ar path
460 is incompatible with the
461 .Fl b
462 option.
463 .Pp
464 .Cm got update
465 cannot update paths with staged changes.
466 If changes have been staged with
467 .Cm got stage ,
468 these changes must first be committed with
469 .Cm got commit
470 or unstaged with
471 .Cm got unstage .
472 .Pp
473 The options for
474 .Cm got update
475 are as follows:
476 .Bl -tag -width Ds
477 .It Fl b Ar branch
478 Switch the work tree's branch reference to the specified
479 .Ar branch
480 before updating the work tree.
481 This option requires that all paths in the work tree are updated.
482 .It Fl c Ar commit
483 Update the work tree to the specified
484 .Ar commit .
485 The expected argument is a commit ID SHA1 hash or an existing reference
486 or tag name which will be resolved to a commit ID.
487 An abbreviated hash argument will be expanded to a full SHA1 hash
488 automatically, provided the abbreviation is unique.
489 If this option is not specified, the most recent commit on the work tree's
490 branch will be used.
491 .El
492 .It Cm up
493 Short alias for
494 .Cm update .
495 .It Cm status Op Ar path ...
496 Show the current modification status of files in a work tree,
497 using the following status codes:
498 .Bl -column YXZ description
499 .It M Ta modified file
500 .It A Ta file scheduled for addition in next commit
501 .It D Ta file scheduled for deletion in next commit
502 .It C Ta modified or added file which contains merge conflicts
503 .It ! Ta versioned file was expected on disk but is missing
504 .It \(a~ Ta versioned file is obstructed by a non-regular file
505 .It ? Ta unversioned item not tracked by
506 .Nm
507 .It m Ta modified file modes (executable bit only)
508 .It N Ta non-existent
509 .Ar path
510 specified on the command line
511 .El
512 .Pp
513 If no
514 .Ar path
515 is specified, show modifications in the entire work tree.
516 Otherwise, show modifications at or within the specified paths.
517 .Pp
518 If changes have been staged with
519 .Cm got stage ,
520 staged changes are shown in the second output column, using the following
521 status codes:
522 .Bl -column YXZ description
523 .It M Ta file modification is staged
524 .It A Ta file addition is staged
525 .It D Ta file deletion is staged
526 .El
527 .Pp
528 Changes created on top of staged changes are indicated in the first column:
529 .Bl -column YXZ description
530 .It MM Ta file was modified after earlier changes have been staged
531 .It MA Ta file was modified after having been staged for addition
532 .El
533 .Pp
534 For compatibility with
535 .Xr cvs 1
536 and
537 .Xr git 1 ,
538 .Cm got status
539 reads
540 .Xr glob 7
541 patterns from
542 .Pa .cvsignore
543 and
544 .Pa .gitignore
545 files in each traversed directory and will not display unversioned files
546 which match these patterns.
547 As an extension to
548 .Xr glob 7
549 matching rules,
550 .Cm got status
551 supports consecutive asterisks,
552 .Dq ** ,
553 which will match an arbitrary amount of directories.
554 Unlike
555 .Xr cvs 1 ,
556 .Cm got status
557 only supports a single ignore pattern per line.
558 Unlike
559 .Xr git 1 ,
560 .Cm got status
561 does not support negated ignore patterns prefixed with
562 .Dq \&! ,
563 and gives no special significance to the location of path component separators,
564 .Dq / ,
565 in a pattern.
566 .It Cm st
567 Short alias for
568 .Cm status .
569 .It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Op Ar path
570 Display history of a repository.
571 If a
572 .Ar path
573 is specified, show only commits which modified this path.
574 If invoked in a work tree, the
575 .Ar path
576 is interpreted relative to the current working directory,
577 and the work tree's path prefix is implicitly prepended.
578 Otherwise, the path is interpreted relative to the repository root.
579 .Pp
580 The options for
581 .Cm got log
582 are as follows:
583 .Bl -tag -width Ds
584 .It Fl b
585 Display individual commits which were merged into the current branch
586 from other branches.
587 By default,
588 .Cm got log
589 shows the linear history of the current branch only.
590 .It Fl c Ar commit
591 Start traversing history at the specified
592 .Ar commit .
593 The expected argument is a commit ID SHA1 hash or an existing reference
594 or tag name which will be resolved to a commit ID.
595 An abbreviated hash argument will be expanded to a full SHA1 hash
596 automatically, provided the abbreviation is unique.
597 If this option is not specified, default to the work tree's current branch
598 if invoked in a work tree, or to the repository's HEAD reference.
599 .It Fl C Ar number
600 Set the number of context lines shown in diffs with
601 .Fl p .
602 By default, 3 lines of context are shown.
603 .It Fl l Ar N
604 Limit history traversal to a given number of commits.
605 If this option is not specified, a default limit value of zero is used,
606 which is treated as an unbounded limit.
607 The
608 .Ev GOT_LOG_DEFAULT_LIMIT
609 environment variable may be set to change this default value.
610 .It Fl p
611 Display the patch of modifications made in each commit.
612 If a
613 .Ar path
614 is specified, only show the patch of modifications at or within this path.
615 .It Fl s Ar search-pattern
616 If specified, show only commits with a log message matched by the extended
617 regular expression
618 .Ar search-pattern .
619 Regular expression syntax is documented in
620 .Xr re_format 7 .
621 .It Fl r Ar repository-path
622 Use the repository at the specified path.
623 If not specified, assume the repository is located at or above the current
624 working directory.
625 If this directory is a
626 .Nm
627 work tree, use the repository path associated with this work tree.
628 .El
629 .It Cm diff Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path
630 When invoked within a work tree with less than two arguments, display
631 uncommitted changes in the work tree.
632 If a
633 .Ar path
634 is specified, only show changes within this path.
635 .Pp
636 If two arguments are provided, treat each argument as a reference, a tag
637 name, or an object ID SHA1 hash, and display differences between the
638 corresponding objects.
639 Both objects must be of the same type (blobs, trees, or commits).
640 An abbreviated hash argument will be expanded to a full SHA1 hash
641 automatically, provided the abbreviation is unique.
642 .Pp
643 The options for
644 .Cm got diff
645 are as follows:
646 .Bl -tag -width Ds
647 .It Fl C Ar number
648 Set the number of context lines shown in the diff.
649 By default, 3 lines of context are shown.
650 .It Fl r Ar repository-path
651 Use the repository at the specified path.
652 If not specified, assume the repository is located at or above the current
653 working directory.
654 If this directory is a
655 .Nm
656 work tree, use the repository path associated with this work tree.
657 .It Fl s
658 Show changes staged with
659 .Cm got stage
660 instead of showing local changes.
661 This option is only valid when
662 .Cm got diff
663 is invoked in a work tree.
664 .It Fl w
665 Ignore whitespace-only changes.
666 .El
667 .It Cm di
668 Short alias for
669 .Cm diff .
670 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
671 Display line-by-line history of a file at the specified path.
672 .Pp
673 The options for
674 .Cm got blame
675 are as follows:
676 .Bl -tag -width Ds
677 .It Fl c Ar commit
678 Start traversing history at the specified
679 .Ar commit .
680 The expected argument is a commit ID SHA1 hash or an existing reference
681 or tag name which will be resolved to a commit ID.
682 An abbreviated hash argument will be expanded to a full SHA1 hash
683 automatically, provided the abbreviation is unique.
684 .It Fl r Ar repository-path
685 Use the repository at the specified path.
686 If not specified, assume the repository is located at or above the current
687 working directory.
688 If this directory is a
689 .Nm
690 work tree, use the repository path associated with this work tree.
691 .El
692 .It Cm bl
693 Short alias for
694 .Cm blame .
695 .It Cm tree Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl i Oc Oo Fl R Oc Op Ar path
696 Display a listing of files and directories at the specified
697 directory path in the repository.
698 Entries shown in this listing may carry one of the following trailing
699 annotations:
700 .Bl -column YXZ description
701 .It @ Ta entry is a symbolic link
702 .It / Ta entry is a directory
703 .It * Ta entry is an executable file
704 .It $ Ta entry is a Git submodule
705 .El
706 .Pp
707 If no
708 .Ar path
709 is specified, list the repository path corresponding to the current
710 directory of the work tree, or the root directory of the repository
711 if there is no work tree.
712 .Pp
713 The options for
714 .Cm got tree
715 are as follows:
716 .Bl -tag -width Ds
717 .It Fl c Ar commit
718 List files and directories as they appear in the specified
719 .Ar commit .
720 The expected argument is a commit ID SHA1 hash or an existing reference
721 or tag name which will be resolved to a commit ID.
722 An abbreviated hash argument will be expanded to a full SHA1 hash
723 automatically, provided the abbreviation is unique.
724 .It Fl r Ar repository-path
725 Use the repository at the specified path.
726 If not specified, assume the repository is located at or above the current
727 working directory.
728 If this directory is a
729 .Nm
730 work tree, use the repository path associated with this work tree.
731 .It Fl i
732 Show object IDs of files (blob objects) and directories (tree objects).
733 .It Fl R
734 Recurse into sub-directories in the repository.
735 .El
736 .It Cm tr
737 Short alias for
738 .Cm tree .
739 .It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Oo Fl s Oc Op Ar name Ar target
740 Manage references in a repository.
741 .Pp
742 If no options are passed, expect two arguments and attempt to create,
743 or update, the reference with the given
744 .Ar name ,
745 and make it point at the given
746 .Ar target .
747 The name must be an absolute reference name, i.e. it must begin with
748 .Dq refs/ .
749 The target may be an object ID SHA1 hash or an existing reference which
750 will be resolved to an object ID.
751 An abbreviated hash argument will be expanded to a full SHA1 hash
752 automatically, provided the abbreviation is unique.
753 .Pp
754 The options for
755 .Cm got ref
756 are as follows:
757 .Bl -tag -width Ds
758 .It Fl r Ar repository-path
759 Use the repository at the specified path.
760 If not specified, assume the repository is located at or above the current
761 working directory.
762 If this directory is a
763 .Nm
764 work tree, use the repository path associated with this work tree.
765 .It Fl l
766 List all existing references in the repository.
767 .It Fl d Ar name
768 Delete the reference with the specified name from the repository.
769 .It Fl s
770 Create a symbolic reference pointing at the specified
771 .Ar target ,
772 which must be an existing reference.
773 Care should be taken not to create loops between references when
774 this option is used.
775 .El
776 .It Cm branch Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Oo Fl n Oc Op Ar name
777 Create, list, or delete branches.
778 .Pp
779 Branches are managed via references which live in the
780 .Dq refs/heads/
781 reference namespace.
782 The
783 .Cm got branch
784 command operates on references in this namespace only.
785 .Pp
786 If invoked in a work tree without any arguments, print the name of the
787 work tree's current branch.
788 .Pp
789 If a
790 .Ar name
791 argument is passed, attempt to create a branch reference with the given name.
792 By default the new branch reference will point at the latest commit on the
793 work tree's current branch if invoked in a work tree, and otherwise to a commit
794 resolved via the repository's HEAD reference.
795 .Pp
796 If invoked in a work tree, once the branch was created successfully
797 switch the work tree's head reference to the newly created branch and
798 update files across the entire work tree, just like
799 .Cm got update -b Ar name
800 would do.
801 Show the status of each affected file, using the following status codes:
802 .Bl -column YXZ description
803 .It U Ta file was updated and contained no local changes
804 .It G Ta file was updated and local changes were merged cleanly
805 .It C Ta file was updated and conflicts occurred during merge
806 .It D Ta file was deleted
807 .It A Ta new file was added
808 .It \(a~ Ta versioned file is obstructed by a non-regular file
809 .It ! Ta a missing versioned file was restored
810 .El
811 .Pp
812 The options for
813 .Cm got branch
814 are as follows:
815 .Bl -tag -width Ds
816 .It Fl c Ar commit
817 Make a newly created branch reference point at the specified
818 .Ar commit .
819 The expected
820 .Ar commit
821 argument is a commit ID SHA1 hash or an existing reference
822 or tag name which will be resolved to a commit ID.
823 .It Fl r Ar repository-path
824 Use the repository at the specified path.
825 If not specified, assume the repository is located at or above the current
826 working directory.
827 If this directory is a
828 .Nm
829 work tree, use the repository path associated with this work tree.
830 .It Fl l
831 List all existing branches in the repository.
832 If invoked in a work tree, the work tree's current branch is shown
833 with one the following annotations:
834 .Bl -column YXZ description
835 .It * Ta work tree's base commit matches the branch tip
836 .It \(a~ Ta work tree's base commit is out-of-date
837 .El
838 .It Fl d Ar name
839 Delete the branch with the specified name from the repository.
840 Only the branch reference is deleted.
841 Any commit, tree, and blob objects belonging to the branch
842 remain in the repository and may be removed separately with
843 Git's garbage collector.
844 .It Fl n
845 Do not switch and update the work tree after creating a new branch.
846 .El
847 .It Cm br
848 Short alias for
849 .Cm branch .
850 .It Cm tag Oo Fl c Ar commit Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Ar name
851 Manage tags in a repository.
852 .Pp
853 Tags are managed via references which live in the
854 .Dq refs/tags/
855 reference namespace.
856 The
857 .Cm got tag
858 command operates on references in this namespace only.
859 References in this namespace point at tag objects which contain a pointer
860 to another object, a tag message, as well as author and timestamp information.
861 .Pp
862 Attempt to create a tag with the given
863 .Ar name ,
864 and make this tag point at the given
865 .Ar commit .
866 If no commit is specified, default to the latest commit on the work tree's
867 current branch if invoked in a work tree, and to a commit resolved via
868 the repository's HEAD reference otherwise.
869 .Pp
870 The options for
871 .Cm got tag
872 are as follows:
873 .Bl -tag -width Ds
874 .It Fl c Ar commit
875 Make the newly created tag reference point at the specified
876 .Ar commit .
877 The expected
878 .Ar commit
879 argument is a commit ID SHA1 hash or an existing reference or tag name which
880 will be resolved to a commit ID.
881 An abbreviated hash argument will be expanded to a full SHA1 hash
882 automatically, provided the abbreviation is unique.
883 .It Fl m Ar message
884 Use the specified tag message when creating the new tag.
885 Without the
886 .Fl m
887 option,
888 .Cm got tag
889 opens a temporary file in an editor where a tag message can be written.
890 .It Fl r Ar repository-path
891 Use the repository at the specified path.
892 If not specified, assume the repository is located at or above the current
893 working directory.
894 If this directory is a
895 .Nm
896 work tree, use the repository path associated with this work tree.
897 .It Fl l
898 List all existing tags in the repository instead of creating a new tag.
899 If this option is used, no other command-line arguments are allowed.
900 .El
901 .Pp
902 By design, the
903 .Cm got tag
904 command will not delete tags or change existing tags.
905 If a tag must be deleted, the
906 .Cm got ref
907 command may be used to delete a tag's reference.
908 This should only be done if the tag has not already been copied to
909 another repository.
910 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
911 Schedule unversioned files in a work tree for addition to the
912 repository in the next commit.
913 .Pp
914 The options for
915 .Cm got add
916 are as follows:
917 .Bl -tag -width Ds
918 .It Fl R
919 Permit recursion into directories.
920 If this option is not specified,
921 .Cm got add
922 will refuse to run if a specified
923 .Ar path
924 is a directory.
925 .It Fl I
926 With -R, add files even if they match a
927 .Cm got status
928 ignore pattern.
929 .El
930 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Ar path ...
931 Remove versioned files from a work tree and schedule them for deletion
932 from the repository in the next commit.
933 .Pp
934 The options for
935 .Cm got remove
936 are as follows:
937 .Bl -tag -width Ds
938 .It Fl f
939 Perform the operation even if a file contains uncommitted modifications.
940 .It Fl k
941 Keep affected files on disk.
942 .It Fl R
943 Permit recursion into directories.
944 If this option is not specified,
945 .Cm got remove
946 will refuse to run if a specified
947 .Ar path
948 is a directory.
949 .El
950 .It Cm rm
951 Short alias for
952 .Cm remove .
953 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
954 Revert any uncommitted changes in files at the specified paths.
955 File contents will be overwritten with those contained in the
956 work tree's base commit.
957 There is no way to bring discarded changes back after
958 .Cm got revert !
959 .Pp
960 If a file was added with
961 .Cm got add
962 it will become an unversioned file again.
963 If a file was deleted with
964 .Cm got remove
965 it will be restored.
966 .Pp
967 The options for
968 .Cm got revert
969 are as follows:
970 .Bl -tag -width Ds
971 .It Fl p
972 Instead of reverting all changes in files, interactively select or reject
973 changes to revert based on
974 .Dq y
975 (revert change),
976 .Dq n
977 (keep change), and
978 .Dq q
979 (quit reverting this file) responses.
980 If a file is in modified status, individual patches derived from the
981 modified file content can be reverted.
982 Files in added or deleted status may only be reverted in their entirety.
983 .It Fl F Ar response-script
984 With the
985 .Fl p
986 option, read
987 .Dq y ,
988 .Dq n ,
989 and
990 .Dq q
991 responses line-by-line from the specified
992 .Ar response-script
993 file instead of prompting interactively.
994 .It Fl R
995 Permit recursion into directories.
996 If this option is not specified,
997 .Cm got revert
998 will refuse to run if a specified
999 .Ar path
1000 is a directory.
1001 .El
1002 .It Cm rv
1003 Short alias for
1004 .Cm revert .
1005 .It Cm commit Oo Fl m Ar message Oc Op Ar path ...
1006 Create a new commit in the repository from changes in a work tree
1007 and use this commit as the new base commit for the work tree.
1008 If no
1009 .Ar path
1010 is specified, commit all changes in the work tree.
1011 Otherwise, commit changes at or within the specified paths.
1012 .Pp
1013 If changes have been explicitly staged for commit with
1014 .Cm got stage ,
1015 only commit staged changes and reject any specified paths which
1016 have not been staged.
1017 .Pp
1018 Show the status of each affected file, using the following status codes:
1019 .Bl -column YXZ description
1020 .It M Ta modified file
1021 .It D Ta file was deleted
1022 .It A Ta new file was added
1023 .It m Ta modified file modes (executable bit only)
1024 .El
1025 .Pp
1026 Files which are not part of the new commit will retain their previously
1027 recorded base commit.
1028 Some
1029 .Nm
1030 commands may refuse to run while the work tree contains files from
1031 multiple base commits.
1032 The base commit of such a work tree can be made consistent by running
1033 .Cm got update
1034 across the entire work tree.
1035 .Pp
1036 The
1037 .Cm got commit
1038 command requires the
1039 .Ev GOT_AUTHOR
1040 environment variable to be set,
1041 unless Git's
1042 .Dv user.name
1043 and
1044 .Dv user.email
1045 configuration settings can be
1046 obtained from the repository's
1047 .Pa .git/config
1048 file or from Git's global
1049 .Pa ~/.gitconfig
1050 configuration file.
1051 .Pp
1052 The options for
1053 .Cm got commit
1054 are as follows:
1055 .Bl -tag -width Ds
1056 .It Fl m Ar message
1057 Use the specified log message when creating the new commit.
1058 Without the
1059 .Fl m
1060 option,
1061 .Cm got commit
1062 opens a temporary file in an editor where a log message can be written.
1063 .El
1064 .Pp
1065 .Cm got commit
1066 will refuse to run if certain preconditions are not met.
1067 If the work tree's current branch is not in the
1068 .Dq refs/heads/
1069 reference namespace, new commits may not be created on this branch.
1070 Local changes may only be committed if they are based on file content
1071 found in the most recent commit on the work tree's branch.
1072 If a path is found to be out of date,
1073 .Cm got update
1074 must be used first in order to merge local changes with changes made
1075 in the repository.
1076 .It Cm ci
1077 Short alias for
1078 .Cm commit .
1079 .It Cm cherrypick Ar commit
1080 Merge changes from a single
1081 .Ar commit
1082 into the work tree.
1083 The specified
1084 .Ar commit
1085 must be on a different branch than the work tree's base commit.
1086 The expected argument is a reference or a commit ID SHA1 hash.
1087 An abbreviated hash argument will be expanded to a full SHA1 hash
1088 automatically, provided the abbreviation is unique.
1089 .Pp
1090 Show the status of each affected file, using the following status codes:
1091 .Bl -column YXZ description
1092 .It G Ta file was merged
1093 .It C Ta file was merged and conflicts occurred during merge
1094 .It ! Ta changes destined for a missing file were not merged
1095 .It D Ta file was deleted
1096 .It d Ta file's deletion was obstructed by local modifications
1097 .It A Ta new file was added
1098 .It \(a~ Ta changes destined for a non-regular file were not merged
1099 .El
1100 .Pp
1101 The merged changes will appear as local changes in the work tree, which
1102 may be viewed with
1103 .Cm got diff ,
1104 amended manually or with further
1105 .Cm got cherrypick
1106 commands,
1107 committed with
1108 .Cm got commit ,
1109 or discarded again with
1110 .Cm got revert .
1111 .Pp
1112 .Cm got cherrypick
1113 will refuse to run if certain preconditions are not met.
1114 If the work tree contains multiple base commits it must first be updated
1115 to a single base commit with
1116 .Cm got update .
1117 If the work tree already contains files with merge conflicts, these
1118 conflicts must be resolved first.
1119 .It Cm cy
1120 Short alias for
1121 .Cm cherrypick .
1122 .It Cm backout Ar commit
1123 Reverse-merge changes from a single
1124 .Ar commit
1125 into the work tree.
1126 The specified
1127 .Ar commit
1128 must be on the same branch as the work tree's base commit.
1129 The expected argument is a reference or a commit ID SHA1 hash.
1130 An abbreviated hash argument will be expanded to a full SHA1 hash
1131 automatically, provided the abbreviation is unique.
1132 .Pp
1133 Show the status of each affected file, using the following status codes:
1134 .Bl -column YXZ description
1135 .It G Ta file was merged
1136 .It C Ta file was merged and conflicts occurred during merge
1137 .It ! Ta changes destined for a missing file were not merged
1138 .It D Ta file was deleted
1139 .It d Ta file's deletion was obstructed by local modifications
1140 .It A Ta new file was added
1141 .It \(a~ Ta changes destined for a non-regular file were not merged
1142 .El
1143 .Pp
1144 The reverse-merged changes will appear as local changes in the work tree,
1145 which may be viewed with
1146 .Cm got diff ,
1147 amended manually or with further
1148 .Cm got backout
1149 commands,
1150 committed with
1151 .Cm got commit ,
1152 or discarded again with
1153 .Cm got revert .
1154 .Pp
1155 .Cm got backout
1156 will refuse to run if certain preconditions are not met.
1157 If the work tree contains multiple base commits it must first be updated
1158 to a single base commit with
1159 .Cm got update .
1160 If the work tree already contains files with merge conflicts, these
1161 conflicts must be resolved first.
1162 .It Cm bo
1163 Short alias for
1164 .Cm backout .
1165 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
1166 Rebase commits on the specified
1167 .Ar branch
1168 onto the tip of the current branch of the work tree.
1169 The
1170 .Ar branch
1171 must share common ancestry with the work tree's current branch.
1172 Rebasing begins with the first descendant commit of the youngest
1173 common ancestor commit shared by the specified
1174 .Ar branch
1175 and the work tree's current branch, and stops once the tip commit
1176 of the specified
1177 .Ar branch
1178 has been rebased.
1179 .Pp
1180 When
1181 .Cm got rebase
1182 is used as intended, the specified
1183 .Ar branch
1184 represents a local commit history and may already contain changes
1185 that are not yet visible in any other repositories.
1186 The work tree's current branch, which must be set with
1187 .Cm got update -b
1188 before starting the
1189 .Cm rebase
1190 operation, represents a branch from a remote repository which shares
1191 a common history with the specified
1192 .Ar branch
1193 but has progressed, and perhaps diverged, due to commits added to the
1194 remote repository.
1195 .Pp
1196 Rebased commits are accumulated on a temporary branch which the work tree
1197 will remain switched to throughout the entire rebase operation.
1198 Commits on this branch represent the same changes with the same log
1199 messages as their counterparts on the original
1200 .Ar branch ,
1201 but with different commit IDs.
1202 Once rebasing has completed successfully, the temporary branch becomes
1203 the new version of the specified
1204 .Ar branch
1205 and the work tree is automatically switched to it.
1206 .Pp
1207 While rebasing commits, show the status of each affected file,
1208 using the following status codes:
1209 .Bl -column YXZ description
1210 .It G Ta file was merged
1211 .It C Ta file was merged and conflicts occurred during merge
1212 .It ! Ta changes destined for a missing file were not merged
1213 .It D Ta file was deleted
1214 .It d Ta file's deletion was obstructed by local modifications
1215 .It A Ta new file was added
1216 .It \(a~ Ta changes destined for a non-regular file were not merged
1217 .El
1218 .Pp
1219 If merge conflicts occur the rebase operation is interrupted and may
1220 be continued once conflicts have been resolved.
1221 Alternatively, the rebase operation may be aborted which will leave
1222 .Ar branch
1223 unmodified and the work tree switched back to its original branch.
1224 .Pp
1225 If a merge conflict is resolved in a way which renders the merged
1226 change into a no-op change, the corresponding commit will be elided
1227 when the rebase operation continues.
1228 .Pp
1229 .Cm got rebase
1230 will refuse to run if certain preconditions are not met.
1231 If the work tree is not yet fully updated to the tip commit of its
1232 branch then the work tree must first be updated with
1233 .Cm got update .
1234 If changes have been staged with
1235 .Cm got stage ,
1236 these changes must first be committed with
1237 .Cm got commit
1238 or unstaged with
1239 .Cm got unstage .
1240 If the work tree contains local changes, these changes must first be
1241 committed with
1242 .Cm got commit
1243 or reverted with
1244 .Cm got revert .
1245 If the
1246 .Ar branch
1247 contains changes to files outside of the work tree's path prefix,
1248 the work tree cannot be used to rebase this branch.
1249 .Pp
1250 The
1251 .Cm got update
1252 and
1253 .Cm got commit
1254 commands will refuse to run while a rebase operation is in progress.
1255 Other commands which manipulate the work tree may be used for
1256 conflict resolution purposes.
1257 .Pp
1258 The options for
1259 .Cm got rebase
1260 are as follows:
1261 .Bl -tag -width Ds
1262 .It Fl a
1263 Abort an interrupted rebase operation.
1264 If this option is used, no other command-line arguments are allowed.
1265 .It Fl c
1266 Continue an interrupted rebase operation.
1267 If this option is used, no other command-line arguments are allowed.
1268 .El
1269 .It Cm rb
1270 Short alias for
1271 .Cm rebase .
1272 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc
1273 Edit commit history between the work tree's current base commit and
1274 the tip commit of the work tree's current branch.
1275 .Pp
1276 Before starting a
1277 .Cm histedit
1278 operation the work tree's current branch must be set with
1279 .Cm got update -b
1280 to the branch which should be edited, unless this branch is already the
1281 current branch of the work tree.
1282 The tip of this branch represents the upper bound (inclusive) of commits
1283 touched by the
1284 .Cm histedit
1285 operation.
1286 .Pp
1287 Furthermore, the work tree's base commit
1288 must be set with
1289 .Cm got update -c
1290 to a point in this branch's commit history where editing should begin.
1291 This commit represents the lower bound (non-inclusive) of commits touched
1292 by the
1293 .Cm histedit
1294 operation.
1295 .Pp
1296 Editing of commit history is controlled via a
1297 .Ar histedit script
1298 which can be written in an editor based on a template, passed on the
1299 command line, or generated with the
1300 .Fl m
1301 option if only log messages need to be edited.
1302 .Pp
1303 The format of the histedit script is line-based.
1304 Each line in the script begins with a command name, followed by
1305 whitespace and an argument.
1306 For most commands, the expected argument is a commit ID SHA1 hash.
1307 Any remaining text on the line is ignored.
1308 Lines which begin with the
1309 .Sq #
1310 character are ignored entirely.
1311 .Pp
1312 The available commands are as follows:
1313 .Bl -column YXZ pick-commit
1314 .It pick Ar commit Ta Use the specified commit as it is.
1315 .It edit Ar commit Ta Use the specified commit but once changes have been
1316 merged into the work tree interrupt the histedit operation for amending.
1317 .It fold Ar commit Ta Combine the specified commit with the next commit
1318 listed further below that will be used.
1319 .It drop Ar commit Ta Remove this commit from the edited history.
1320 .It mesg Ar log-message Ta Use the specified single-line log message for
1321 the commit on the previous line.
1322 If the log message argument is left empty, open an editor where a new
1323 log message can be written.
1324 .El
1325 .Pp
1326 Every commit in the history being edited must be mentioned in the script.
1327 Lines may be re-ordered to change the order of commits in the edited history.
1328 No commit may be listed more than once.
1329 .Pp
1330 Edited commits are accumulated on a temporary branch which the work tree
1331 will remain switched to throughout the entire histedit operation.
1332 Once history editing has completed successfully, the temporary branch becomes
1333 the new version of the work tree's branch and the work tree is automatically
1334 switched to it.
1335 .Pp
1336 While merging commits, show the status of each affected file,
1337 using the following status codes:
1338 .Bl -column YXZ description
1339 .It G Ta file was merged
1340 .It C Ta file was merged and conflicts occurred during merge
1341 .It ! Ta changes destined for a missing file were not merged
1342 .It D Ta file was deleted
1343 .It d Ta file's deletion was obstructed by local modifications
1344 .It A Ta new file was added
1345 .It \(a~ Ta changes destined for a non-regular file were not merged
1346 .El
1347 .Pp
1348 If merge conflicts occur the histedit operation is interrupted and may
1349 be continued once conflicts have been resolved.
1350 Alternatively, the histedit operation may be aborted which will leave
1351 the work tree switched back to its original branch.
1352 .Pp
1353 If a merge conflict is resolved in a way which renders the merged
1354 change into a no-op change, the corresponding commit will be elided
1355 when the histedit operation continues.
1356 .Pp
1357 .Cm got histedit
1358 will refuse to run if certain preconditions are not met.
1359 If the work tree's current branch is not in the
1360 .Dq refs/heads/
1361 reference namespace, the history of the branch may not be edited.
1362 If the work tree contains multiple base commits it must first be updated
1363 to a single base commit with
1364 .Cm got update .
1365 If changes have been staged with
1366 .Cm got stage ,
1367 these changes must first be committed with
1368 .Cm got commit
1369 or unstaged with
1370 .Cm got unstage .
1371 If the work tree contains local changes, these changes must first be
1372 committed with
1373 .Cm got commit
1374 or reverted with
1375 .Cm got revert .
1376 If the edited history contains changes to files outside of the work tree's
1377 path prefix, the work tree cannot be used to edit the history of this branch.
1378 .Pp
1379 The
1380 .Cm got update ,
1381 .Cm got rebase ,
1382 and
1383 .Cm got integrate
1384 commands will refuse to run while a histedit operation is in progress.
1385 Other commands which manipulate the work tree may be used, and the
1386 .Cm got commit
1387 command may be used to commit arbitrary changes to the temporary branch
1388 while the histedit operation is interrupted.
1389 .Pp
1390 The options for
1391 .Cm got histedit
1392 are as follows:
1393 .Bl -tag -width Ds
1394 .It Fl a
1395 Abort an interrupted histedit operation.
1396 If this option is used, no other command-line arguments are allowed.
1397 .It Fl c
1398 Continue an interrupted histedit operation.
1399 If this option is used, no other command-line arguments are allowed.
1400 .It Fl F Ar histedit-script
1401 Use the specified
1402 .Ar histedit-script
1403 instead of opening a temporary file in an editor where a histedit script
1404 can be written.
1405 .It Fl m
1406 Edit log messages only.
1407 This option is a quick equivalent to a histedit script which edits
1408 only log messages but otherwise leaves every picked commit as-is.
1409 The
1410 .Fl m
1411 option can only be used when starting a new histedit operation.
1412 If this option is used, no other command-line arguments are allowed.
1413 .El
1414 .It Cm he
1415 Short alias for
1416 .Cm histedit .
1417 .It Cm integrate Ar branch
1418 Integrate the specified
1419 .Ar branch
1420 into the work tree's current branch.
1421 Files in the work tree are updated to match the contents on the integrated
1422 .Ar branch ,
1423 and the reference of the work tree's branch is changed to point at the
1424 head commit of the integrated
1425 .Ar branch .
1426 .Pp
1427 Both branches can be considered equivalent after integration since they
1428 will be pointing at the same commit.
1429 Both branches remain available for future work, if desired.
1430 In case the integrated
1431 .Ar branch
1432 is no longer needed it may be deleted with
1433 .Cm got branch -d .
1434 .Pp
1435 Show the status of each affected file, using the following status codes:
1436 .Bl -column YXZ description
1437 .It U Ta file was updated
1438 .It D Ta file was deleted
1439 .It A Ta new file was added
1440 .It \(a~ Ta versioned file is obstructed by a non-regular file
1441 .It ! Ta a missing versioned file was restored
1442 .El
1443 .Pp
1444 .Cm got integrate
1445 will refuse to run if certain preconditions are not met.
1446 Most importantly, the
1447 .Ar branch
1448 must have been rebased onto the work tree's current branch with
1449 .Cm got rebase
1450 before it can be integrated, in order to linearize commit history and
1451 resolve merge conflicts.
1452 If the work tree contains multiple base commits it must first be updated
1453 to a single base commit with
1454 .Cm got update .
1455 If changes have been staged with
1456 .Cm got stage ,
1457 these changes must first be committed with
1458 .Cm got commit
1459 or unstaged with
1460 .Cm got unstage .
1461 If the work tree contains local changes, these changes must first be
1462 committed with
1463 .Cm got commit
1464 or reverted with
1465 .Cm got revert .
1466 .It Cm ig
1467 Short alias for
1468 .Cm integrate .
1469 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1470 Stage local changes for inclusion in the next commit.
1471 If no
1472 .Ar path
1473 is specified, stage all changes in the work tree.
1474 Otherwise, stage changes at or within the specified paths.
1475 Paths may be staged if they are added, modified, or deleted according to
1476 .Cm got status .
1477 .Pp
1478 Show the status of each affected file, using the following status codes:
1479 .Bl -column YXZ description
1480 .It A Ta file addition has been staged
1481 .It M Ta file modification has been staged
1482 .It D Ta file deletion has been staged
1483 .El
1484 .Pp
1485 Staged file contents are saved in newly created blob objects in the repository.
1486 These blobs will be referred to by tree objects once staged changes have been
1487 committed.
1488 .Pp
1489 Staged changes affect the behaviour of
1490 .Cm got commit ,
1491 .Cm got status ,
1492 and
1493 .Cm got diff .
1494 While paths with staged changes exist, the
1495 .Cm got commit
1496 command will refuse to commit any paths which do not have staged changes.
1497 Local changes created on top of staged changes can only be committed if
1498 the path is staged again, or if the staged changes are committed first.
1499 The
1500 .Cm got status
1501 command will show both local changes and staged changes.
1502 The
1503 .Cm got diff
1504 command is able to display local changes relative to staged changes,
1505 and to display staged changes relative to the repository.
1506 The
1507 .Cm got revert
1508 command cannot revert staged changes but may be used to revert
1509 local changes created on top of staged changes.
1510 .Pp
1511 The options for
1512 .Cm got stage
1513 are as follows:
1514 .Bl -tag -width Ds
1515 .It Fl l
1516 Instead of staging new changes, list paths which are already staged,
1517 along with the IDs of staged blob objects and stage status codes.
1518 If paths were provided in the command line show the staged paths
1519 among the specified paths.
1520 Otherwise, show all staged paths.
1521 .It Fl p
1522 Instead of staging the entire content of a changed file, interactively
1523 select or reject changes for staging based on
1524 .Dq y
1525 (stage change),
1526 .Dq n
1527 (reject change), and
1528 .Dq q
1529 (quit staging this file) responses.
1530 If a file is in modified status, individual patches derived from the
1531 modified file content can be staged.
1532 Files in added or deleted status may only be staged or rejected in
1533 their entirety.
1534 .It Fl F Ar response-script
1535 With the
1536 .Fl p
1537 option, read
1538 .Dq y ,
1539 .Dq n ,
1540 and
1541 .Dq q
1542 responses line-by-line from the specified
1543 .Ar response-script
1544 file instead of prompting interactively.
1545 .El
1546 .Pp
1547 .Cm got stage
1548 will refuse to run if certain preconditions are not met.
1549 If a file contains merge conflicts, these conflicts must be resolved first.
1550 If a file is found to be out of date relative to the head commit on the
1551 work tree's current branch, the file must be updated with
1552 .Cm got update
1553 before it can be staged (however, this does not prevent the file from
1554 becoming out-of-date at some point after having been staged).
1555 .Pp
1556 The
1557 .Cm got update ,
1558 .Cm got rebase ,
1559 and
1560 .Cm got histedit
1561 commands will refuse to run while staged changes exist.
1562 If staged changes cannot be committed because a staged path
1563 is out of date, the path must be unstaged with
1564 .Cm got unstage
1565 before it can be updated with
1566 .Cm got update ,
1567 and may then be staged again if necessary.
1568 .It Cm sg
1569 Short alias for
1570 .Cm stage .
1571 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1572 Merge staged changes back into the work tree and put affected paths
1573 back into non-staged status.
1574 If no
1575 .Ar path
1576 is specified, unstage all staged changes across the entire work tree.
1577 Otherwise, unstage changes at or within the specified paths.
1578 .Pp
1579 Show the status of each affected file, using the following status codes:
1580 .Bl -column YXZ description
1581 .It G Ta file was unstaged
1582 .It C Ta file was unstaged and conflicts occurred during merge
1583 .It ! Ta changes destined for a missing file were not merged
1584 .It D Ta file was staged as deleted and still is deleted
1585 .It d Ta file's deletion was obstructed by local modifications
1586 .It \(a~ Ta changes destined for a non-regular file were not merged
1587 .El
1588 .Pp
1589 The options for
1590 .Cm got unstage
1591 are as follows:
1592 .Bl -tag -width Ds
1593 .It Fl p
1594 Instead of unstaging the entire content of a changed file, interactively
1595 select or reject changes for unstaging based on
1596 .Dq y
1597 (unstage change),
1598 .Dq n
1599 (keep change staged), and
1600 .Dq q
1601 (quit unstaging this file) responses.
1602 If a file is staged in modified status, individual patches derived from the
1603 staged file content can be unstaged.
1604 Files staged in added or deleted status may only be unstaged in their entirety.
1605 .It Fl F Ar response-script
1606 With the
1607 .Fl p
1608 option, read
1609 .Dq y ,
1610 .Dq n ,
1611 and
1612 .Dq q
1613 responses line-by-line from the specified
1614 .Ar response-script
1615 file instead of prompting interactively.
1616 .El
1617 .It Cm ug
1618 Short alias for
1619 .Cm unstage .
1620 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1621 Parse and print contents of objects to standard output in a line-based
1622 text format.
1623 Content of commit, tree, and tag objects is printed in a way similar
1624 to the actual content stored in such objects.
1625 Blob object contents are printed as they would appear in files on disk.
1626 .Pp
1627 Attempt to interpret each argument as a reference, a tag name, or
1628 an object ID SHA1 hash.
1629 References will be resolved to an object ID.
1630 Tag names will resolved to a tag object.
1631 An abbreviated hash argument will be expanded to a full SHA1 hash
1632 automatically, provided the abbreviation is unique.
1633 .Pp
1634 If none of the above interpretations produce a valid result, or if the
1635 .Fl P
1636 option is used, attempt to interpret the argument as a path which will
1637 be resolved to the ID of an object found at this path in the repository.
1638 .Pp
1639 The options for
1640 .Cm got cat
1641 are as follows:
1642 .Bl -tag -width Ds
1643 .It Fl c Ar commit
1644 Look up paths in the specified
1645 .Ar commit .
1646 If this option is not used, paths are looked up in the commit resolved
1647 via the repository's HEAD reference.
1648 The expected argument is a commit ID SHA1 hash or an existing reference
1649 or tag name which will be resolved to a commit ID.
1650 An abbreviated hash argument will be expanded to a full SHA1 hash
1651 automatically, provided the abbreviation is unique.
1652 .It Fl r Ar repository-path
1653 Use the repository at the specified path.
1654 If not specified, assume the repository is located at or above the current
1655 working directory.
1656 If this directory is a
1657 .Nm
1658 work tree, use the repository path associated with this work tree.
1659 .It Fl P
1660 Interpret all arguments as paths only.
1661 This option can be used to resolve ambiguity in cases where paths
1662 look like tag names, reference names, or object IDs.
1663 .El
1664 .El
1665 .Sh ENVIRONMENT
1666 .Bl -tag -width GOT_AUTHOR
1667 .It Ev GOT_AUTHOR
1668 The author's name and email address for
1669 .Cm got commit
1670 and
1671 .Cm got import ,
1672 for example:
1673 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1674 Because
1675 .Xr git 1
1676 may fail to parse commits without an email address in author data,
1677 .Nm
1678 attempts to reject
1679 .Ev GOT_AUTHOR
1680 environment variables with a missing email address.
1681 .Pp
1682 If present, Git's
1683 .Dv user.name
1684 and
1685 .Dv user.email
1686 configuration settings in the repository's
1687 .Pa .git/config
1688 file will override the value of
1689 .Ev GOT_AUTHOR .
1690 However, the
1691 .Dv user.name
1692 and
1693 .Dv user.email
1694 configuration settings contained in Git's global
1695 .Pa ~/.gitconfig
1696 configuration file will be used only if the
1697 .Ev GOT_AUTHOR
1698 environment variable is
1699 .Em not
1700 set.
1701 .It Ev VISUAL , EDITOR
1702 The editor spawned by
1703 .Cm got commit ,
1704 .Cm got import ,
1706 .Cm got tag .
1707 .It Ev GOT_LOG_DEFAULT_LIMIT
1708 The default limit on the number of commits traversed by
1709 .Cm got log .
1710 If set to zero, the limit is unbounded.
1711 This variable will be silently ignored if it is set to a non-numeric value.
1712 .It Ev GOT_FETCH_DEBUG
1713 Enables protocol tracing on standard error output during
1714 .Cm got clone
1715 and
1716 .Cm got fetch .
1717 .El
1718 .Sh EXIT STATUS
1719 .Ex -std got
1720 .Sh EXAMPLES
1721 Clone an existing Git repository for use with
1722 .Nm .
1723 .Pp
1724 .Dl $ cd /var/git/
1725 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1726 .Pp
1727 Use of HTTP URLs currently requires
1728 .Xr git 1 :
1729 .Pp
1730 .Dl $ cd /var/git/
1731 .Dl $ git clone --bare https://github.com/openbsd/src.git
1732 .Pp
1733 Alternatively, for quick and dirty local testing of
1734 .Nm
1735 a new Git repository could be created and populated with files,
1736 e.g. from a temporary CVS checkout located at
1737 .Pa /tmp/src :
1738 .Pp
1739 .Dl $ got init /var/git/src.git
1740 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1741 .Pp
1742 Check out a work tree from the Git repository to /usr/src:
1743 .Pp
1744 .Dl $ got checkout /var/git/src.git /usr/src
1745 .Pp
1746 View local changes in a work tree directory:
1747 .Pp
1748 .Dl $ got status
1749 .Dl $ got diff | less
1750 .Pp
1751 Interactively revert selected local changes in a work tree directory:
1752 .Pp
1753 .Dl $ got revert -p -R\ .
1754 .Pp
1755 In a work tree or a git repository directory, list all branch references:
1756 .Pp
1757 .Dl $ got branch -l
1758 .Pp
1759 In a work tree or a git repository directory, create a new branch called
1760 .Dq unified-buffer-cache
1761 which is forked off the
1762 .Dq master
1763 branch:
1764 .Pp
1765 .Dl $ got branch unified-buffer-cache master
1766 .Pp
1767 Switch an existing work tree to the branch
1768 .Dq unified-buffer-cache .
1769 Local changes in the work tree will be preserved and merged if necessary:
1770 .Pp
1771 .Dl $ got update -b unified-buffer-cache
1772 .Pp
1773 Create a new commit from local changes in a work tree directory.
1774 This new commit will become the head commit of the work tree's current branch:
1775 .Pp
1776 .Dl $ got commit
1777 .Pp
1778 In a work tree or a git repository directory, view changes committed in
1779 the 3 most recent commits to the work tree's branch, or the branch resolved
1780 via the repository's HEAD reference, respectively:
1781 .Pp
1782 .Dl $ got log -p -l 3
1783 .Pp
1784 In a work tree or a git repository directory, log the history of a subdirectory:
1785 .Pp
1786 .Dl $ got log sys/uvm
1787 .Pp
1788 While operating inside a work tree, paths are specified relative to the current
1789 working directory, so this command will log the subdirectory
1790 .Pa sys/uvm :
1791 .Pp
1792 .Dl $ cd sys/uvm && got log '.'
1793 .Pp
1794 And this command has the same effect:
1795 .Pp
1796 .Dl $ cd sys/dev/usb && got log ../../uvm
1797 .Pp
1798 Add new files and remove obsolete files in a work tree directory:
1799 .Pp
1800 .Dl $ got add sys/uvm/uvm_ubc.c
1801 .Dl $ got remove sys/uvm/uvm_vnode.c
1802 .Pp
1803 Create a new commit from local changes in a work tree directory
1804 with a pre-defined log message.
1805 .Pp
1806 .Dl $ got commit -m 'unify the buffer cache'
1807 .Pp
1808 Update any work tree checked out from the
1809 .Dq unified-buffer-cache
1810 branch to the latest commit on this branch:
1811 .Pp
1812 .Dl $ got update
1813 .Pp
1814 Roll file content on the unified-buffer-cache branch back by one commit,
1815 and then fetch the rolled-back change into the work tree as a local change
1816 to be amended and perhaps committed again:
1817 .Pp
1818 .Dl $ got backout unified-buffer-cache
1819 .Dl $ got commit -m 'roll back previous'
1820 .Dl $ # now back out the previous backout :-)
1821 .Dl $ got backout unified-buffer-cache
1822 .Pp
1823 Fetch new upstream commits into the local repository's
1824 .Dq origin/master
1825 branch:
1826 .Pp
1827 .Dl $ cd /usr/src
1828 .Dl $ got fetch
1829 .Pp
1830 In a repository created with a HTTP URL and
1831 .Cm git clone --bare
1832 the
1833 .Xr git-fetch 1
1834 command must be used instead:
1835 .Pp
1836 .Dl $ cd /var/git/src.git
1837 .Dl $ git fetch origin master:refs/remotes/origin/master
1838 .Pp
1839 Rebase the local
1840 .Dq master
1841 branch to merge the new changes that are now visible on the
1842 .Dq origin/master
1843 branch:
1844 .Pp
1845 .Dl $ cd /usr/src
1846 .Dl $ got update -b origin/master
1847 .Dl $ got rebase master
1848 .Pp
1849 Rebase the
1850 .Dq unified-buffer-cache
1851 branch on top of the new head commit of the
1852 .Dq master
1853 branch.
1854 .Pp
1855 .Dl $ got update -b master
1856 .Dl $ got rebase unified-buffer-cache
1857 .Pp
1858 Create a patch from all changes on the unified-buffer-cache branch.
1859 The patch can be mailed out for review and applied to
1860 .Ox Ns 's
1861 CVS tree:
1862 .Pp
1863 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
1864 .Pp
1865 Edit the entire commit history of the
1866 .Dq unified-buffer-cache
1867 branch:
1868 .Pp
1869 .Dl $ got update -b unified-buffer-cache
1870 .Dl $ got update -c master
1871 .Dl $ got histedit
1872 .Pp
1873 In order to merge changes committed to the
1874 .Dq unified-buffer-cache
1875 branch back into the
1876 .Dq master
1877 branch, the
1878 .Dq unified-buffer-cache
1879 branch must first be rebased onto the
1880 .Dq master
1881 branch:
1882 .Pp
1883 .Dl $ got update -b master
1884 .Dl $ got rebase unified-buffer-cache
1885 .Pp
1886 Changes on the
1887 .Dq unified-buffer-cache
1888 branch can now be made visible on the
1889 .Dq master
1890 branch with
1891 .Cm got integrate .
1892 Because the rebase operation switched the work tree to the
1893 .Dq unified-buffer-cache
1894 branch, the work tree must be switched back to the
1895 .Dq master
1896 branch before the
1897 .Dq unified-buffer-cache
1898 branch can be integrated into
1899 .Dq master :
1900 .Pp
1901 .Dl $ got update -b master
1902 .Dl $ got integrate unified-buffer-cache
1903 .Pp
1904 Additional steps may be necessary if local changes need to be pushed back
1905 to the remote repository, which currently requires
1906 .Cm git push .
1907 Before working against existing branches in a repository cloned with
1908 .Cm git clone --bare
1909 instead of
1910 .Cm got clone ,
1911 a Git
1912 .Dq refspec
1913 must be configured to map all references in the remote repository
1914 into the
1915 .Dq refs/remotes
1916 namespace of the local repository.
1917 This can achieved by setting Git's
1918 .Pa remote.origin.fetch
1919 configuration variable to the value
1920 .Dq +refs/heads/*:refs/remotes/origin/*
1921 with the
1922 .Cm git config
1923 command:
1924 .Pp
1925 .Dl $ cd /var/git/repo
1926 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
1927 Additionally, the
1928 .Dq mirror
1929 option must be disabled:
1930 .Pp
1931 .Dl $ cd /var/git/repo
1932 .Dl $ git config remote.origin.mirror false
1933 .Pp
1934 Alternatively, the following
1935 .Xr git-fetch 1
1936 configuration item can be added manually to the Git repository's
1937 .Pa config
1938 file:
1939 .Pp
1940 .Dl [remote "origin"]
1941 .Dl url = ...
1942 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
1943 .Dl mirror = false
1944 .Pp
1945 This configuration leaves the local repository's
1946 .Dq refs/heads
1947 namespace free for use by local branches checked out with
1948 .Cm got checkout
1949 and, if needed, created with
1950 .Cm got branch .
1951 .Pp
1952 Branches in the
1953 .Dq remotes/origin
1954 namespace can now be updated with incoming changes from the remote
1955 repository with
1956 .Cm got fetch
1958 .Xr git-fetch 1
1959 without extra command line arguments:
1960 .Pp
1961 .Dl $ cd /var/git/repo
1962 .Dl $ git fetch
1963 .Pp
1964 To make changes fetched from the remote repository appear on the
1965 .Dq master
1966 branch, the
1967 .Dq master
1968 branch must be rebased onto the
1969 .Dq origin/master
1970 branch.
1971 This will also merge local changes, if any, with the incoming changes:
1972 .Pp
1973 .Dl $ got update -b origin/master
1974 .Dl $ got rebase master
1975 .Pp
1976 On the
1977 .Dq master
1978 branch, log messages for local changes can now be amended with
1979 .Dq OK
1980 by other developers and any other important new information:
1981 .Pp
1982 .Dl $ got update -c origin/master
1983 .Dl $ got histedit -m
1984 .Pp
1985 Local changes on the
1986 .Dq master
1987 branch can then be pushed to the remote
1988 repository with
1989 .Cm git push :
1990 .Pp
1991 .Dl $ cd /var/git/repo
1992 .Dl $ git push origin master
1993 .Sh SEE ALSO
1994 .Xr tog 1 ,
1995 .Xr git-repository 5 ,
1996 .Xr got-worktree 5
1997 .Sh AUTHORS
1998 .An Stefan Sperling Aq Mt stsp@openbsd.org
1999 .An Martin Pieuchot Aq Mt mpi@openbsd.org
2000 .An Joshua Stein Aq Mt jcs@openbsd.org
2001 .An Ori Bernstein Aq Mt ori@openbsd.org
2002 .Sh CAVEATS
2003 .Nm
2004 is a work-in-progress and many commands remain to be implemented.
2005 At present, the user has to fall back on
2006 .Xr git 1
2007 to perform many tasks, in particular tasks related to repository
2008 administration and tasks which require a network connection.