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 .Op Fl hV
26 .Ar command
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 .Tg im
66 .It Xo
67 .Cm import
68 .Op Fl b Ar branch
69 .Op Fl I Ar pattern
70 .Op Fl m Ar message
71 .Op Fl r Ar repository-path
72 .Ar directory
73 .Xc
74 .Dl Pq alias: Cm im
75 Create an initial commit in a repository from the file hierarchy
76 within the specified
77 .Ar directory .
78 The created commit will not have any parent commits, i.e. it will be a
79 root commit.
80 Also create a new reference which provides a branch name for the newly
81 created commit.
82 Show the path of each imported file to indicate progress.
83 .Pp
84 The
85 .Cm got import
86 command requires the
87 .Ev GOT_AUTHOR
88 environment variable to be set,
89 unless an author has been configured in
90 .Xr got.conf 5
91 or Git's
92 .Dv user.name
93 and
94 .Dv user.email
95 configuration settings can be obtained from the repository's
96 .Pa .git/config
97 file or from Git's global
98 .Pa ~/.gitconfig
99 configuration file.
100 .Pp
101 The options for
102 .Cm got import
103 are as follows:
104 .Bl -tag -width Ds
105 .It Fl b Ar branch
106 Create the specified
107 .Ar branch .
108 If this option is not specified, a branch corresponding to the repository's
109 HEAD reference will be used.
110 Use of this option is required if the branch resolved via the repository's
111 HEAD reference already exists.
112 .It Fl I Ar pattern
113 Ignore files or directories with a name which matches the specified
114 .Ar pattern .
115 This option may be specified multiple times to build a list of ignore patterns.
116 The
117 .Ar pattern
118 follows the globbing rules documented in
119 .Xr glob 7 .
120 Ignore patterns which end with a slash,
121 .Dq / ,
122 will only match directories.
123 .It Fl m Ar message
124 Use the specified log message when creating the new commit.
125 Without the
126 .Fl m
127 option,
128 .Cm got import
129 opens a temporary file in an editor where a log message can be written.
130 Quitting the editor without saving the file will abort the import operation.
131 .It Fl r Ar repository-path
132 Use the repository at the specified path.
133 If not specified, assume the repository is located at or above the current
134 working directory.
135 .El
136 .Tg cl
137 .It Xo
138 .Cm clone
139 .Op Fl almqv
140 .Op Fl b Ar branch
141 .Op Fl R Ar reference
142 .Ar repository-URL
143 .Op Ar directory
144 .Xc
145 .Dl Pq alias: Cm cl
146 Clone a Git repository at the specified
147 .Ar repository-URL
148 into the specified
149 .Ar directory .
150 If no
151 .Ar directory
152 is specified, the directory name will be derived from the name of the
153 cloned repository.
154 .Cm got clone
155 will refuse to run if the
156 .Ar directory
157 already exists.
158 .Pp
159 The
160 .Ar repository-URL
161 specifies a protocol scheme, a server hostname, an optional port number
162 separated from the hostname by a colon, and a path to the repository on
163 the server:
164 .Lk scheme://hostname:port/path/to/repository
165 .Pp
166 The following protocol schemes are supported:
167 .Bl -tag -width git+ssh
168 .It git
169 The Git protocol as implemented by the
170 .Xr git-daemon 1
171 server.
172 Use of this protocol is discouraged since it supports neither authentication
173 nor encryption.
174 .It git+ssh
175 The Git protocol wrapped in an authenticated and encrypted
176 .Xr ssh 1
177 tunnel.
178 With this protocol the hostname may contain an embedded username for
179 .Xr ssh 1
180 to use:
181 .Mt user@hostname
182 .It ssh
183 Short alias for git+ssh.
184 .It http
185 The
186 .Dq smart
187 HTTP Git protocol.
188 Supported by
189 .Cm got clone
190 and
191 .Cm got fetch ,
192 but not by
193 .Cm got send .
194 Not compatible with Git HTTP servers using the
195 .Dq dumb
196 protocol.
197 Use of this protocol is discouraged since it supports neither authentication
198 nor encryption.
199 .It https
200 The
201 .Dq smart
202 Git HTTP protocol wrapped in SSL/TLS.
203 .El
204 .Pp
205 Objects in the cloned repository are stored in a pack file which is downloaded
206 from the server.
207 This pack file will then be indexed to facilitate access to the objects stored
208 within.
209 If any objects in the pack file are stored in deltified form, all deltas will
210 be fully resolved in order to compute the ID of such objects.
211 This can take some time.
212 More details about the pack file format are documented in
213 .Xr git-repository 5 .
214 .Pp
215 .Cm got clone
216 creates a remote repository entry in the
217 .Xr got.conf 5
218 and
219 .Pa config
220 files of the cloned repository to store the
221 .Ar repository-url
222 and any
223 .Ar branch
224 or
225 .Ar reference
226 arguments for future use by
227 .Cm got fetch
228 or
229 .Xr git-fetch 1 .
230 .Pp
231 The options for
232 .Cm got clone
233 are as follows:
234 .Bl -tag -width Ds
235 .It Fl a
236 Fetch all branches from the remote repository's
237 .Dq refs/heads/
238 reference namespace and set
239 .Cm fetch_all_branches
240 in the cloned repository's
241 .Xr got.conf 5
242 file for future use by
243 .Cm got fetch .
244 If this option is not specified, a branch resolved via the remote
245 repository's HEAD reference will be fetched.
246 Cannot be used together with the
247 .Fl b
248 option.
249 .It Fl b Ar branch
250 Fetch the specified
251 .Ar branch
252 from the remote repository's
253 .Dq refs/heads/
254 reference namespace.
255 This option may be specified multiple times to build a list of branches
256 to fetch.
257 If the branch corresponding to the remote repository's HEAD reference is not
258 in this list, the cloned repository's HEAD reference will be set to the first
259 branch which was fetched.
260 If this option is not specified, a branch resolved via the remote
261 repository's HEAD reference will be fetched.
262 Cannot be used together with the
263 .Fl a
264 option.
265 .It Fl l
266 List branches and tags available for fetching from the remote repository
267 and exit immediately.
268 Cannot be used together with any of the other options except
269 .Fl q
270 and
271 .Fl v .
272 .It Fl m
273 Create the cloned repository as a mirror of the original repository.
274 This is useful if the cloned repository will not be used to store
275 locally created commits.
276 .Pp
277 The repository's
278 .Xr got.conf 5
279 and
280 .Pa config
281 files will be set up with the
282 .Dq mirror
283 option enabled, such that
284 .Cm got fetch
285 or
286 .Xr git-fetch 1
287 will write incoming changes directly to branches in the
288 .Dq refs/heads/
289 reference namespace, rather than to branches in the
290 .Dq refs/remotes/
291 namespace.
292 This avoids the usual requirement of having to run
293 .Cm got rebase
294 or
295 .Cm got merge
296 after
297 .Cm got fetch
298 in order to make incoming changes appear on branches in the
299 .Dq refs/heads/
300 namespace.
301 But maintaining custom changes in the cloned repository becomes difficult
302 since such changes will be at risk of being discarded whenever incoming
303 changes are fetched.
304 .It Fl q
305 Suppress progress reporting output.
306 The same option will be passed to
307 .Xr ssh 1
308 if applicable.
309 .It Fl R Ar reference
310 In addition to the branches and tags that will be fetched, fetch an arbitrary
311 .Ar reference
312 from the remote repository's
313 .Dq refs/
314 namespace.
315 This option may be specified multiple times to build a list of additional
316 references to fetch.
317 The specified
318 .Ar reference
319 may either be a path to a specific reference, or a reference namespace
320 which will cause all references in this namespace to be fetched.
321 .Pp
322 Each reference will be mapped into the cloned repository's
323 .Dq refs/remotes/
324 namespace, unless the
325 .Fl m
326 option is used to mirror references directly into the cloned repository's
327 .Dq refs/
328 namespace.
329 .Pp
330 .Cm got clone
331 will refuse to fetch references from the remote repository's
332 .Dq refs/remotes/
333 or
334 .Dq refs/got/
335 namespace.
336 .It Fl v
337 Verbose mode.
338 Causes
339 .Cm got clone
340 to print debugging messages to standard error output.
341 This option will be passed to
342 .Xr ssh 1
343 if applicable.
344 Multiple -v options increase the verbosity.
345 The maximum is 3.
346 .El
347 .Tg fe
348 .It Xo
349 .Cm fetch
350 .Op Fl adlqtvX
351 .Op Fl b Ar branch
352 .Op Fl R Ar reference
353 .Op Fl r Ar repository-path
354 .Op Ar remote-repository
355 .Xc
356 .Dl Pq alias: Cm fe
357 Fetch new changes from a remote repository.
358 If no
359 .Ar remote-repository
360 is specified,
361 .Dq origin
362 will be used.
363 The remote repository's URL is obtained from the corresponding entry in
364 .Xr got.conf 5
365 or Git's
366 .Pa config
367 file of the local repository, as created by
368 .Cm got clone .
369 .Pp
370 By default, any branches configured in
371 .Xr got.conf 5
372 for the
373 .Ar remote-repository
374 will be fetched.
375 If
376 .Cm got fetch
377 is invoked in a work tree then this work tree's current branch will be
378 fetched, too, provided it is present on the server.
379 If no branches to fetch can be found in
380 .Xr got.conf 5
381 or via a work tree, or said branches are not found on the server, a branch
382 resolved via the remote repository's HEAD reference will be fetched.
383 Likewise, if a HEAD reference for the
384 .Ar remote-repository
385 exists but its target no longer matches the remote HEAD, then
386 the new target branch will be fetched.
387 This default behaviour can be overridden with the
388 .Fl a
389 and
390 .Fl b
391 options.
392 .Pp
393 New changes will be stored in a separate pack file downloaded from the server.
394 Optionally, separate pack files stored in the repository can be combined with
395 .Xr git-repack 1 .
396 .Pp
397 By default, branch references in the
398 .Dq refs/remotes/
399 reference namespace will be updated to point at the newly fetched commits.
400 The
401 .Cm got rebase
402 or
403 .Cm got merge
404 command can then be used to make new changes visible on branches in the
405 .Dq refs/heads/
406 namespace, merging incoming changes with the changes on those branches
407 as necessary.
408 .Pp
409 If the repository was created as a mirror with
410 .Cm got clone -m ,
411 then all branches in the
412 .Dq refs/heads/
413 namespace will be updated directly to match the corresponding branches in
414 the remote repository.
415 If those branches contained local commits, these commits will no longer be
416 reachable via a reference and will therefore be at risk of being discarded
417 by Git's garbage collector or
418 .Cm gotadmin cleanup .
419 Maintaining custom changes in a mirror repository is therefore discouraged.
420 .Pp
421 In any case, references in the
422 .Dq refs/tags/
423 namespace will always be fetched and mapped directly to local references
424 in the same namespace.
425 .Pp
426 The options for
427 .Cm got fetch
428 are as follows:
429 .Bl -tag -width Ds
430 .It Fl a
431 Fetch all branches from the remote repository's
432 .Dq refs/heads/
433 reference namespace.
434 This option can be enabled by default for specific repositories in
435 .Xr got.conf 5 .
436 Cannot be used together with the
437 .Fl b
438 option.
439 .It Fl b Ar branch
440 Fetch the specified
441 .Ar branch
442 from the remote repository's
443 .Dq refs/heads/
444 reference namespace.
445 This option may be specified multiple times to build a list of branches
446 to fetch.
447 Cannot be used together with the
448 .Fl a
449 option.
450 .It Fl d
451 Delete branches and tags from the local repository which are no longer
452 present in the remote repository.
453 Only references are deleted.
454 Any commit, tree, tag, and blob objects belonging to deleted branches or
455 tags remain in the repository and may be removed separately with
456 Git's garbage collector or
457 .Cm gotadmin cleanup .
458 .It Fl l
459 List branches and tags available for fetching from the remote repository
460 and exit immediately.
461 Cannot be used together with any of the other options except
462 .Fl v ,
463 .Fl q ,
464 and
465 .Fl r .
466 .It Fl q
467 Suppress progress reporting output.
468 The same option will be passed to
469 .Xr ssh 1
470 if applicable.
471 .It Fl R Ar reference
472 In addition to the branches and tags that will be fetched, fetch an arbitrary
473 .Ar reference
474 from the remote repository's
475 .Dq refs/
476 namespace.
477 This option may be specified multiple times to build a list of additional
478 references to fetch.
479 The specified
480 .Ar reference
481 may either be a path to a specific reference, or a reference namespace
482 which will cause all references in this namespace to be fetched.
483 .Pp
484 Each reference will be mapped into the local repository's
485 .Dq refs/remotes/
486 namespace, unless the local repository was created as a mirror with
487 .Cm got clone -m
488 in which case references will be mapped directly into the local repository's
489 .Dq refs/
490 namespace.
491 .Pp
492 Once a reference has been fetched, a branch based on it can be created with
493 .Cm got branch
494 if needed.
495 .Pp
496 .Cm got fetch
497 will refuse to fetch references from the remote repository's
498 .Dq refs/remotes/
499 or
500 .Dq refs/got/
501 namespace.
502 .It Fl r Ar repository-path
503 Use the repository at the specified path.
504 If not specified, assume the repository is located at or above the current
505 working directory.
506 If this directory is a
507 .Nm
508 work tree, use the repository path associated with this work tree.
509 .It Fl t
510 Allow existing references in the
511 .Dq refs/tags
512 namespace to be updated if they have changed on the server.
513 If not specified, only new tag references will be created.
514 .It Fl v
515 Verbose mode.
516 Causes
517 .Cm got fetch
518 to print debugging messages to standard error output.
519 The same option will be passed to
520 .Xr ssh 1
521 if applicable.
522 Multiple -v options increase the verbosity.
523 The maximum is 3.
524 .It Fl X
525 Delete all references which correspond to a particular
526 .Ar remote-repository
527 instead of fetching new changes.
528 This can be useful when a remote repository is being removed from
529 .Xr got.conf 5 .
530 .Pp
531 With
532 .Fl X ,
533 the
534 .Ar remote-repository
535 argument is mandatory and no other options except
536 .Fl r ,
537 .Fl v ,
538 and
539 .Fl q
540 are allowed.
541 .Pp
542 Only references are deleted.
543 Any commit, tree, tag, and blob objects fetched from a remote repository
544 will generally be stored in pack files and may be removed separately with
545 .Xr git-repack 1
546 and Git's garbage collector.
547 .El
548 .Tg co
549 .It Xo
550 .Cm checkout
551 .Op Fl \&Eq
552 .Op Fl b Ar branch
553 .Op Fl c Ar commit
554 .Op Fl p Ar path-prefix
555 .Ar repository-path
556 .Op Ar work-tree-path
557 .Xc
558 .Dl Pq alias: Cm co
559 Copy files from a repository into a new work tree.
560 Show the status of each affected file, using the following status codes:
561 .Bl -column YXZ description
562 .It A Ta new file was added
563 .It E Ta file already exists in work tree's meta-data
564 .El
565 .Pp
566 If the
567 .Ar work tree path
568 is not specified, either use the last component of
569 .Ar repository path ,
570 or if a
571 .Ar path prefix
572 was specified use the last component of
573 .Ar path prefix .
574 .Pp
575 The options for
576 .Cm got checkout
577 are as follows:
578 .Bl -tag -width Ds
579 .It Fl b Ar branch
580 Check out files from a commit on the specified
581 .Ar branch .
582 If this option is not specified, a branch resolved via the repository's HEAD
583 reference will be used.
584 .It Fl c Ar commit
585 Check out files from the specified
586 .Ar commit
587 on the selected branch.
588 If this option is not specified, the most recent commit on the selected
589 branch will be used.
590 .Pp
591 The expected
592 .Ar commit
593 argument is a commit ID SHA1 hash, or a reference name or a keyword
594 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 The keywords
598 .Qq :base
599 and
600 .Qq :head
601 resolve to the repository's HEAD reference, or, if the
602 .Fl b
603 option is used, the head of the checked-out
604 .Ar branch .
605 Keywords and reference names may be appended with
606 .Qq :+
607 or
608 .Qq :-
609 modifiers and an optional integer N to denote the
610 Nth descendant or antecedent by first parent traversal, respectively;
611 for example,
612 .Sy :head:-2
613 denotes the work tree branch head's 2nd generation ancestor, and
614 .Sy foo:-3
615 will denote the 3rd generation ancestor of the commit resolved by the
616 .Qq foo
617 reference.
618 If an integer does not follow the
619 .Qq :+
620 or
621 .Qq :-
622 modifier, a
623 .Qq 1
624 is implicitly appended
625 .Po e.g.,
626 .Sy :head:-
627 is equivalent to
628 .Sy :head:-1
629 .Pc .
630 .Pp
631 If the specified
632 .Ar commit
633 is not contained in the selected branch, a different branch which contains
634 this commit must be specified with the
635 .Fl b
636 option.
637 If no such branch is known, a new branch must be created for this
638 commit with
639 .Cm got branch
640 before
641 .Cm got checkout
642 can be used.
643 Checking out work trees with an unknown branch is intentionally not supported.
644 .It Fl E
645 Proceed with the checkout operation even if the directory at
646 .Ar work-tree-path
647 is not empty.
648 Existing files will be left intact.
649 .It Fl p Ar path-prefix
650 Restrict the work tree to a subset of the repository's tree hierarchy.
651 Only files beneath the specified
652 .Ar path-prefix
653 will be checked out.
654 .It Fl q
655 Silence progress output.
656 .El
657 .Tg up
658 .It Xo
659 .Cm update
660 .Op Fl q
661 .Op Fl b Ar branch
662 .Op Fl c Ar commit
663 .Op Ar path ...
664 .Xc
665 .Dl Pq alias: Cm up
666 Update an existing work tree to a different
667 .Ar commit .
668 Change existing files in the work tree as necessary to match file contents
669 of this commit.
670 Preserve any local changes in the work tree and merge them with the
671 incoming changes.
672 .Pp
673 Files which already contain merge conflicts will not be updated to avoid
674 further complications.
675 Such files will be updated when
676 .Cm got update
677 is run again after merge conflicts have been resolved.
678 If the conflicting changes are no longer needed, affected files can be
679 reverted with
680 .Cm got revert
681 before running
682 .Cm got update
683 again.
684 .Pp
685 Show the status of each affected file, using the following status codes:
686 .Bl -column YXZ description
687 .It U Ta file was updated and contained no local changes
688 .It G Ta file was updated and local changes were merged cleanly
689 .It C Ta file was updated and conflicts occurred during merge
690 .It D Ta file was deleted
691 .It d Ta file's deletion was prevented by local modifications
692 .It A Ta new file was added
693 .It \(a~ Ta versioned file is obstructed by a non-regular file
694 .It ! Ta a missing versioned file was restored
695 .It # Ta file was not updated because it contains merge conflicts
696 .It ? Ta changes destined for an unversioned file were not merged
697 .El
698 .Pp
699 If no
700 .Ar path
701 is specified, update the entire work tree.
702 Otherwise, restrict the update operation to files at or within the
703 specified paths.
704 Each path is required to exist in the update operation's target commit.
705 Files in the work tree outside specified paths will remain unchanged and
706 will retain their previously recorded base commit.
707 Some
708 .Nm
709 commands may refuse to run while the work tree contains files from
710 multiple base commits.
711 The base commit of such a work tree can be made consistent by running
712 .Cm got update
713 across the entire work tree.
714 Specifying a
715 .Ar path
716 is incompatible with the
717 .Fl b
718 option.
719 .Pp
720 .Cm got update
721 cannot update paths with staged changes.
722 If changes have been staged with
723 .Cm got stage ,
724 these changes must first be committed with
725 .Cm got commit
726 or unstaged with
727 .Cm got unstage .
728 .Pp
729 The options for
730 .Cm got update
731 are as follows:
732 .Bl -tag -width Ds
733 .It Fl b Ar branch
734 Switch the work tree's branch reference to the specified
735 .Ar branch
736 before updating the work tree.
737 This option requires that all paths in the work tree are updated.
738 .Pp
739 As usual, any local changes in the work tree will be preserved.
740 This can be useful when switching to a newly created branch in order
741 to commit existing local changes to this branch.
742 .Pp
743 Any local changes must be dealt with separately in order to obtain a
744 work tree with pristine file contents corresponding exactly to the specified
745 .Ar branch .
746 Such changes could first be committed to a different branch with
747 .Cm got commit ,
748 or could be discarded with
749 .Cm got revert .
750 .It Fl c Ar commit
751 Update the work tree to the specified
752 .Ar commit .
753 If this option is not specified, the most recent commit on the work tree's
754 branch will be used.
755 .Pp
756 The expected
757 .Ar commit
758 argument is a commit ID SHA1 hash, or a reference name or a keyword
759 which will be resolved to a commit ID.
760 An abbreviated hash argument will be expanded to a full SHA1 hash
761 automatically, provided the abbreviation is unique.
762 The keywords
763 .Qq :base
764 and
765 .Qq :head
766 resolve to the work tree's base commit and branch head, respectively.
767 Keywords and reference names may be appended with
768 .Qq :+
769 or
770 .Qq :-
771 modifiers and an optional integer N to denote the
772 Nth descendant or antecedent, respectively, by first parent traversal;
773 for example,
774 .Sy :head:-2
775 denotes the work tree branch head's 2nd generation ancestor, and
776 .Sy :base:+4
777 denotes the 4th generation descendant of the work tree's base commit.
778 Similarly,
779 .Sy foo:-3
780 will denote the 3rd generation ancestor of the commit resolved by the
781 .Qq foo
782 reference.
783 If an integer does not follow the
784 .Qq :+
785 or
786 .Qq :-
787 modifier, a
788 .Qq 1
789 is implicitly appended
790 .Po e.g.,
791 .Sy :head:-
792 is equivalent to
793 .Sy :head:-1
794 .Pc .
795 .It Fl q
796 Silence progress output.
797 .El
798 .Tg st
799 .It Xo
800 .Cm status
801 .Op Fl I
802 .Op Fl S Ar status-codes
803 .Op Fl s Ar status-codes
804 .Op Ar path ...
805 .Xc
806 .Dl Pq alias: Cm st
807 Show the current modification status of files in a work tree,
808 using the following status codes:
809 .Bl -column YXZ description
810 .It M Ta modified file
811 .It A Ta file scheduled for addition in next commit
812 .It D Ta file scheduled for deletion in next commit
813 .It C Ta modified or added file which contains merge conflicts
814 .It ! Ta versioned file was expected on disk but is missing
815 .It \(a~ Ta versioned file is obstructed by a non-regular file
816 .It ? Ta unversioned item not tracked by
817 .Nm
818 .It m Ta modified file modes (executable bit only)
819 .It N Ta non-existent
820 .Ar path
821 specified on the command line
822 .El
823 .Pp
824 If no
825 .Ar path
826 is specified, show modifications in the entire work tree.
827 Otherwise, show modifications at or within the specified paths.
828 .Pp
829 If changes have been staged with
830 .Cm got stage ,
831 staged changes are shown in the second output column, using the following
832 status codes:
833 .Bl -column YXZ description
834 .It M Ta file modification is staged
835 .It A Ta file addition is staged
836 .It D Ta file deletion is staged
837 .El
838 .Pp
839 Changes created on top of staged changes are indicated in the first column:
840 .Bl -column YXZ description
841 .It MM Ta file was modified after earlier changes have been staged
842 .It MA Ta file was modified after having been staged for addition
843 .El
844 .Pp
845 If the work tree contains the results of an interrupted
846 .Cm got rebase ,
847 .Cm got histedit ,
848 or
849 .Cm got merge
850 operation then display a message which shows the branches involved.
851 .Pp
852 The options for
853 .Cm got status
854 are as follows:
855 .Bl -tag -width Ds
856 .It Fl I
857 Show unversioned files even if they match an ignore pattern.
858 .It Fl S Ar status-codes
859 Suppress the output of files with a modification status matching any of the
860 single-character status codes contained in the
861 .Ar status-codes
862 argument.
863 Any combination of codes from the above list of possible status codes
864 may be specified.
865 For staged files, status codes displayed in either column will be matched.
866 Cannot be used together with the
867 .Fl s
868 option.
869 .It Fl s Ar status-codes
870 Only show files with a modification status matching any of the
871 single-character status codes contained in the
872 .Ar status-codes
873 argument.
874 Any combination of codes from the above list of possible status codes
875 may be specified.
876 For staged files, status codes displayed in either column will be matched.
877 Cannot be used together with the
878 .Fl S
879 option.
880 .El
881 .Pp
882 For compatibility with
883 .Xr cvs 1
884 and
885 .Xr git 1 ,
886 .Cm got status
887 reads
888 .Xr glob 7
889 patterns from
890 .Pa .cvsignore
891 and
892 .Pa .gitignore
893 files in each traversed directory and will not display unversioned files
894 which match these patterns.
895 Ignore patterns which end with a slash,
896 .Dq / ,
897 will only match directories.
898 As an extension to
899 .Xr glob 7
900 matching rules,
901 .Cm got status
902 supports consecutive asterisks,
903 .Dq ** ,
904 which will match an arbitrary amount of directories.
905 Unlike
906 .Xr cvs 1 ,
907 .Cm got status
908 only supports a single ignore pattern per line.
909 Unlike
910 .Xr git 1 ,
911 .Cm got status
912 does not support negated ignore patterns prefixed with
913 .Dq \&! ,
914 and gives no special significance to the location of path component separators,
915 .Dq / ,
916 in a pattern.
917 .It Xo
918 .Cm log
919 .Op Fl bdPpRst
920 .Op Fl C Ar number
921 .Op Fl c Ar commit
922 .Op Fl l Ar N
923 .Op Fl r Ar repository-path
924 .Op Fl S Ar search-pattern
925 .Op Fl x Ar commit
926 .Op Ar path
927 .Xc
928 Display history of a repository.
929 If a
930 .Ar path
931 is specified, show only commits which modified this path.
932 If invoked in a work tree, the
933 .Ar path
934 is interpreted relative to the current working directory,
935 and the work tree's path prefix is implicitly prepended.
936 Otherwise, the path is interpreted relative to the repository root.
937 .Pp
938 The options for
939 .Cm got log
940 are as follows:
941 .Bl -tag -width Ds
942 .It Fl b
943 Display individual commits which were merged into the current branch
944 from other branches.
945 By default,
946 .Cm got log
947 shows the linear history of the current branch only.
948 .It Fl C Ar number
949 Set the number of context lines shown in diffs with
950 .Fl p .
951 By default, 3 lines of context are shown.
952 .It Fl c Ar commit
953 Start traversing history at the specified
954 .Ar commit .
955 If this option is not specified, default to the work tree's current branch
956 if invoked in a work tree, or to the repository's HEAD reference.
957 .Pp
958 The expected
959 .Ar commit
960 argument is a commit ID SHA1 hash, or a reference name or a keyword
961 which will be resolved to a commit ID.
962 An abbreviated hash argument will be expanded to a full SHA1 hash
963 automatically, provided the abbreviation is unique.
964 The keywords
965 .Qq :base
966 and
967 .Qq :head
968 resolve to the work tree's base commit and branch head, respectively.
969 The former is only valid if invoked in a work tree, while the latter will
970 resolve to the tip of the work tree's current branch if invoked in a
971 work tree, otherwise it will resolve to the repository's HEAD reference.
972 Keywords and references may be appended with
973 .Qq :+
974 or
975 .Qq :-
976 modifiers and an optional integer N to denote the
977 Nth descendant or antecedent, respectively, by first parent traversal;
978 for example,
979 .Sy :head:-2
980 denotes the HEAD reference's 2nd generation ancestor, and
981 .Sy :base:+4
982 denotes the 4th generation descendant of the work tree's base commit.
983 Similarly,
984 .Sy bar:+3
985 will denote the 3rd generation descendant of the commit resolved by the
986 .Qq bar
987 reference.
989 .Qq :+
990 or
991 .Qq :-
992 modifier without a trailing integer has an implicit
993 .Qq 1
994 appended
995 .Po e.g.,
996 .Sy :base:+
997 is equivalent to
998 .Sy :base:+1
999 .Pc .
1000 .It Fl d
1001 Display diffstat of changes introduced in each commit.
1002 Cannot be used with the
1003 .Fl s
1004 option.
1005 Implies the
1006 .Fl P
1007 option (diffstat displays a list of changed paths).
1008 .It Fl l Ar N
1009 Limit history traversal to a given number of commits.
1010 If this option is not specified, a default limit value of zero is used,
1011 which is treated as an unbounded limit.
1012 The
1013 .Ev GOT_LOG_DEFAULT_LIMIT
1014 environment variable may be set to change this default value.
1015 .It Fl P
1016 Display the list of file paths changed in each commit, using the following
1017 status codes:
1018 .Bl -column YXZ description
1019 .It M Ta modified file
1020 .It D Ta file was deleted
1021 .It A Ta new file was added
1022 .It m Ta modified file modes (executable bit only)
1023 .El
1024 .Pp
1025 Cannot be used with the
1026 .Fl s
1027 option.
1028 .It Fl p
1029 Display the patch of modifications made in each commit.
1030 If a
1031 .Ar path
1032 is specified, only show the patch of modifications at or within this path.
1033 Cannot be used with the
1034 .Fl s
1035 option.
1036 .It Fl R
1037 Determine a set of commits to display as usual, but display these commits
1038 in reverse order.
1039 .It Fl r Ar repository-path
1040 Use the repository at the specified path.
1041 If not specified, assume the repository is located at or above the current
1042 working directory.
1043 If this directory is a
1044 .Nm
1045 work tree, use the repository path associated with this work tree.
1046 .It Fl S Ar search-pattern
1047 If specified, show only commits with a log message, author name,
1048 committer name, or ID SHA1 hash matched by the extended regular
1049 expression
1050 .Ar search-pattern .
1051 Lines in committed patches will be matched if
1052 .Fl p
1053 is specified.
1054 File paths changed by a commit will be matched if
1055 .Fl P
1056 is specified.
1057 Regular expression syntax is documented in
1058 .Xr re_format 7 .
1059 .It Fl s
1060 Display a short one-line summary of each commit, instead of the default
1061 history format.
1062 Cannot be used together with the
1063 .Fl p
1065 .Fl P
1066 option.
1067 .It Fl t
1068 Display commits in topological order.
1069 This option has no effect without the
1070 .Fl b
1071 option because a linear history is sorted in topological order by definition.
1072 Topological sorting is disabled by default because the present implementation
1073 requires that commit history is fully traversed before any output can be shown.
1074 .It Fl x Ar commit
1075 Stop traversing commit history immediately after the specified
1076 .Ar commit
1077 has been traversed.
1078 Like
1079 .Fl c ,
1080 the expected
1081 .Ar commit
1082 argument is a commit ID SHA1 hash, or a reference name or a keyword
1083 which will be resolved to a commit ID.
1084 This option has no effect if the specified
1085 .Ar commit
1086 is never traversed.
1087 .El
1088 .Tg di
1089 .It Xo
1090 .Cm diff
1091 .Op Fl adPsw
1092 .Op Fl C Ar number
1093 .Op Fl c Ar commit
1094 .Op Fl r Ar repository-path
1095 .Op Ar object1 Ar object2 | Ar path ...
1096 .Xc
1097 .Dl Pq alias: Cm di
1098 When invoked within a work tree without any arguments, display all
1099 local changes in the work tree.
1100 If one or more
1101 .Ar path
1102 arguments are specified, only show changes within the specified paths.
1103 .Pp
1104 If two arguments are provided, treat each argument as a reference, a tag
1105 name, or an object ID SHA1 hash, and display differences between the
1106 corresponding objects.
1107 Both objects must be of the same type (blobs, trees, or commits).
1108 An abbreviated hash argument will be expanded to a full SHA1 hash
1109 automatically, provided the abbreviation is unique.
1110 If none of these interpretations produce a valid result or if the
1111 .Fl P
1112 option is used,
1113 and if
1114 .Cm got diff
1115 is running in a work tree, attempt to interpret the two arguments as paths.
1116 .Pp
1117 The options for
1118 .Cm got diff
1119 are as follows:
1120 .Bl -tag -width Ds
1121 .It Fl a
1122 Treat file contents as ASCII text even if binary data is detected.
1123 .It Fl C Ar number
1124 Set the number of context lines shown in the diff.
1125 By default, 3 lines of context are shown.
1126 .It Fl c Ar commit
1127 Show differences between commits in the repository.
1128 This option may be used up to two times.
1129 When used only once, show differences between the specified
1130 .Ar commit
1131 and its first parent commit.
1132 When used twice, show differences between the two specified commits.
1133 .Pp
1134 If the
1135 .Fl c
1136 option is used, all non-option arguments will be interpreted as paths.
1137 If one or more such
1138 .Ar path
1139 arguments are provided, only show differences for the specified paths.
1140 .Pp
1141 The expected
1142 .Ar commit
1143 argument is a commit ID SHA1 hash, or a reference name or a keyword
1144 which will be resolved to a commit ID.
1145 An abbreviated hash argument will be expanded to a full SHA1 hash
1146 automatically, provided the abbreviation is unique.
1147 The keywords
1148 .Qq :base
1149 and
1150 .Qq :head
1151 resolve to the work tree's base commit and branch head, respectively.
1152 The former is only valid if invoked in a work tree, while the latter will
1153 resolve to the tip of the work tree's current branch if invoked in a
1154 work tree, otherwise it will resolve to the repository's HEAD reference.
1155 Keywords and references may be appended with
1156 .Qq :+
1158 .Qq :-
1159 modifiers and an optional integer N to denote the
1160 Nth descendant or antecedent, respectively, by first parent traversal;
1161 for example,
1162 .Sy :head:-2
1163 denotes the HEAD reference's 2nd generation ancestor, and
1164 .Sy :base:+4
1165 denotes the 4th generation descendant of the work tree's base commit.
1166 Similarly,
1167 .Sy baz:+8
1168 will denote the 8th generation descendant of the commit resolved by the
1169 .Qq baz
1170 reference.
1171 If an integer does not follow the
1172 .Qq :+
1174 .Qq :-
1175 modifier, a
1176 .Qq 1
1177 is implicitly appended
1178 .Po e.g.,
1179 .Sy :head:-
1180 is equivalent to
1181 .Sy :head:-1
1182 .Pc .
1183 .Pp
1184 Cannot be used together with the
1185 .Fl P
1186 option.
1187 .It Fl d
1188 Display diffstat of changes before the actual diff by annotating each file path
1189 or blob hash being diffed with the total number of lines added and removed.
1190 A summary line will display the total number of changes across all files.
1191 .It Fl P
1192 Interpret all arguments as paths only.
1193 This option can be used to resolve ambiguity in cases where paths
1194 look like tag names, reference names, or object IDs.
1195 This option is only valid when
1196 .Cm got diff
1197 is invoked in a work tree.
1198 .It Fl r Ar repository-path
1199 Use the repository at the specified path.
1200 If not specified, assume the repository is located at or above the current
1201 working directory.
1202 If this directory is a
1203 .Nm
1204 work tree, use the repository path associated with this work tree.
1205 .It Fl s
1206 Show changes staged with
1207 .Cm got stage
1208 instead of showing local changes in the work tree.
1209 This option is only valid when
1210 .Cm got diff
1211 is invoked in a work tree.
1212 .It Fl w
1213 Ignore whitespace-only changes.
1214 .El
1215 .Tg bl
1216 .It Xo
1217 .Cm blame
1218 .Op Fl c Ar commit
1219 .Op Fl r Ar repository-path
1220 .Ar path
1221 .Xc
1222 .Dl Pq alias: Cm bl
1223 Display line-by-line history of a file at the specified path.
1224 .Pp
1225 The options for
1226 .Cm got blame
1227 are as follows:
1228 .Bl -tag -width Ds
1229 .It Fl c Ar commit
1230 Start traversing history at the specified
1231 .Ar commit .
1232 The expected argument is a commit ID SHA1 hash, or a reference name
1233 or a keyword which will be resolved to a commit ID.
1234 An abbreviated hash argument will be expanded to a full SHA1 hash
1235 automatically, provided the abbreviation is unique.
1236 The keywords
1237 .Qq :base
1238 and
1239 .Qq :head
1240 resolve to the work tree's base commit and branch head, respectively.
1241 The former is only valid if invoked in a work tree, while the latter will
1242 resolve to the tip of the work tree's current branch if invoked in a
1243 work tree, otherwise it will resolve to the repository's HEAD reference.
1244 Keywords and references may be appended with
1245 .Qq :+
1247 .Qq :-
1248 modifiers and an optional integer N to denote the
1249 Nth descendant or antecedent by first parent traversal, respectively;
1250 for example,
1251 .Sy :head:-2
1252 denotes the work tree branch head's 2nd generation ancestor, and
1253 .Sy :base:+4
1254 denotes the 4th generation descendant of the work tree's base commit.
1255 Similarly,
1256 .Sy xyz:-5
1257 will denote the 5th generation ancestor of the commit resolved by the
1258 .Qq xyz
1259 reference.
1261 .Qq :+
1263 .Qq :-
1264 modifier without a trailing integer has an implicit
1265 .Qq 1
1266 appended
1267 .Po e.g.,
1268 .Sy :base:+
1269 is equivalent to
1270 .Sy :base:+1
1271 .Pc .
1272 .It Fl r Ar repository-path
1273 Use the repository at the specified path.
1274 If not specified, assume the repository is located at or above the current
1275 working directory.
1276 If this directory is a
1277 .Nm
1278 work tree, use the repository path associated with this work tree.
1279 .El
1280 .Tg tr
1281 .It Xo
1282 .Cm tree
1283 .Op Fl iR
1284 .Op Fl c Ar commit
1285 .Op Fl r Ar repository-path
1286 .Op Ar path
1287 .Xc
1288 .Dl Pq alias: Cm tr
1289 Display a listing of files and directories at the specified
1290 directory path in the repository.
1291 Entries shown in this listing may carry one of the following trailing
1292 annotations:
1293 .Bl -column YXZ description
1294 .It @ Ta entry is a symbolic link
1295 .It / Ta entry is a directory
1296 .It * Ta entry is an executable file
1297 .It $ Ta entry is a Git submodule
1298 .El
1299 .Pp
1300 Symbolic link entries are also annotated with the target path of the link.
1301 .Pp
1302 If no
1303 .Ar path
1304 is specified, list the repository path corresponding to the current
1305 directory of the work tree, or the root directory of the repository
1306 if there is no work tree.
1307 .Pp
1308 The options for
1309 .Cm got tree
1310 are as follows:
1311 .Bl -tag -width Ds
1312 .It Fl c Ar commit
1313 List files and directories as they appear in the specified
1314 .Ar commit .
1315 .Pp
1316 The expected argument is a commit ID SHA1 hash, or a reference name
1317 or a keyword which will be resolved to a commit ID.
1318 An abbreviated hash argument will be expanded to a full SHA1 hash
1319 automatically, provided the abbreviation is unique.
1320 The keywords
1321 .Qq :base
1322 and
1323 .Qq :head
1324 resolve to the work tree's base commit and branch head, respectively.
1325 The former is only valid if invoked in a work tree, while the latter will
1326 resolve to the tip of the work tree's current branch if invoked in a
1327 work tree, otherwise it will resolve to the repository's HEAD reference.
1328 Keywords and references may be appended with
1329 .Qq :+
1331 .Qq :-
1332 modifiers and an optional integer N to denote the
1333 Nth descendant or antecedent by first parent traversal, respectively;
1334 for example,
1335 .Sy :head:-2
1336 denotes the work tree branch head's 2nd generation ancestor, and
1337 .Sy :base:+4
1338 denotes the 4th generation descendant of the work tree's base commit.
1339 Similarly,
1340 .Sy spam:-3
1341 will denote the 3rd generation ancestor of the commit resolved by the
1342 .Qq spam
1343 reference.
1345 .Qq :+
1347 .Qq :-
1348 modifier without a trailing integer has an implicit
1349 .Qq 1
1350 appended
1351 .Po e.g.,
1352 .Sy :base:+
1353 is equivalent to
1354 .Sy :base:+1
1355 .Pc .
1356 .It Fl i
1357 Show object IDs of files (blob objects) and directories (tree objects).
1358 .It Fl R
1359 Recurse into sub-directories in the repository.
1360 .It Fl r Ar repository-path
1361 Use the repository at the specified path.
1362 If not specified, assume the repository is located at or above the current
1363 working directory.
1364 If this directory is a
1365 .Nm
1366 work tree, use the repository path associated with this work tree.
1367 .El
1368 .It Xo
1369 .Cm ref
1370 .Op Fl dlt
1371 .Op Fl c Ar object
1372 .Op Fl r Ar repository-path
1373 .Op Fl s Ar reference
1374 .Op Ar name
1375 .Xc
1376 Manage references in a repository.
1377 .Pp
1378 References may be listed, created, deleted, and changed.
1379 When creating, deleting, or changing a reference the specified
1380 .Ar name
1381 must be an absolute reference name, i.e. it must begin with
1382 .Dq refs/ .
1383 .Pp
1384 The options for
1385 .Cm got ref
1386 are as follows:
1387 .Bl -tag -width Ds
1388 .It Fl c Ar object
1389 Create a reference or change an existing reference.
1390 The reference with the specified
1391 .Ar name
1392 will point at the specified
1393 .Ar object .
1394 .Pp
1395 The expected
1396 .Ar object
1397 argument is an ID SHA1 hash or an existing reference or tag name
1398 or a keyword which will be resolved to the ID of a corresponding commit,
1399 tree, tag, or blob object.
1400 An abbreviated hash argument will be expanded to a full SHA1 hash
1401 automatically, provided the abbreviation is unique.
1402 The keywords
1403 .Qq :base
1404 and
1405 .Qq :head
1406 resolve to the work tree's base commit and branch head, respectively.
1407 The former is only valid if invoked in a work tree, while the latter will
1408 resolve to the tip of the work tree's current branch if invoked in a
1409 work tree, otherwise it will resolve to the repository's HEAD reference.
1410 Keywords and reference names may be appended with
1411 .Qq :+
1413 .Qq :-
1414 modifiers and an optional integer N to denote the
1415 Nth descendant or antecedent by first parent traversal, respectively;
1416 for example,
1417 .Sy :head:-2
1418 denotes the work tree branch head's 2nd generation ancestor, and
1419 .Sy tagged:-3
1420 will denote the 3rd generation ancestor of the commit resolved by the
1421 .Qq tagged
1422 reference.
1423 If an integer does not follow the
1424 .Qq :+
1426 .Qq :-
1427 modifier, a
1428 .Qq 1
1429 is implicitly appended
1430 .Po e.g.,
1431 .Sy :head:-
1432 is equivalent to
1433 .Sy :head:-1
1434 .Pc .
1435 .Pp
1436 Cannot be used together with any other options except
1437 .Fl r .
1438 .It Fl d
1439 Delete the reference with the specified
1440 .Ar name
1441 from the repository.
1442 Any commit, tree, tag, and blob objects belonging to deleted references
1443 remain in the repository and may be removed separately with
1444 Git's garbage collector or
1445 .Cm gotadmin cleanup .
1446 Cannot be used together with any other options except
1447 .Fl r .
1448 .It Fl l
1449 List references in the repository.
1450 If no
1451 .Ar name
1452 is specified, list all existing references in the repository.
1454 .Ar name
1455 is a reference namespace, list all references in this namespace.
1456 Otherwise, show only the reference with the given
1457 .Ar name .
1458 Cannot be used together with any other options except
1459 .Fl r
1460 and
1461 .Fl t .
1462 .It Fl r Ar repository-path
1463 Use the repository at the specified path.
1464 If not specified, assume the repository is located at or above the current
1465 working directory.
1466 If this directory is a
1467 .Nm
1468 work tree, use the repository path associated with this work tree.
1469 .It Fl s Ar reference
1470 Create a symbolic reference, or change an existing symbolic reference.
1471 The symbolic reference with the specified
1472 .Ar name
1473 will point at the specified
1474 .Ar reference
1475 which must already exist in the repository.
1476 Care should be taken not to create loops between references when
1477 this option is used.
1478 Cannot be used together with any other options except
1479 .Fl r .
1480 .It Fl t
1481 Sort listed references by modification time (most recently modified first)
1482 instead of sorting by lexicographical order.
1483 Use of this option requires the
1484 .Fl l
1485 option to be used as well.
1486 .El
1487 .Tg br
1488 .It Xo
1489 .Cm branch
1490 .Op Fl lnt
1491 .Op Fl c Ar commit
1492 .Op Fl d Ar name
1493 .Op Fl r Ar repository-path
1494 .Op Ar name
1495 .Xc
1496 .Dl Pq alias: Cm br
1497 Create, list, or delete branches.
1498 .Pp
1499 Local branches are managed via references which live in the
1500 .Dq refs/heads/
1501 reference namespace.
1502 The
1503 .Cm got branch
1504 command creates references in this namespace only.
1505 .Pp
1506 When deleting branches, the specified
1507 .Ar name
1508 is searched in the
1509 .Dq refs/heads
1510 reference namespace first.
1511 If no corresponding branch is found, the
1512 .Dq refs/remotes
1513 namespace will be searched next.
1514 .Pp
1515 If invoked in a work tree without any arguments, print the name of the
1516 work tree's current branch.
1517 .Pp
1518 If a
1519 .Ar name
1520 argument is passed, attempt to create a branch reference with the given name.
1521 By default the new branch reference will point at the latest commit on the
1522 work tree's current branch if invoked in a work tree, and otherwise to a commit
1523 resolved via the repository's HEAD reference.
1524 .Pp
1525 If invoked in a work tree, once the branch was created successfully
1526 switch the work tree's head reference to the newly created branch and
1527 update files across the entire work tree, just like
1528 .Cm got update -b Ar name
1529 would do.
1530 Show the status of each affected file, using the following status codes:
1531 .Bl -column YXZ description
1532 .It U Ta file was updated and contained no local changes
1533 .It G Ta file was updated and local changes were merged cleanly
1534 .It C Ta file was updated and conflicts occurred during merge
1535 .It D Ta file was deleted
1536 .It A Ta new file was added
1537 .It \(a~ Ta versioned file is obstructed by a non-regular file
1538 .It ! Ta a missing versioned file was restored
1539 .El
1540 .Pp
1541 The options for
1542 .Cm got branch
1543 are as follows:
1544 .Bl -tag -width Ds
1545 .It Fl c Ar commit
1546 Make a newly created branch reference point at the specified
1547 .Ar commit .
1548 The expected argument is a commit ID SHA1 hash, or a reference name or keyword
1549 which will be resolved to a commit ID.
1550 An abbreviated hash argument will be expanded to a full SHA1 hash
1551 automatically, provided the abbreviation is unique.
1552 The keywords
1553 .Qq :base
1554 and
1555 .Qq :head
1556 resolve to the work tree's base commit and branch head, respectively.
1557 The former is only valid if invoked in a work tree, while the latter will
1558 resolve to the tip of the work tree's current branch if invoked in a
1559 work tree, otherwise it will resolve to the repository's HEAD reference.
1560 Keywords and references may be appended with
1561 .Qq :+
1563 .Qq :-
1564 modifiers and an optional integer N to denote the
1565 Nth descendant or antecedent by first parent traversal, respectively;
1566 for example,
1567 .Sy :head:-2
1568 denotes the work tree branch head's 2nd generation ancestor, and
1569 .Sy :base:+4
1570 denotes the 4th generation descendant of the work tree's base commit.
1571 Similarly,
1572 .Sy foobar:+3
1573 will denote the 3rd generation descendant of the commit resolved by the
1574 .Qq foobar
1575 reference.
1577 .Qq :+
1579 .Qq :-
1580 modifier without a trailing integer has an implicit
1581 .Qq 1
1582 appended
1583 .Po e.g.,
1584 .Sy :base:+
1585 is equivalent to
1586 .Sy :base:+1
1587 .Pc .
1588 .It Fl d Ar name
1589 Delete the branch with the specified
1590 .Ar name
1591 from the
1592 .Dq refs/heads
1594 .Dq refs/remotes
1595 reference namespace.
1596 .Pp
1597 Only the branch reference is deleted.
1598 Any commit, tree, and blob objects belonging to the branch
1599 remain in the repository and may be removed separately with
1600 Git's garbage collector or
1601 .Cm gotadmin cleanup .
1602 .It Fl l
1603 List all existing branches in the repository, including copies of remote
1604 repositories' branches in the
1605 .Dq refs/remotes/
1606 reference namespace.
1607 .Pp
1608 If invoked in a work tree, the work tree's current branch is shown
1609 with one of the following annotations:
1610 .Bl -column YXZ description
1611 .It * Ta work tree's base commit and the base commit of all tracked files
1612 matches the branch tip
1613 .It \(a~ Ta work tree comprises mixed commits or its base commit is out-of-date
1614 .El
1615 .It Fl n
1616 Do not switch and update the work tree after creating a new branch.
1617 .It Fl r Ar repository-path
1618 Use the repository at the specified path.
1619 If not specified, assume the repository is located at or above the current
1620 working directory.
1621 If this directory is a
1622 .Nm
1623 work tree, use the repository path associated with this work tree.
1624 .It Fl t
1625 Sort listed branches by modification time (most recently modified first)
1626 instead of sorting by lexicographical order.
1627 Branches in the
1628 .Dq refs/heads/
1629 reference namespace are listed before branches in
1630 .Dq refs/remotes/
1631 regardless.
1632 Use of this option requires the
1633 .Fl l
1634 option to be used as well.
1635 .El
1636 .It Xo
1637 .Cm tag
1638 .Op Fl lVv
1639 .Op Fl c Ar commit
1640 .Op Fl m Ar message
1641 .Op Fl r Ar repository-path
1642 .Op Fl s Ar signer-id
1643 .Ar name
1644 .Xc
1645 Manage tags in a repository.
1646 .Pp
1647 Tags are managed via references which live in the
1648 .Dq refs/tags/
1649 reference namespace.
1650 The
1651 .Cm got tag
1652 command operates on references in this namespace only.
1653 References in this namespace point at tag objects which contain a pointer
1654 to another object, a tag message, as well as author and timestamp information.
1655 .Pp
1656 Attempt to create a tag with the given
1657 .Ar name ,
1658 and make this tag point at the given
1659 .Ar commit .
1660 If no commit is specified, default to the latest commit on the work tree's
1661 current branch if invoked in a work tree, and to a commit resolved via
1662 the repository's HEAD reference otherwise.
1663 .Pp
1664 The options for
1665 .Cm got tag
1666 are as follows:
1667 .Bl -tag -width Ds
1668 .It Fl c Ar commit
1669 Make the newly created tag reference point at the specified
1670 .Ar commit .
1671 The expected
1672 .Ar commit
1673 argument is a commit ID SHA1 hash, or a reference or keyword
1674 which will be resolved to a commit ID.
1675 An abbreviated hash argument will be expanded to a full SHA1 hash
1676 automatically, provided the abbreviation is unique.
1677 The keywords
1678 .Qq :base
1679 and
1680 .Qq :head
1681 resolve to the work tree's base commit and branch head, respectively.
1682 The former is only valid if invoked in a work tree, while the latter will
1683 resolve to the tip of the work tree's current branch if invoked in a
1684 work tree, otherwise it will resolve to the repository's HEAD reference.
1685 Keywords and references may be appended with
1686 .Qq :+
1688 .Qq :-
1689 modifiers and an optional integer N to denote the
1690 Nth descendant or antecedent by first parent traversal, respectively;
1691 for example,
1692 .Sy :head:-2
1693 denotes the work tree branch head's 2nd generation ancestor, and
1694 .Sy :base:+4
1695 denotes the 4th generation descendant of the work tree's base commit.
1696 Similarly,
1697 .Sy eggs:-3
1698 will denote the 3rd generation ancestor of the commit resolved by the
1699 .Qq eggs
1700 reference.
1702 .Qq :+
1704 .Qq :-
1705 modifier without a trailing integer has an implicit
1706 .Qq 1
1707 appended
1708 .Po e.g.,
1709 .Sy :base:+
1710 is equivalent to
1711 .Sy :base:+1
1712 .Pc .
1713 .It Fl l
1714 List all existing tags in the repository instead of creating a new tag.
1715 If a
1716 .Ar name
1717 argument is passed, show only the tag with the given
1718 .Ar name .
1719 .It Fl m Ar message
1720 Use the specified tag message when creating the new tag.
1721 Without the
1722 .Fl m
1723 option,
1724 .Cm got tag
1725 opens a temporary file in an editor where a tag message can be written.
1726 Quitting the editor without saving the file will abort the tag operation.
1727 .It Fl r Ar repository-path
1728 Use the repository at the specified path.
1729 If not specified, assume the repository is located at or above the current
1730 working directory.
1731 If this directory is a
1732 .Nm
1733 work tree, use the repository path associated with this work tree.
1734 .It Fl s Ar signer-id
1735 While creating a new tag, sign this tag with the identity given in
1736 .Ar signer-id .
1737 .Pp
1738 For SSH-based signatures,
1739 .Ar signer-id
1740 is the path to a file which may refer to either a private SSH key,
1741 or a public SSH key with the private half available via
1742 .Xr ssh-agent 1 .
1743 .Cm got tag
1744 will sign the tag object by invoking
1745 .Xr ssh-keygen 1
1746 with the
1747 .Fl Y Cm sign
1748 command, using the signature namespace
1749 .Dq git
1750 for compatibility with
1751 .Xr git 1 .
1752 .It Fl V
1753 Verify tag object signatures.
1754 If a
1755 .Ar name
1756 is specified, show and verify the tag object with the provided name.
1757 Otherwise, list all tag objects and verify signatures where present.
1758 .Pp
1759 .Cm got tag
1760 verifies SSH-based signatures by invoking
1761 .Xr ssh-keygen 1
1762 with the options
1763 .Fl Y Cm verify Fl f Ar allowed_signers .
1764 A path to the
1765 .Ar allowed_signers
1766 file must be set in
1767 .Xr got.conf 5 ,
1768 otherwise verification is impossible.
1769 .It Fl v
1770 Verbose mode.
1771 During SSH signature creation and verification this option will be passed to
1772 .Xr ssh-keygen 1 .
1773 Multiple -v options increase the verbosity.
1774 The maximum is 3.
1775 .El
1776 .Pp
1777 By design, the
1778 .Cm got tag
1779 command will not delete tags or change existing tags.
1780 If a tag must be deleted, the
1781 .Cm got ref
1782 command may be used to delete a tag's reference.
1783 This should only be done if the tag has not already been copied to
1784 another repository.
1785 .It Xo
1786 .Cm add
1787 .Op Fl IR
1788 .Ar path ...
1789 .Xc
1790 Schedule unversioned files in a work tree for addition to the
1791 repository in the next commit.
1792 By default, files which match a
1793 .Cm got status
1794 ignore pattern will not be added.
1795 .Pp
1796 If a
1797 .Ar path
1798 mentioned in the command line is not an unversioned file then
1799 .Cm got add
1800 may raise an error.
1801 To avoid unnecessary errors from paths picked up by file globbing patterns
1802 in the shell, paths in the argument list will be silently ignored if they
1803 are not reported by
1804 .Cm got status
1805 at all, or if they are reported with one of the following status codes
1806 and do not have changes staged via
1807 .Cm got stage :
1808 .Bl -column YXZ description
1809 .It M Ta modified file
1810 .It A Ta file scheduled for addition in next commit
1811 .It C Ta modified or added file which contains merge conflicts
1812 .It m Ta modified file modes (executable bit only)
1813 .El
1814 .Pp
1815 The options for
1816 .Cm got add
1817 are as follows:
1818 .Bl -tag -width Ds
1819 .It Fl I
1820 Add files even if they match a
1821 .Cm got status
1822 ignore pattern.
1823 .It Fl R
1824 Permit recursion into directories.
1825 If this option is not specified,
1826 .Cm got add
1827 will refuse to run if a specified
1828 .Ar path
1829 is a directory.
1830 .El
1831 .Tg rm
1832 .It Xo
1833 .Cm remove
1834 .Op Fl fkR
1835 .Op Fl s Ar status-codes
1836 .Ar path ...
1837 .Xc
1838 .Dl Pq alias: Cm rm
1839 Remove versioned files from a work tree and schedule them for deletion
1840 from the repository in the next commit.
1841 .Pp
1842 The options for
1843 .Cm got remove
1844 are as follows:
1845 .Bl -tag -width Ds
1846 .It Fl f
1847 Perform the operation even if a file contains local modifications,
1848 and do not raise an error if a specified
1849 .Ar path
1850 does not exist on disk.
1851 .It Fl k
1852 Keep affected files on disk.
1853 .It Fl R
1854 Permit recursion into directories.
1855 If this option is not specified,
1856 .Cm got remove
1857 will refuse to run if a specified
1858 .Ar path
1859 is a directory.
1860 .It Fl s Ar status-codes
1861 Only delete files with a modification status matching one of the
1862 single-character status codes contained in the
1863 .Ar status-codes
1864 argument.
1865 The following status codes may be specified:
1866 .Bl -column YXZ description
1867 .It M Ta modified file (this implies the
1868 .Fl f
1869 option)
1870 .It ! Ta versioned file expected on disk but missing
1871 .El
1872 .El
1873 .Tg pa
1874 .It Xo
1875 .Cm patch
1876 .Op Fl nR
1877 .Op Fl c Ar commit
1878 .Op Fl p Ar strip-count
1879 .Op Ar patchfile
1880 .Xc
1881 .Dl Pq alias: Cm pa
1882 Apply changes from
1883 .Ar patchfile
1884 to files in a work tree.
1885 Files added or removed by a patch will be scheduled for addition or removal in
1886 the work tree.
1887 .Pp
1888 The patch must be in the unified diff format as produced by
1889 .Cm got diff ,
1890 .Xr git-diff 1 ,
1891 or by
1892 .Xr diff 1
1893 and
1894 .Xr cvs 1
1895 diff when invoked with their
1896 .Fl u
1897 options.
1898 If no
1899 .Ar patchfile
1900 argument is provided, read unified diff data from standard input instead.
1901 .Pp
1902 If the
1903 .Ar patchfile
1904 contains multiple patches, then attempt to apply each of them in sequence.
1905 .Pp
1906 Show the status of each affected file, using the following status codes:
1907 .Bl -column XYZ description
1908 .It M Ta file was modified
1909 .It G Ta file was merged using a merge-base found in the repository
1910 .It C Ta file was merged and conflicts occurred during merge
1911 .It D Ta file was deleted
1912 .It A Ta file was added
1913 .It # Ta failed to patch the file
1914 .El
1915 .Pp
1916 If a change does not match at its exact line number, attempt to
1917 apply it somewhere else in the file if a good spot can be found.
1918 Otherwise, the patch will fail to apply.
1919 .Pp
1920 .Nm
1921 .Cm patch
1922 will refuse to apply a patch if certain preconditions are not met.
1923 Files to be deleted must already be under version control, and must
1924 not have been scheduled for deletion already.
1925 Files to be added must not yet be under version control and must not
1926 already be present on disk.
1927 Files to be modified must already be under version control and may not
1928 contain conflict markers.
1929 .Pp
1930 If an error occurs, the
1931 .Cm patch
1932 operation will be aborted.
1933 Any changes made to the work tree up to this point will be left behind.
1934 Such changes can be viewed with
1935 .Cm got diff
1936 and can be reverted with
1937 .Cm got revert
1938 if needed.
1939 .Pp
1940 The options for
1941 .Cm got patch
1942 are as follows:
1943 .Bl -tag -width Ds
1944 .It Fl c Ar commit
1945 Attempt to locate files within the specified
1946 .Ar commit
1947 for use as a merge-base for 3-way merges.
1948 .Pp
1949 If the
1950 .Fl c
1951 option is not used then
1952 .Cm got patch
1953 will attempt to locate merge-bases via object IDs found in
1954 .Ar patchfile
1955 meta-data, such as produced by
1956 .Cm got diff
1958 .Xr git-diff 1 .
1959 Use of the
1960 .Fl c
1961 option is only recommended in the absence of such meta-data.
1962 .Pp
1963 Ideally, the specified
1964 .Ar commit
1965 should contain versions of files which the changes contained in the
1966 .Ar patchfile
1967 were based on.
1968 Files will be located by path, relative to the repository root.
1969 If the
1970 .Fl p
1971 option is used then leading path components will be stripped
1972 before paths are looked up in the repository.
1973 .Pp
1974 In case no merge-base is available for a file, changes will be applied
1975 without doing a 3-way merge.
1976 Changes which do not apply cleanly may then be rejected entirely, rather
1977 than producing merge conflicts in the patched target file.
1978 .Pp
1979 The expected
1980 .Ar commit
1981 argument is a commit ID SHA1 hash, or a reference name or a keyword
1982 which will be resolved to a commit ID.
1983 An abbreviated hash argument will be expanded to a full SHA1 hash
1984 automatically, provided the abbreviation is unique.
1985 The keywords
1986 .Qq :base
1987 and
1988 .Qq :head
1989 resolve to the work tree's base commit and branch head, respectively.
1990 Keywords and references may be appended with
1991 .Qq :+
1993 .Qq :-
1994 modifiers and an optional integer N to denote the
1995 Nth descendant or antecedent by first parent traversal, respectively;
1996 for example,
1997 .Sy :head:-2
1998 denotes the work tree branch head's 2nd generation ancestor, and
1999 .Sy :base:+4
2000 denotes the 4th generation descendant of the work tree's base commit.
2001 Similarly,
2002 .Sy flan:+3
2003 will denote the 3rd generation descendant of the commit resolved by the
2004 .Qq flan
2005 reference.
2007 .Qq :+
2009 .Qq :-
2010 modifier without a trailing integer has an implicit
2011 .Qq 1
2012 appended
2013 .Po e.g.,
2014 .Sy :base:+
2015 is equivalent to
2016 .Sy :base:+1
2017 .Pc .
2018 .It Fl n
2019 Do not make any modifications to the work tree.
2020 This can be used to check whether a patch would apply without issues.
2021 If the
2022 .Ar patchfile
2023 contains diffs that affect the same file multiple times, the results
2024 displayed may be incorrect.
2025 .It Fl p Ar strip-count
2026 Specify the number of leading path components to strip from paths
2027 parsed from
2028 .Ar patchfile .
2029 If the
2030 .Fl p
2031 option is not used,
2032 .Sq a/
2033 and
2034 .Sq b/
2035 path prefixes generated by
2036 .Xr git-diff 1
2037 will be recognized and stripped automatically.
2038 .It Fl R
2039 Reverse the patch before applying it.
2040 .El
2041 .Tg rv
2042 .It Xo
2043 .Cm revert
2044 .Op Fl pR
2045 .Op Fl F Ar response-script
2046 .Ar path ...
2047 .Xc
2048 .Dl Pq alias: Cm rv
2049 Revert any local changes in files at the specified paths in a work tree.
2050 File contents will be overwritten with those contained in the
2051 work tree's base commit.
2052 There is no way to bring discarded changes back after
2053 .Cm got revert !
2054 .Pp
2055 If a file was added with
2056 .Cm got add ,
2057 it will become an unversioned file again.
2058 If a file was deleted with
2059 .Cm got remove ,
2060 it will be restored.
2061 .Pp
2062 The options for
2063 .Cm got revert
2064 are as follows:
2065 .Bl -tag -width Ds
2066 .It Fl F Ar response-script
2067 With the
2068 .Fl p
2069 option, read
2070 .Dq y ,
2071 .Dq n ,
2072 and
2073 .Dq q
2074 responses line-by-line from the specified
2075 .Ar response-script
2076 file instead of prompting interactively.
2077 .It Fl p
2078 Instead of reverting all changes in files, interactively select or reject
2079 changes to revert based on
2080 .Dq y
2081 (revert change),
2082 .Dq n
2083 (keep change), and
2084 .Dq q
2085 (quit reverting this file) responses.
2086 If a file is in modified status, individual patches derived from the
2087 modified file content can be reverted.
2088 Files in added or deleted status may only be reverted in their entirety.
2089 .It Fl R
2090 Permit recursion into directories.
2091 If this option is not specified,
2092 .Cm got revert
2093 will refuse to run if a specified
2094 .Ar path
2095 is a directory.
2096 .El
2097 .Tg ci
2098 .It Xo
2099 .Cm commit
2100 .Op Fl CNnS
2101 .Op Fl A Ar author
2102 .Op Fl F Ar path
2103 .Op Fl m Ar message
2104 .Op Ar path ...
2105 .Xc
2106 .Dl Pq alias: Cm ci
2107 Create a new commit in the repository from changes in a work tree
2108 and use this commit as the new base commit for the work tree.
2109 If no
2110 .Ar path
2111 is specified, commit all changes in the work tree.
2112 Otherwise, commit changes at or within the specified paths.
2113 .Pp
2114 If changes have been explicitly staged for commit with
2115 .Cm got stage ,
2116 only commit staged changes and reject any specified paths which
2117 have not been staged.
2118 .Pp
2119 .Cm got commit
2120 opens a temporary file in an editor where a log message can be written
2121 unless the
2122 .Fl m
2123 option is used
2124 or the
2125 .Fl F
2126 and
2127 .Fl N
2128 options are used together.
2129 Quitting the editor without saving the file will abort the commit operation.
2130 .Pp
2131 Show the status of each affected file, using the following status codes:
2132 .Bl -column YXZ description
2133 .It M Ta modified file
2134 .It D Ta file was deleted
2135 .It A Ta new file was added
2136 .It m Ta modified file modes (executable bit only)
2137 .El
2138 .Pp
2139 Files which are not part of the new commit will retain their previously
2140 recorded base commit.
2141 Some
2142 .Nm
2143 commands may refuse to run while the work tree contains files from
2144 multiple base commits.
2145 The base commit of such a work tree can be made consistent by running
2146 .Cm got update
2147 across the entire work tree.
2148 .Pp
2149 The
2150 .Cm got commit
2151 command requires the
2152 .Ev GOT_AUTHOR
2153 environment variable to be set,
2154 unless an author has been configured in
2155 .Xr got.conf 5
2156 or Git's
2157 .Dv user.name
2158 and
2159 .Dv user.email
2160 configuration settings can be
2161 obtained from the repository's
2162 .Pa .git/config
2163 file or from Git's global
2164 .Pa ~/.gitconfig
2165 configuration file.
2166 .Pp
2167 The options for
2168 .Cm got commit
2169 are as follows:
2170 .Bl -tag -width Ds
2171 .It Fl A Ar author
2172 Set author information in the newly created commit to
2173 .Ar author .
2174 This is useful when committing changes on behalf of someone else.
2175 The
2176 .Ar author
2177 argument must use the same format as the
2178 .Ev GOT_AUTHOR
2179 environment variable.
2180 .Pp
2181 In addition to storing author information, the newly created commit
2182 object will retain
2183 .Dq committer
2184 information which is obtained, as usual, from the
2185 .Ev GOT_AUTHOR
2186 environment variable, or
2187 .Xr got.conf 5 ,
2188 or Git configuration settings.
2189 .It Fl C
2190 Allow committing files in conflicted status.
2191 .Pp
2192 Committing files with conflict markers should generally be avoided.
2193 Cases where conflict markers must be stored in the repository for
2194 some legitimate reason should be very rare.
2195 There are usually ways to avoid storing conflict markers verbatim by
2196 applying appropriate programming tricks.
2197 .It Fl F Ar path
2198 Use the prepared log message stored in the file found at
2199 .Ar path
2200 when creating the new commit.
2201 .Cm got commit
2202 opens a temporary file in an editor where the prepared log message can be
2203 reviewed and edited further if needed.
2204 Cannot be used together with the
2205 .Fl m
2206 option.
2207 .It Fl m Ar message
2208 Use the specified log message when creating the new commit.
2209 Cannot be used together with the
2210 .Fl F
2211 option.
2212 .It Fl N
2213 This option prevents
2214 .Cm got commit
2215 from opening the commit message in an editor.
2216 It has no effect unless it is used together with the
2217 .Fl F
2218 option and is intended for non-interactive use such as scripting.
2219 .It Fl n
2220 This option prevents
2221 .Cm got commit
2222 from generating a diff of the to-be-committed changes in a temporary file
2223 which can be viewed while editing a commit message.
2224 .It Fl S
2225 Allow the addition of symbolic links which point outside of the path space
2226 that is under version control.
2227 By default,
2228 .Cm got commit
2229 will reject such symbolic links due to safety concerns.
2230 As a precaution,
2231 .Nm
2232 may decide to represent such a symbolic link as a regular file which contains
2233 the link's target path, rather than creating an actual symbolic link which
2234 points outside of the work tree.
2235 Use of this option is discouraged because external mechanisms such as
2236 .Dq make obj
2237 are better suited for managing symbolic links to paths not under
2238 version control.
2239 .El
2240 .Pp
2241 .Cm got commit
2242 will refuse to run if certain preconditions are not met.
2243 If the work tree's current branch is not in the
2244 .Dq refs/heads/
2245 reference namespace, new commits may not be created on this branch.
2246 Local changes may only be committed if they are based on file content
2247 found in the most recent commit on the work tree's branch.
2248 If a path is found to be out of date,
2249 .Cm got update
2250 must be used first in order to merge local changes with changes made
2251 in the repository.
2252 .Tg se
2253 .It Xo
2254 .Cm send
2255 .Op Fl afqTv
2256 .Op Fl b Ar branch
2257 .Op Fl d Ar branch
2258 .Op Fl r Ar repository-path
2259 .Op Fl t Ar tag
2260 .Op Ar remote-repository
2261 .Xc
2262 .Dl Pq alias: Cm se
2263 Send new changes to a remote repository.
2264 If no
2265 .Ar remote-repository
2266 is specified,
2267 .Dq origin
2268 will be used.
2269 The remote repository's URL is obtained from the corresponding entry in
2270 .Xr got.conf 5
2271 or Git's
2272 .Pa config
2273 file of the local repository, as created by
2274 .Cm got clone .
2275 .Pp
2276 All objects corresponding to new changes will be written to a temporary
2277 pack file which is then uploaded to the server.
2278 Upon success, references in the
2279 .Dq refs/remotes/
2280 reference namespace of the local repository will be updated to point at
2281 the commits which have been sent.
2282 .Pp
2283 By default, changes will only be sent if they are based on up-to-date
2284 copies of relevant branches in the remote repository.
2285 If any changes to be sent are based on out-of-date copies or would
2286 otherwise break linear history of existing branches, new changes must
2287 be fetched from the server with
2288 .Cm got fetch
2289 and local branches must be rebased with
2290 .Cm got rebase
2291 before
2292 .Cm got send
2293 can succeed.
2294 The
2295 .Fl f
2296 option can be used to make exceptions to these requirements.
2297 .Pp
2298 The options for
2299 .Cm got send
2300 are as follows:
2301 .Bl -tag -width Ds
2302 .It Fl a
2303 Send all branches from the local repository's
2304 .Dq refs/heads/
2305 reference namespace.
2306 The
2307 .Fl a
2308 option is equivalent to listing all branches with multiple
2309 .Fl b
2310 options.
2311 Cannot be used together with the
2312 .Fl b
2313 option.
2314 .It Fl b Ar branch
2315 Send the specified
2316 .Ar branch
2317 from the local repository's
2318 .Dq refs/heads/
2319 reference namespace.
2320 This option may be specified multiple times to build a list of branches
2321 to send.
2322 If this option is not specified, default to the work tree's current branch
2323 if invoked in a work tree, or to the repository's HEAD reference.
2324 Cannot be used together with the
2325 .Fl a
2326 option.
2327 .It Fl d Ar branch
2328 Delete the specified
2329 .Ar branch
2330 from the remote repository's
2331 .Dq refs/heads/
2332 reference namespace.
2333 This option may be specified multiple times to build a list of branches
2334 to delete.
2335 .Pp
2336 Only references are deleted.
2337 Any commit, tree, tag, and blob objects belonging to deleted branches
2338 may become subject to deletion by Git's garbage collector running on
2339 the server.
2340 .Pp
2341 Requesting deletion of branches results in an error if the server
2342 does not support this feature or disallows the deletion of branches
2343 based on its configuration.
2344 .It Fl f
2345 Attempt to force the server to overwrite existing branches or tags
2346 in the remote repository, even when
2347 .Cm got fetch
2348 followed by
2349 .Cm got rebase
2351 .Cm got merge
2352 would usually be required before changes can be sent.
2353 The server may reject forced requests regardless, depending on its
2354 configuration.
2355 .Pp
2356 Any commit, tree, tag, and blob objects belonging to overwritten branches
2357 or tags may become subject to deletion by Git's garbage collector running
2358 on the server.
2359 .Pp
2360 The
2361 .Dq refs/tags
2362 reference namespace is globally shared between all repositories.
2363 Use of the
2364 .Fl f
2365 option to overwrite tags is discouraged because it can lead to
2366 inconsistencies between the tags present in different repositories.
2367 In general, creating a new tag with a different name is recommended
2368 instead of overwriting an existing tag.
2369 .Pp
2370 Use of the
2371 .Fl f
2372 option is particularly discouraged if changes being sent are based
2373 on an out-of-date copy of a branch in the remote repository.
2374 Instead of using the
2375 .Fl f
2376 option, new changes should
2377 be fetched with
2378 .Cm got fetch
2379 and local branches should be rebased with
2380 .Cm got rebase
2381 or merged with
2382 .Cm got merge ,
2383 followed by another attempt to send the changes.
2384 .Pp
2385 The
2386 .Fl f
2387 option should only be needed in situations where the remote repository's
2388 copy of a branch or tag is known to be out-of-date and is considered
2389 disposable.
2390 The risks of creating inconsistencies between different repositories
2391 should also be taken into account.
2392 .It Fl q
2393 Suppress progress reporting output.
2394 The same option will be passed to
2395 .Xr ssh 1
2396 if applicable.
2397 .It Fl r Ar repository-path
2398 Use the repository at the specified path.
2399 If not specified, assume the repository is located at or above the current
2400 working directory.
2401 If this directory is a
2402 .Nm
2403 work tree, use the repository path associated with this work tree.
2404 .It Fl T
2405 Attempt to send all tags from the local repository's
2406 .Dq refs/tags/
2407 reference namespace.
2408 The
2409 .Fl T
2410 option is equivalent to listing all tags with multiple
2411 .Fl t
2412 options.
2413 Cannot be used together with the
2414 .Fl t
2415 option.
2416 .It Fl t Ar tag
2417 Send the specified
2418 .Ar tag
2419 from the local repository's
2420 .Dq refs/tags/
2421 reference namespace, in addition to any branches that are being sent.
2422 The
2423 .Fl t
2424 option may be specified multiple times to build a list of tags to send.
2425 No tags will be sent if the
2426 .Fl t
2427 option is not used.
2428 .Pp
2429 Raise an error if the specified
2430 .Ar tag
2431 already exists in the remote repository, unless the
2432 .Fl f
2433 option is used to overwrite the server's copy of the tag.
2434 In general, creating a new tag with a different name is recommended
2435 instead of overwriting an existing tag.
2436 .Pp
2437 Cannot be used together with the
2438 .Fl T
2439 option.
2440 .It Fl v
2441 Verbose mode.
2442 Causes
2443 .Cm got send
2444 to print debugging messages to standard error output.
2445 The same option will be passed to
2446 .Xr ssh 1
2447 if applicable.
2448 Multiple -v options increase the verbosity.
2449 The maximum is 3.
2450 .El
2451 .Tg cy
2452 .It Xo
2453 .Cm cherrypick
2454 .Op Fl lX
2455 .Op Ar commit
2456 .Xc
2457 .Dl Pq alias: Cm cy
2458 Merge changes from a single
2459 .Ar commit
2460 into the work tree.
2461 The specified
2462 .Ar commit
2463 should be on a different branch than the work tree's base commit.
2464 .Pp
2465 The expected argument is a commit ID SHA1 hash, or a reference name or
2466 keyword which will be resolved to a commit ID.
2467 An abbreviated hash argument will be expanded to a full SHA1 hash
2468 automatically, provided the abbreviation is unique.
2469 The keywords
2470 .Qq :base
2471 and
2472 .Qq :head
2473 resolve to the work tree's base commit and branch head, respectively.
2474 Keywords and references may be appended with
2475 .Qq :+
2477 .Qq :-
2478 modifiers and an optional integer N to denote the
2479 Nth descendant or antecedent by first parent traversal, respectively;
2480 for example,
2481 .Sy :head:-2
2482 denotes the work tree branch head's 2nd generation ancestor, and
2483 .Sy :base:+4
2484 denotes the 4th generation descendant of the work tree's base commit.
2485 Similarly,
2486 .Sy barbaz:+3
2487 will denote the 3rd generation descendant of the commit resolved by the
2488 .Qq barbaz
2489 reference.
2491 .Qq :+
2493 .Qq :-
2494 modifier without a trailing integer has an implicit
2495 .Qq 1
2496 appended
2497 .Po e.g.,
2498 .Sy :base:+
2499 is equivalent to
2500 .Sy :base:+1
2501 .Pc .
2502 .Pp
2503 Show the status of each affected file, using the following status codes:
2504 .Bl -column YXZ description
2505 .It G Ta file was merged
2506 .It C Ta file was merged and conflicts occurred during merge
2507 .It ! Ta changes destined for a missing file were not merged
2508 .It D Ta file was deleted
2509 .It d Ta file's deletion was prevented by local modifications
2510 .It A Ta new file was added
2511 .It \(a~ Ta changes destined for a non-regular file were not merged
2512 .It ? Ta changes destined for an unversioned file were not merged
2513 .El
2514 .Pp
2515 The merged changes will appear as local changes in the work tree, which
2516 may be viewed with
2517 .Cm got diff ,
2518 amended manually or with further
2519 .Cm got cherrypick
2520 commands,
2521 committed with
2522 .Cm got commit .
2523 .Pp
2524 If invoked in a work tree where no
2525 .Cm rebase ,
2526 .Cm histedit ,
2528 .Cm merge
2529 operation is taking place,
2530 .Cm got cherrypick
2531 creates a record of commits which have been merged into the work tree.
2532 When a file changed by
2533 .Cm got cherrypick
2534 is committed with
2535 .Cm got commit ,
2536 the log messages of relevant merged commits will then appear in the editor,
2537 where the messages should be further adjusted to convey the reasons for
2538 cherrypicking the changes.
2539 Upon exiting the editor, if the time stamp of the log message file
2540 is unchanged or the log message is empty,
2541 .Cm got commit
2542 will fail with an unmodified or empty log message error.
2543 .Pp
2544 If all the changes in all files touched by a given commit are discarded,
2545 e.g. with
2546 .Cm got revert ,
2547 this commit's log message record will also disappear.
2548 .Pp
2549 .Cm got cherrypick
2550 will refuse to run if certain preconditions are not met.
2551 If the work tree contains multiple base commits, it must first be updated
2552 to a single base commit with
2553 .Cm got update .
2554 If any relevant files already contain merge conflicts, these
2555 conflicts must be resolved first.
2556 .Pp
2557 The options for
2558 .Nm
2559 .Cm cherrypick
2560 are as follows:
2561 .Bl -tag -width Ds
2562 .It Fl l
2563 Display a list of commit log messages recorded by cherrypick operations,
2564 represented by references in the
2565 .Dq refs/got/worktree
2566 reference namespace.
2567 If a
2568 .Ar commit
2569 is specified, only show the log message of the specified commit.
2570 .Pp
2571 If invoked in a work tree, only log messages recorded by cherrypick operations
2572 in the current work tree will be displayed.
2573 Otherwise, all commit log messages will be displayed irrespective of the
2574 work tree in which they were created.
2575 This option cannot be used with
2576 .Fl X .
2577 .It Fl X
2578 Delete log messages created by previous cherrypick operations, represented by
2579 references in the
2580 .Dq refs/got/worktree
2581 reference namespace.
2582 If a
2583 .Ar commit
2584 is specified, only delete the log message of the specified commit.
2585 .Pp
2586 If invoked in a work tree, only log messages recorded by cherrypick operations
2587 in the current work tree will be deleted.
2588 Otherwise, all commit log messages will be deleted irrespective of the
2589 work tree in which they were created.
2590 This option cannot be used with
2591 .Fl l .
2592 .El
2593 .Pp
2594 .Tg bo
2595 .It Xo
2596 .Cm backout
2597 .Op Fl lX
2598 .Op Ar commit
2599 .Xc
2600 .Dl Pq alias: Cm bo
2601 Reverse-merge changes from a single
2602 .Ar commit
2603 into the work tree.
2604 The specified
2605 .Ar commit
2606 should be on the same branch as the work tree's base commit.
2607 .Pp
2608 The expected argument is a commit ID SHA1 hash, or a reference name
2609 or keyword which will be resolved to a commit ID.
2610 An abbreviated hash argument will be expanded to a full SHA1 hash
2611 automatically, provided the abbreviation is unique.
2612 The keywords
2613 .Qq :base
2614 and
2615 .Qq :head
2616 resolve to the work tree's base commit and branch head, respectively.
2617 Keywords and references may be appended with
2618 .Qq :+
2620 .Qq :-
2621 modifiers and an optional integer N to denote the
2622 Nth descendant or antecedent by first parent traversal, respectively;
2623 for example,
2624 .Sy :head:-2
2625 denotes the work tree branch head's 2nd generation ancestor, and
2626 .Sy :base:+4
2627 denotes the 4th generation descendant of the work tree's base commit.
2628 Similarly,
2629 .Sy wip:+5
2630 will denote the 5th generation descendant of the commit resolved by the
2631 .Qq wip
2632 reference.
2634 .Qq :+
2636 .Qq :-
2637 modifier without a trailing integer has an implicit
2638 .Qq 1
2639 appended
2640 .Po e.g.,
2641 .Sy :base:+
2642 is equivalent to
2643 .Sy :base:+1
2644 .Pc .
2645 .Pp
2646 Show the status of each affected file, using the following status codes:
2647 .Bl -column YXZ description
2648 .It G Ta file was merged
2649 .It C Ta file was merged and conflicts occurred during merge
2650 .It ! Ta changes destined for a missing file were not merged
2651 .It D Ta file was deleted
2652 .It d Ta file's deletion was prevented by local modifications
2653 .It A Ta new file was added
2654 .It \(a~ Ta changes destined for a non-regular file were not merged
2655 .It ? Ta changes destined for an unversioned file were not merged
2656 .El
2657 .Pp
2658 The reverse-merged changes will appear as local changes in the work tree,
2659 which may be viewed with
2660 .Cm got diff ,
2661 amended manually or with further
2662 .Cm got backout
2663 commands,
2664 committed with
2665 .Cm got commit .
2666 .Pp
2667 If invoked in a work tree where no
2668 .Cm rebase ,
2669 .Cm histedit ,
2671 .Cm merge
2672 operation is taking place,
2673 .Cm got backout
2674 creates a record of commits which have been reverse-merged into the work tree.
2675 When a file changed by
2676 .Cm got backout
2677 is committed with
2678 .Cm got commit ,
2679 the log messages of relevant reverse-merged commits will then appear in
2680 the editor, where the messages should be further adjusted to convey the
2681 reasons for backing out the changes.
2682 Upon exiting the editor, if the time stamp of the log message file
2683 is unchanged or the log message is empty,
2684 .Cm got commit
2685 will fail with an unmodified or empty log message error.
2686 .Pp
2687 If all the changes in all files touched by a given commit are discarded,
2688 e.g. with
2689 .Cm got revert ,
2690 this commit's log message record will also disappear.
2691 .Pp
2692 .Cm got backout
2693 will refuse to run if certain preconditions are not met.
2694 If the work tree contains multiple base commits, it must first be updated
2695 to a single base commit with
2696 .Cm got update .
2697 If any relevant files already contain merge conflicts, these
2698 conflicts must be resolved first.
2699 .Pp
2700 The options for
2701 .Nm
2702 .Cm backout
2703 are as follows:
2704 .Bl -tag -width Ds
2705 .It Fl l
2706 Display a list of commit log messages recorded by backout operations,
2707 represented by references in the
2708 .Dq refs/got/worktree
2709 reference namespace.
2710 If a
2711 .Ar commit
2712 is specified, only show the log message of the specified commit.
2713 .Pp
2714 If invoked in a work tree, only log messages recorded by backout operations
2715 in the current work tree will be displayed.
2716 Otherwise, all commit log messages will be displayed irrespective of the
2717 work tree in which they were created.
2718 This option cannot be used with
2719 .Fl X .
2720 .It Fl X
2721 Delete log messages created by previous backout operations, represented by
2722 references in the
2723 .Dq refs/got/worktree
2724 reference namespace.
2725 If a
2726 .Ar commit
2727 is specified, only delete the log message of the specified commit.
2728 .Pp
2729 If invoked in a work tree, only log messages recorded by backout operations
2730 in the current work tree will be deleted.
2731 Otherwise, all commit log messages will be deleted irrespective of the
2732 work tree in which they were created.
2733 This option cannot be used with
2734 .Fl l .
2735 .El
2736 .Pp
2737 .Tg rb
2738 .It Xo
2739 .Cm rebase
2740 .Op Fl aCclX
2741 .Op Ar branch
2742 .Xc
2743 .Dl Pq alias: Cm rb
2744 Rebase commits on the specified
2745 .Ar branch
2746 onto the tip of the current branch of the work tree.
2747 The
2748 .Ar branch
2749 must share common ancestry with the work tree's current branch.
2750 Rebasing begins with the first descendant commit of the youngest
2751 common ancestor commit shared by the specified
2752 .Ar branch
2753 and the work tree's current branch, and stops once the tip commit
2754 of the specified
2755 .Ar branch
2756 has been rebased.
2757 .Pp
2758 When
2759 .Cm got rebase
2760 is used as intended, the specified
2761 .Ar branch
2762 represents a local commit history and may already contain changes
2763 that are not yet visible in any other repositories.
2764 The work tree's current branch, which must be set with
2765 .Cm got update -b
2766 before starting the
2767 .Cm rebase
2768 operation, represents a branch from a remote repository which shares
2769 a common history with the specified
2770 .Ar branch
2771 but has progressed, and perhaps diverged, due to commits added to the
2772 remote repository.
2773 .Pp
2774 Rebased commits are accumulated on a temporary branch which the work tree
2775 will remain switched to throughout the entire rebase operation.
2776 Commits on this branch represent the same changes with the same log
2777 messages as their counterparts on the original
2778 .Ar branch ,
2779 but with different commit IDs.
2780 Once rebasing has completed successfully, the temporary branch becomes
2781 the new version of the specified
2782 .Ar branch
2783 and the work tree is automatically switched to it.
2784 If author information is available via the
2785 .Ev GOT_AUTHOR
2786 environment variable,
2787 .Xr got.conf 5
2788 or Git's
2789 .Dv user.name
2790 and
2791 .Dv user.email
2792 configuration settings, this author information will be used to identify
2793 the
2794 .Dq committer
2795 of rebased commits.
2796 .Pp
2797 Old commits in their pre-rebase state are automatically backed up in the
2798 .Dq refs/got/backup/rebase
2799 reference namespace.
2800 As long as these references are not removed older versions of rebased
2801 commits will remain in the repository and can be viewed with the
2802 .Cm got rebase -l
2803 command.
2804 Removal of these references makes objects which become unreachable via
2805 any reference subject to removal by Git's garbage collector or
2806 .Cm gotadmin cleanup .
2807 .Pp
2808 While rebasing commits, show the status of each affected file,
2809 using the following status codes:
2810 .Bl -column YXZ description
2811 .It G Ta file was merged
2812 .It C Ta file was merged and conflicts occurred during merge
2813 .It ! Ta changes destined for a missing file were not merged
2814 .It D Ta file was deleted
2815 .It d Ta file's deletion was prevented by local modifications
2816 .It A Ta new file was added
2817 .It \(a~ Ta changes destined for a non-regular file were not merged
2818 .It ? Ta changes destined for an unversioned file were not merged
2819 .El
2820 .Pp
2821 If merge conflicts occur, the rebase operation is interrupted and may
2822 be continued once conflicts have been resolved.
2823 If any files with destined changes are found to be missing or unversioned,
2824 or if files could not be deleted due to differences in deleted content,
2825 the rebase operation will be interrupted to prevent potentially incomplete
2826 changes from being committed to the repository without user intervention.
2827 The work tree may be modified as desired and the rebase operation can be
2828 continued once the changes present in the work tree are considered complete.
2829 Alternatively, the rebase operation may be aborted which will leave
2830 .Ar branch
2831 unmodified and the work tree switched back to its original branch.
2832 .Pp
2833 If a merge conflict is resolved in a way which renders the merged
2834 change into a no-op change, the corresponding commit will be elided
2835 when the rebase operation continues.
2836 .Pp
2837 .Cm got rebase
2838 will refuse to run if certain preconditions are not met.
2839 If the
2840 .Ar branch
2841 is not in the
2842 .Dq refs/heads/
2843 reference namespace, the branch may not be rebased.
2844 If the work tree is not yet fully updated to the tip commit of its
2845 branch, then the work tree must first be updated with
2846 .Cm got update .
2847 If changes have been staged with
2848 .Cm got stage ,
2849 these changes must first be committed with
2850 .Cm got commit
2851 or unstaged with
2852 .Cm got unstage .
2853 If the work tree contains local changes, these changes must first be
2854 committed with
2855 .Cm got commit
2856 or reverted with
2857 .Cm got revert .
2858 If the
2859 .Ar branch
2860 contains changes to files outside of the work tree's path prefix,
2861 the work tree cannot be used to rebase this branch.
2862 .Pp
2863 The
2864 .Cm got update ,
2865 .Cm got integrate ,
2866 .Cm got merge ,
2867 .Cm got commit ,
2868 and
2869 .Cm got histedit
2870 commands will refuse to run while a rebase operation is in progress.
2871 Other commands which manipulate the work tree may be used for
2872 conflict resolution purposes.
2873 .Pp
2874 If the specified
2875 .Ar branch
2876 is already based on the work tree's current branch, then no commits
2877 need to be rebased and
2878 .Cm got rebase
2879 will simply switch the work tree to the specified
2880 .Ar branch
2881 and update files in the work tree accordingly.
2882 .Pp
2883 The options for
2884 .Cm got rebase
2885 are as follows:
2886 .Bl -tag -width Ds
2887 .It Fl a
2888 Abort an interrupted rebase operation.
2889 If this option is used, no other command-line arguments are allowed.
2890 .It Fl C
2891 Allow a rebase operation to continue with files in conflicted status.
2892 This option should generally be avoided, and can only be used with the
2893 .Fl c
2894 option.
2895 .It Fl c
2896 Continue an interrupted rebase operation.
2897 If this option is used, no other command-line arguments are allowed except
2898 .Fl C .
2899 .It Fl l
2900 Show a list of past rebase operations, represented by references in the
2901 .Dq refs/got/backup/rebase
2902 reference namespace.
2903 .Pp
2904 Display the author, date, and log message of each backed up commit,
2905 the object ID of the corresponding post-rebase commit, and
2906 the object ID of their common ancestor commit.
2907 Given these object IDs,
2908 the
2909 .Cm got log
2910 command with the
2911 .Fl c
2912 and
2913 .Fl x
2914 options can be used to examine the history of either version of the branch,
2915 and the
2916 .Cm got branch
2917 command with the
2918 .Fl c
2919 option can be used to create a new branch from a pre-rebase state if desired.
2920 .Pp
2921 If a
2922 .Ar branch
2923 is specified, only show commits which at some point in time represented this
2924 branch.
2925 Otherwise, list all backed up commits for any branches.
2926 .Pp
2927 If this option is used,
2928 .Cm got rebase
2929 does not require a work tree.
2930 None of the other options can be used together with
2931 .Fl l .
2932 .It Fl X
2933 Delete backups created by past rebase operations, represented by references
2934 in the
2935 .Dq refs/got/backup/rebase
2936 reference namespace.
2937 .Pp
2938 If a
2939 .Ar branch
2940 is specified, only delete backups which at some point in time represented
2941 this branch.
2942 Otherwise, delete all references found within
2943 .Dq refs/got/backup/rebase .
2944 .Pp
2945 Any commit, tree, tag, and blob objects belonging to deleted backups
2946 remain in the repository and may be removed separately with
2947 Git's garbage collector or
2948 .Cm gotadmin cleanup .
2949 .Pp
2950 If this option is used,
2951 .Cm got rebase
2952 does not require a work tree.
2953 None of the other options can be used together with
2954 .Fl X .
2955 .El
2956 .Tg he
2957 .It Xo
2958 .Cm histedit
2959 .Op Fl aCcdeflmX
2960 .Op Fl F Ar histedit-script
2961 .Op Ar branch
2962 .Xc
2963 .Dl Pq alias: Cm he
2964 Edit commit history between the work tree's current base commit and
2965 the tip commit of the work tree's current branch.
2966 .Pp
2967 The
2968 .Cm got histedit
2969 command requires the
2970 .Ev GOT_AUTHOR
2971 environment variable to be set,
2972 unless an author has been configured in
2973 .Xr got.conf 5
2974 or Git's
2975 .Dv user.name
2976 and
2977 .Dv user.email
2978 configuration settings can be obtained from the repository's
2979 .Pa .git/config
2980 file or from Git's global
2981 .Pa ~/.gitconfig
2982 configuration file.
2983 .Pp
2984 Before starting a
2985 .Cm histedit
2986 operation, the work tree's current branch must be set with
2987 .Cm got update -b
2988 to the branch which should be edited, unless this branch is already the
2989 current branch of the work tree.
2990 The tip of this branch represents the upper bound (inclusive) of commits
2991 touched by the
2992 .Cm histedit
2993 operation.
2994 .Pp
2995 Furthermore, the work tree's base commit
2996 must be set with
2997 .Cm got update -c
2998 to a point in this branch's commit history where editing should begin.
2999 This commit represents the lower bound (non-inclusive) of commits touched
3000 by the
3001 .Cm histedit
3002 operation.
3003 .Pp
3004 Editing of commit history is controlled via a
3005 .Ar histedit script
3006 which can be written in an editor based on a template, passed on the
3007 command line, or generated with the
3008 .Fl d ,
3009 .Fl e ,
3010 .Fl f ,
3012 .Fl m
3013 options.
3014 Quitting the editor without saving the file will abort the histedit operation.
3015 .Pp
3016 The format of the histedit script is line-based.
3017 Each line in the script begins with a command name, followed by
3018 whitespace and an argument.
3019 For most commands, the expected argument is a commit ID SHA1 hash.
3020 Any remaining text on the line is ignored.
3021 Lines which begin with the
3022 .Sq #
3023 character are ignored entirely.
3024 .Pp
3025 The available histedit script commands are as follows:
3026 .Bl -column YXZ pick-commit
3027 .It Cm pick Ar commit Ta Use the specified commit as it is.
3028 .It Cm edit Ar commit Ta Apply the changes from the specified commit, but
3029 then interrupt the histedit operation for amending, without creating a commit.
3030 While the histedit operation is interrupted arbitrary files may be edited,
3031 and commands which manipulate the work tree can be used freely.
3032 The
3033 .Cm got add
3034 and
3035 .Cm got remove
3036 commands can be used to add new files or remove existing ones.
3037 The
3038 .Cm got revert -p
3039 command can be used to eliminate arbitrary changes from files in the work tree.
3040 The
3041 .Cm got stage -p
3042 command may be used to prepare a subset of changes for inclusion in the
3043 next commit.
3044 Finally, the
3045 .Cm got commit
3046 command can be used to insert arbitrary commits into the edited history.
3047 Regular editing of history must eventually be resumed by running
3048 .Cm got histedit -c .
3049 .It Cm fold Ar commit Ta Combine the specified commit with the next commit
3050 listed further below that will be used.
3051 .It Cm drop Ar commit Ta Remove this commit from the edited history.
3052 .It Cm mesg Ar commit Ta Open an editor to create a new log message for this
3053 commit.
3054 .El
3055 .Pp
3056 Every commit in the history being edited must be mentioned in the script.
3057 Lines may be re-ordered to change the order of commits in the edited history.
3058 No commit may be listed more than once.
3059 .Pp
3060 Edited commits are accumulated on a temporary branch which the work tree
3061 will remain switched to throughout the entire histedit operation.
3062 Once history editing has completed successfully, the temporary branch becomes
3063 the new version of the work tree's branch and the work tree is automatically
3064 switched to it.
3065 .Pp
3066 Old commits in their pre-histedit state are automatically backed up in the
3067 .Dq refs/got/backup/histedit
3068 reference namespace.
3069 As long as these references are not removed older versions of edited
3070 commits will remain in the repository and can be viewed with the
3071 .Cm got histedit -l
3072 command.
3073 Removal of these references makes objects which become unreachable via
3074 any reference subject to removal by Git's garbage collector or
3075 .Cm gotadmin cleanup .
3076 .Pp
3077 While merging commits, show the status of each affected file,
3078 using the following status codes:
3079 .Bl -column YXZ description
3080 .It G Ta file was merged
3081 .It C Ta file was merged and conflicts occurred during merge
3082 .It ! Ta changes destined for a missing file were not merged
3083 .It D Ta file was deleted
3084 .It d Ta file's deletion was prevented by local modifications
3085 .It A Ta new file was added
3086 .It \(a~ Ta changes destined for a non-regular file were not merged
3087 .It ? Ta changes destined for an unversioned file were not merged
3088 .El
3089 .Pp
3090 If merge conflicts occur, the histedit operation is interrupted and may
3091 be continued once conflicts have been resolved.
3092 If any files with destined changes are found to be missing or unversioned,
3093 or if files could not be deleted due to differences in deleted content,
3094 the histedit operation will be interrupted to prevent potentially incomplete
3095 changes from being committed to the repository without user intervention.
3096 The work tree may be modified as desired and the histedit operation can be
3097 continued once the changes present in the work tree are considered complete.
3098 Alternatively, the histedit operation may be aborted which will leave
3099 the work tree switched back to its original branch.
3100 .Pp
3101 If a merge conflict is resolved in a way which renders the merged
3102 change into a no-op change, the corresponding commit will be elided
3103 when the histedit operation continues.
3104 .Pp
3105 .Cm got histedit
3106 will refuse to run if certain preconditions are not met.
3107 If the work tree's current branch is not in the
3108 .Dq refs/heads/
3109 reference namespace, the history of the branch may not be edited.
3110 If the work tree contains multiple base commits, it must first be updated
3111 to a single base commit with
3112 .Cm got update .
3113 If changes have been staged with
3114 .Cm got stage ,
3115 these changes must first be committed with
3116 .Cm got commit
3117 or unstaged with
3118 .Cm got unstage .
3119 If the work tree contains local changes, these changes must first be
3120 committed with
3121 .Cm got commit
3122 or reverted with
3123 .Cm got revert .
3124 If the edited history contains changes to files outside of the work tree's
3125 path prefix, the work tree cannot be used to edit the history of this branch.
3126 .Pp
3127 The
3128 .Cm got update ,
3129 .Cm got rebase ,
3130 .Cm got merge ,
3131 and
3132 .Cm got integrate
3133 commands will refuse to run while a histedit operation is in progress.
3134 Other commands which manipulate the work tree may be used, and the
3135 .Cm got commit
3136 command may be used to commit arbitrary changes to the temporary branch
3137 while the histedit operation is interrupted.
3138 .Pp
3139 The options for
3140 .Cm got histedit
3141 are as follows:
3142 .Bl -tag -width Ds
3143 .It Fl a
3144 Abort an interrupted histedit operation.
3145 If this option is used, no other command-line arguments are allowed.
3146 .It Fl C
3147 Allow a histedit operation to continue with files in conflicted status.
3148 This option should generally be avoided, and can only be used with the
3149 .Fl c
3150 option.
3151 .It Fl c
3152 Continue an interrupted histedit operation.
3153 If this option is used, no other command-line arguments are allowed except
3154 .Fl C .
3155 .It Fl d
3156 Drop all commits.
3157 This option is a quick equivalent to a histedit script which drops all
3158 commits.
3159 The
3160 .Fl d
3161 option can only be used when starting a new histedit operation.
3162 If this option is used, no other command-line arguments are allowed.
3163 .It Fl e
3164 Interrupt the histedit operation for editing after merging each commit.
3165 This option is a quick equivalent to a histedit script which uses the
3166 .Cm edit
3167 command for all commits.
3168 The
3169 .Fl e
3170 option can only be used when starting a new histedit operation.
3171 If this option is used, no other command-line arguments are allowed.
3172 .It Fl F Ar histedit-script
3173 Use the specified
3174 .Ar histedit-script
3175 instead of opening a temporary file in an editor where a histedit script
3176 can be written.
3177 .It Fl f
3178 Fold all commits into a single commit.
3179 This option is a quick equivalent to a histedit script which folds all
3180 commits, combining them all into one commit.
3181 The
3182 .Fl f
3183 option can only be used when starting a new histedit operation.
3184 If this option is used, no other command-line arguments are allowed.
3185 .It Fl l
3186 Show a list of past histedit operations, represented by references in the
3187 .Dq refs/got/backup/histedit
3188 reference namespace.
3189 .Pp
3190 Display the author, date, and log message of each backed up commit,
3191 the object ID of the corresponding post-histedit commit, and
3192 the object ID of their common ancestor commit.
3193 Given these object IDs,
3194 the
3195 .Cm got log
3196 command with the
3197 .Fl c
3198 and
3199 .Fl x
3200 options can be used to examine the history of either version of the branch,
3201 and the
3202 .Cm got branch
3203 command with the
3204 .Fl c
3205 option can be used to create a new branch from a pre-histedit state if desired.
3206 .Pp
3207 If a
3208 .Ar branch
3209 is specified, only show commits which at some point in time represented this
3210 branch.
3211 Otherwise, list all backed up commits for any branches.
3212 .Pp
3213 If this option is used,
3214 .Cm got histedit
3215 does not require a work tree.
3216 None of the other options can be used together with
3217 .Fl l .
3218 .It Fl m
3219 Edit log messages only.
3220 This option is a quick equivalent to a histedit script which edits
3221 only log messages but otherwise leaves every picked commit as-is.
3222 The
3223 .Fl m
3224 option can only be used when starting a new histedit operation.
3225 If this option is used, no other command-line arguments are allowed.
3226 .It Fl X
3227 Delete backups created by past histedit operations, represented by references
3228 in the
3229 .Dq refs/got/backup/histedit
3230 reference namespace.
3231 .Pp
3232 If a
3233 .Ar branch
3234 is specified, only delete backups which at some point in time represented
3235 this branch.
3236 Otherwise, delete all references found within
3237 .Dq refs/got/backup/histedit .
3238 .Pp
3239 Any commit, tree, tag, and blob objects belonging to deleted backups
3240 remain in the repository and may be removed separately with
3241 Git's garbage collector or
3242 .Cm gotadmin cleanup .
3243 .Pp
3244 If this option is used,
3245 .Cm got histedit
3246 does not require a work tree.
3247 None of the other options can be used together with
3248 .Fl X .
3249 .El
3250 .Tg ig
3251 .It Cm integrate Ar branch
3252 .Dl Pq alias: Cm ig
3253 Integrate the specified
3254 .Ar branch
3255 into the work tree's current branch.
3256 Files in the work tree are updated to match the contents on the integrated
3257 .Ar branch ,
3258 and the reference of the work tree's branch is changed to point at the
3259 head commit of the integrated
3260 .Ar branch .
3261 .Pp
3262 Both branches can be considered equivalent after integration since they
3263 will be pointing at the same commit.
3264 Both branches remain available for future work, if desired.
3265 In case the integrated
3266 .Ar branch
3267 is no longer needed it may be deleted with
3268 .Cm got branch -d .
3269 .Pp
3270 Show the status of each affected file, using the following status codes:
3271 .Bl -column YXZ description
3272 .It U Ta file was updated
3273 .It D Ta file was deleted
3274 .It A Ta new file was added
3275 .It \(a~ Ta versioned file is obstructed by a non-regular file
3276 .It ! Ta a missing versioned file was restored
3277 .El
3278 .Pp
3279 .Cm got integrate
3280 will refuse to run if certain preconditions are not met.
3281 Most importantly, the
3282 .Ar branch
3283 must have been rebased onto the work tree's current branch with
3284 .Cm got rebase
3285 before it can be integrated, in order to linearize commit history and
3286 resolve merge conflicts.
3287 If the work tree contains multiple base commits, it must first be updated
3288 to a single base commit with
3289 .Cm got update .
3290 If changes have been staged with
3291 .Cm got stage ,
3292 these changes must first be committed with
3293 .Cm got commit
3294 or unstaged with
3295 .Cm got unstage .
3296 If the work tree contains local changes, these changes must first be
3297 committed with
3298 .Cm got commit
3299 or reverted with
3300 .Cm got revert .
3301 .Tg mg
3302 .It Xo
3303 .Cm merge
3304 .Op Fl aCcMn
3305 .Op Ar branch
3306 .Xc
3307 .Dl Pq alias: Cm mg
3308 Merge the specified
3309 .Ar branch
3310 into the current branch of the work tree.
3311 If the branches have diverged, merge changes into the work tree
3312 and create a merge commit.
3313 Otherwise, if the specified
3314 .Ar branch
3315 is already based on the work tree's current branch, make the work tree's
3316 current branch equivalent to the specified
3317 .Ar branch
3318 and update files in the work tree accordingly.
3319 .Pp
3320 Merge commits are commits based on multiple parent commits.
3321 The tip commit of the work tree's current branch will be used as the
3322 first parent.
3323 The tip commit of the specified
3324 .Ar branch
3325 will be used as the second parent.
3326 The work tree's current branch
3327 must be in the
3328 .Dq refs/heads/
3329 reference namespace and can be set with
3330 .Cm got update -b
3331 before starting the
3332 .Cm merge
3333 operation.
3334 .Pp
3335 No ancestral relationship between the two branches is required.
3336 If the two branches have already been merged previously, only new changes
3337 will be merged.
3338 .Pp
3339 It is not possible to create merge commits with more than two parents.
3340 If more than one branch needs to be merged, then multiple merge commits
3341 with two parents each can be created in sequence.
3342 .Pp
3343 If a linear project history is desired, then use of
3344 .Cm got rebase
3345 should generally be preferred over
3346 .Cm got merge .
3347 However, even strictly linear projects may require occasional merge commits,
3348 for example in order to merge in new versions of third-party code stored
3350 .Dq vendor
3351 branches created with
3352 .Cm got import .
3353 .Pp
3354 While merging changes found on the
3355 .Ar branch
3356 into the work tree, show the status of each affected file,
3357 using the following status codes:
3358 .Bl -column YXZ description
3359 .It G Ta file was merged
3360 .It C Ta file was merged and conflicts occurred during merge
3361 .It ! Ta changes destined for a missing file were not merged
3362 .It D Ta file was deleted
3363 .It d Ta file's deletion was prevented by local modifications
3364 .It A Ta new file was added
3365 .It \(a~ Ta changes destined for a non-regular file were not merged
3366 .It ? Ta changes destined for an unversioned file were not merged
3367 .El
3368 .Pp
3369 If merge conflicts occur, the merge operation is interrupted and conflicts
3370 must be resolved before the merge operation can continue.
3371 If any files with destined changes are found to be missing or unversioned,
3372 or if files could not be deleted due to differences in deleted content,
3373 the merge operation will be interrupted to prevent potentially incomplete
3374 changes from being committed to the repository without user intervention.
3375 The work tree may be modified as desired and the merge can be continued
3376 once the changes present in the work tree are considered complete.
3377 Alternatively, the merge operation may be aborted which will leave
3378 the work tree's current branch unmodified.
3379 .Pp
3380 .Cm got merge
3381 will refuse to run if certain preconditions are not met.
3382 If the work tree's current branch is not in the
3383 .Dq refs/heads/
3384 reference namespace then the work tree must first be switched to a
3385 branch in the
3386 .Dq refs/heads/
3387 namespace with
3388 .Cm got update -b .
3389 If the work tree is not yet fully updated to the tip commit of its
3390 branch, then the work tree must first be updated with
3391 .Cm got update .
3392 If the work tree contains multiple base commits, it must first be updated
3393 to a single base commit with
3394 .Cm got update .
3395 If changes have been staged with
3396 .Cm got stage ,
3397 these changes must first be committed with
3398 .Cm got commit
3399 or unstaged with
3400 .Cm got unstage .
3401 If the work tree contains local changes, these changes must first be
3402 committed with
3403 .Cm got commit
3404 or reverted with
3405 .Cm got revert .
3406 If the
3407 .Ar branch
3408 contains changes to files outside of the work tree's path prefix,
3409 the work tree cannot be used to merge this branch.
3410 .Pp
3411 The
3412 .Cm got update ,
3413 .Cm got commit ,
3414 .Cm got rebase ,
3415 .Cm got histedit ,
3416 .Cm got integrate ,
3417 and
3418 .Cm got stage
3419 commands will refuse to run while a merge operation is in progress.
3420 Other commands which manipulate the work tree may be used for
3421 conflict resolution purposes.
3422 .Pp
3423 The options for
3424 .Cm got merge
3425 are as follows:
3426 .Bl -tag -width Ds
3427 .It Fl a
3428 Abort an interrupted merge operation.
3429 If this option is used, no other command-line arguments are allowed.
3430 .It Fl C
3431 Allow a merge operation to continue with files in conflicted status.
3432 This option should generally be avoided, and can only be used with the
3433 .Fl c
3434 option.
3435 .It Fl c
3436 Continue an interrupted merge operation.
3437 If this option is used, no other command-line arguments are allowed except
3438 .Fl C .
3439 .It Fl M
3440 Create a merge commit even if the branches have not diverged.
3441 .It Fl n
3442 Merge changes into the work tree as usual but do not create a merge
3443 commit immediately.
3444 The merge result can be adjusted as desired before a merge commit is
3445 created with
3446 .Cm got merge -c .
3447 Alternatively, the merge may be aborted with
3448 .Cm got merge -a .
3449 .El
3450 .Tg sg
3451 .It Xo
3452 .Cm stage
3453 .Op Fl lpS
3454 .Op Fl F Ar response-script
3455 .Op Ar path ...
3456 .Xc
3457 .Dl Pq alias: Cm sg
3458 Stage local changes for inclusion in the next commit.
3459 If no
3460 .Ar path
3461 is specified, stage all changes in the work tree.
3462 Otherwise, stage changes at or within the specified paths.
3463 Paths may be staged if they are added, modified, or deleted according to
3464 .Cm got status .
3465 .Pp
3466 Show the status of each affected file, using the following status codes:
3467 .Bl -column YXZ description
3468 .It A Ta file addition has been staged
3469 .It M Ta file modification has been staged
3470 .It D Ta file deletion has been staged
3471 .El
3472 .Pp
3473 Staged file contents are saved in newly created blob objects in the repository.
3474 These blobs will be referred to by tree objects once staged changes have been
3475 committed.
3476 .Pp
3477 Staged changes affect the behaviour of
3478 .Cm got commit ,
3479 .Cm got status ,
3480 and
3481 .Cm got diff .
3482 While paths with staged changes exist, the
3483 .Cm got commit
3484 command will refuse to commit any paths which do not have staged changes.
3485 Local changes created on top of staged changes can only be committed if
3486 the path is staged again, or if the staged changes are committed first.
3487 The
3488 .Cm got status
3489 command will show both local changes and staged changes.
3490 The
3491 .Cm got diff
3492 command is able to display local changes relative to staged changes,
3493 and to display staged changes relative to the repository.
3494 The
3495 .Cm got revert
3496 command cannot revert staged changes but may be used to revert
3497 local changes created on top of staged changes.
3498 .Pp
3499 The options for
3500 .Cm got stage
3501 are as follows:
3502 .Bl -tag -width Ds
3503 .It Fl F Ar response-script
3504 With the
3505 .Fl p
3506 option, read
3507 .Dq y ,
3508 .Dq n ,
3509 and
3510 .Dq q
3511 responses line-by-line from the specified
3512 .Ar response-script
3513 file instead of prompting interactively.
3514 .It Fl l
3515 Instead of staging new changes, list paths which are already staged,
3516 along with the IDs of staged blob objects and stage status codes.
3517 If paths were provided on the command line, show the staged paths
3518 among the specified paths.
3519 Otherwise, show all staged paths.
3520 .It Fl p
3521 Instead of staging the entire content of a changed file, interactively
3522 select or reject changes for staging based on
3523 .Dq y
3524 (stage change),
3525 .Dq n
3526 (reject change), and
3527 .Dq q
3528 (quit staging this file) responses.
3529 If a file is in modified status, individual patches derived from the
3530 modified file content can be staged.
3531 Files in added or deleted status may only be staged or rejected in
3532 their entirety.
3533 .It Fl S
3534 Allow staging of symbolic links which point outside of the path space
3535 that is under version control.
3536 By default,
3537 .Cm got stage
3538 will reject such symbolic links due to safety concerns.
3539 As a precaution,
3540 .Nm
3541 may decide to represent such a symbolic link as a regular file which contains
3542 the link's target path, rather than creating an actual symbolic link which
3543 points outside of the work tree.
3544 Use of this option is discouraged because external mechanisms such as
3545 .Dq make obj
3546 are better suited for managing symbolic links to paths not under
3547 version control.
3548 .El
3549 .Pp
3550 .Cm got stage
3551 will refuse to run if certain preconditions are not met.
3552 If a file contains merge conflicts, these conflicts must be resolved first.
3553 If a file is found to be out of date relative to the head commit on the
3554 work tree's current branch, the file must be updated with
3555 .Cm got update
3556 before it can be staged (however, this does not prevent the file from
3557 becoming out-of-date at some point after having been staged).
3558 .Pp
3559 The
3560 .Cm got update ,
3561 .Cm got rebase ,
3562 .Cm got merge ,
3563 and
3564 .Cm got histedit
3565 commands will refuse to run while staged changes exist.
3566 If staged changes cannot be committed because a staged path
3567 is out of date, the path must be unstaged with
3568 .Cm got unstage
3569 before it can be updated with
3570 .Cm got update ,
3571 and may then be staged again if necessary.
3572 .Tg ug
3573 .It Xo
3574 .Cm unstage
3575 .Op Fl p
3576 .Op Fl F Ar response-script
3577 .Op Ar path ...
3578 .Xc
3579 .Dl Pq alias: Cm ug
3580 Merge staged changes back into the work tree and put affected paths
3581 back into non-staged status.
3582 If no
3583 .Ar path
3584 is specified, unstage all staged changes across the entire work tree.
3585 Otherwise, unstage changes at or within the specified paths.
3586 .Pp
3587 Show the status of each affected file, using the following status codes:
3588 .Bl -column YXZ description
3589 .It G Ta file was unstaged
3590 .It C Ta file was unstaged and conflicts occurred during merge
3591 .It ! Ta changes destined for a missing file were not merged
3592 .It D Ta file was staged as deleted and still is deleted
3593 .It d Ta file's deletion was prevented by local modifications
3594 .It \(a~ Ta changes destined for a non-regular file were not merged
3595 .El
3596 .Pp
3597 The options for
3598 .Cm got unstage
3599 are as follows:
3600 .Bl -tag -width Ds
3601 .It Fl F Ar response-script
3602 With the
3603 .Fl p
3604 option, read
3605 .Dq y ,
3606 .Dq n ,
3607 and
3608 .Dq q
3609 responses line-by-line from the specified
3610 .Ar response-script
3611 file instead of prompting interactively.
3612 .It Fl p
3613 Instead of unstaging the entire content of a changed file, interactively
3614 select or reject changes for unstaging based on
3615 .Dq y
3616 (unstage change),
3617 .Dq n
3618 (keep change staged), and
3619 .Dq q
3620 (quit unstaging this file) responses.
3621 If a file is staged in modified status, individual patches derived from the
3622 staged file content can be unstaged.
3623 Files staged in added or deleted status may only be unstaged in their entirety.
3624 .El
3625 .It Xo
3626 .Cm cat
3627 .Op Fl P
3628 .Op Fl c Ar commit
3629 .Op Fl r Ar repository-path
3630 .Ar arg ...
3631 .Xc
3632 Parse and print contents of objects to standard output in a line-based
3633 text format.
3634 Content of commit, tree, and tag objects is printed in a way similar
3635 to the actual content stored in such objects.
3636 Blob object contents are printed as they would appear in files on disk.
3637 .Pp
3638 Attempt to interpret each argument as a reference, a tag name, or
3639 an object ID SHA1 hash.
3640 References will be resolved to an object ID.
3641 Tag names will resolved to a tag object.
3642 An abbreviated hash argument will be expanded to a full SHA1 hash
3643 automatically, provided the abbreviation is unique.
3644 .Pp
3645 If none of the above interpretations produce a valid result, or if the
3646 .Fl P
3647 option is used, attempt to interpret the argument as a path which will
3648 be resolved to the ID of an object found at this path in the repository.
3649 .Pp
3650 The options for
3651 .Cm got cat
3652 are as follows:
3653 .Bl -tag -width Ds
3654 .It Fl c Ar commit
3655 Look up paths in the specified
3656 .Ar commit .
3657 If this option is not used, paths are looked up in the commit resolved
3658 via the repository's HEAD reference.
3659 .Pp
3660 The expected argument is a commit ID SHA1 hash, or a reference name
3661 or keyword which will be resolved to a commit ID.
3662 An abbreviated hash argument will be expanded to a full SHA1 hash
3663 automatically, provided the abbreviation is unique.
3664 The keywords
3665 .Qq :base
3666 and
3667 .Qq :head
3668 resolve to the work tree's base commit and branch head, respectively.
3669 The former is only valid if invoked in a work tree, while the latter will
3670 resolve to the tip of the work tree's current branch if invoked in a
3671 work tree, otherwise it will resolve to the repository's HEAD reference.
3672 Keywords and references may be appended with
3673 .Qq :+
3675 .Qq :-
3676 modifiers and an optional integer N to denote the
3677 Nth descendant or antecedent by first parent traversal, respectively;
3678 for example,
3679 .Sy :head:-2
3680 denotes the work tree branch head's 2nd generation ancestor, and
3681 .Sy :base:+4
3682 denotes the 4th generation descendant of the work tree's base commit.
3683 Similarly,
3684 .Sy quux:-8
3685 will denote the 8th generation ancestor of the commit resolved by the
3686 .Qq quux
3687 reference.
3689 .Qq :+
3691 .Qq :-
3692 modifier without a trailing integer has an implicit
3693 .Qq 1
3694 appended
3695 .Po e.g.,
3696 .Sy :base:+
3697 is equivalent to
3698 .Sy :base:+1
3699 .Pc .
3700 .It Fl P
3701 Interpret all arguments as paths only.
3702 This option can be used to resolve ambiguity in cases where paths
3703 look like tag names, reference names, or object IDs.
3704 .It Fl r Ar repository-path
3705 Use the repository at the specified path.
3706 If not specified, assume the repository is located at or above the current
3707 working directory.
3708 If this directory is a
3709 .Nm
3710 work tree, use the repository path associated with this work tree.
3711 .El
3712 .It Cm info Op Ar path ...
3713 Display meta-data stored in a work tree.
3714 See
3715 .Xr got-worktree 5
3716 for details.
3717 .Pp
3718 The work tree to use is resolved implicitly by walking upwards from the
3719 current working directory.
3720 .Pp
3721 If one or more
3722 .Ar path
3723 arguments are specified, show additional per-file information for tracked
3724 files located at or within these paths.
3725 If a
3726 .Ar path
3727 argument corresponds to the work tree's root directory, display information
3728 for all tracked files.
3729 .El
3730 .Sh ENVIRONMENT
3731 .Bl -tag -width GOT_IGNORE_GITCONFIG
3732 .It Ev GOT_AUTHOR
3733 The author's name and email address, such as
3734 .Qq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
3735 Used by the
3736 .Cm got commit ,
3737 .Cm got import ,
3738 .Cm got rebase ,
3739 .Cm got merge ,
3740 and
3741 .Cm got histedit
3742 commands.
3743 Because
3744 .Xr git 1
3745 may fail to parse commits without an email address in author data,
3746 .Nm
3747 attempts to reject
3748 .Ev GOT_AUTHOR
3749 environment variables with a missing email address.
3750 .Pp
3751 .Ev GOT_AUTHOR will be overridden by configuration settings in
3752 .Xr got.conf 5
3753 or by Git's
3754 .Dv user.name
3755 and
3756 .Dv user.email
3757 configuration settings in the repository's
3758 .Pa .git/config
3759 file.
3760 The
3761 .Dv user.name
3762 and
3763 .Dv user.email
3764 configuration settings contained in Git's global
3765 .Pa ~/.gitconfig
3766 configuration file will only be used if neither
3767 .Xr got.conf 5
3768 nor the
3769 .Ev GOT_AUTHOR
3770 environment variable provide author information.
3771 .It Ev GOT_IGNORE_GITCONFIG
3772 If this variable is set then any remote repository definitions or author
3773 information found in Git configuration files will be ignored.
3774 .It Ev GOT_LOG_DEFAULT_LIMIT
3775 The default limit on the number of commits traversed by
3776 .Cm got log .
3777 If set to zero, the limit is unbounded.
3778 This variable will be silently ignored if it is set to a non-numeric value.
3779 .It Ev VISUAL , EDITOR
3780 The editor spawned by
3781 .Cm got commit ,
3782 .Cm got histedit ,
3783 .Cm got import ,
3785 .Cm got tag .
3786 If not set, the
3787 .Xr vi 1
3788 text editor will be spawned.
3789 .El
3790 .Sh FILES
3791 .Bl -tag -width packed-refs -compact
3792 .It Pa got.conf
3793 Repository-wide configuration settings for
3794 .Nm .
3795 If present, a
3796 .Xr got.conf 5
3797 configuration file located in the root directory of a Git repository
3798 supersedes any relevant settings in Git's
3799 .Pa config
3800 file.
3801 .Pp
3802 .It Pa .got/got.conf
3803 Worktree-specific configuration settings for
3804 .Nm .
3805 If present, a
3806 .Xr got.conf 5
3807 configuration file in the
3808 .Pa .got
3809 meta-data directory of a work tree supersedes any relevant settings in
3810 the repository's
3811 .Xr got.conf 5
3812 configuration file and Git's
3813 .Pa config
3814 file.
3815 .El
3816 .Sh EXIT STATUS
3817 .Ex -std got
3818 .Sh EXAMPLES
3819 Enable tab-completion of
3820 .Nm
3821 command names in
3822 .Xr ksh 1 :
3823 .Pp
3824 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
3825 .Pp
3826 Clone an existing Git repository for use with
3827 .Nm :
3828 .Pp
3829 .Dl $ cd /var/git/
3830 .Dl $ got clone ssh://git@github.com/openbsd/src.git
3831 .Pp
3832 Unfortunately, many of the popular Git hosting sites do not offer anonymous
3833 access via SSH.
3834 Such sites will require an account to be created, and a public SSH key to be
3835 uploaded to this account, before repository access via ssh:// URLs will work.
3836 .Pp
3837 Most sites offer anonymous repository access via HTTPS:
3838 .Pp
3839 .Dl $ cd /var/git/
3840 .Dl $ got clone https://github.com/openbsd/src.git
3841 .Pp
3842 Alternatively, for quick and dirty local testing of
3843 .Nm
3844 a new Git repository could be created and populated with files,
3845 e.g. from a temporary CVS checkout located at
3846 .Pa /tmp/src :
3847 .Pp
3848 .Dl $ gotadmin init /var/git/src.git
3849 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
3850 .Pp
3851 Check out a work tree from the Git repository to /usr/src:
3852 .Pp
3853 .Dl $ got checkout /var/git/src.git /usr/src
3854 .Pp
3855 View local changes in a work tree directory:
3856 .Pp
3857 .Dl $ got diff | less
3858 .Pp
3859 In a work tree, display files in a potentially problematic state:
3860 .Pp
3861 .Dl $ got status -s 'C!~?'
3862 .Pp
3863 Interactively revert selected local changes in a work tree directory:
3864 .Pp
3865 .Dl $ got revert -p -R\ .
3866 .Pp
3867 In a work tree or a git repository directory, list all branch references:
3868 .Pp
3869 .Dl $ got branch -l
3870 .Pp
3871 As above, but list the most recently modified branches only:
3872 .Pp
3873 .Dl $ got branch -lt | head
3874 .Pp
3875 In a work tree or a git repository directory, create a new branch called
3876 .Dq unified-buffer-cache
3877 which is forked off the
3878 .Dq master
3879 branch:
3880 .Pp
3881 .Dl $ got branch -c master unified-buffer-cache
3882 .Pp
3883 Switch an existing work tree to the branch
3884 .Dq unified-buffer-cache .
3885 Local changes in the work tree will be preserved and merged if necessary:
3886 .Pp
3887 .Dl $ got update -b unified-buffer-cache
3888 .Pp
3889 Create a new commit from local changes in a work tree directory.
3890 This new commit will become the head commit of the work tree's current branch:
3891 .Pp
3892 .Dl $ got commit
3893 .Pp
3894 In a work tree or a git repository directory, view changes committed in
3895 the 3 most recent commits to the work tree's branch, or the branch resolved
3896 via the repository's HEAD reference, respectively:
3897 .Pp
3898 .Dl $ got log -p -l 3
3899 .Pp
3900 As above, but display changes in the order in which
3901 .Xr patch 1
3902 could apply them in sequence:
3903 .Pp
3904 .Dl $ got log -p -l 3 -R
3905 .Pp
3906 In a work tree or a git repository directory, log the history of a subdirectory:
3907 .Pp
3908 .Dl $ got log sys/uvm
3909 .Pp
3910 While operating inside a work tree, paths are specified relative to the current
3911 working directory, so this command will log the subdirectory
3912 .Pa sys/uvm :
3913 .Pp
3914 .Dl $ cd sys/uvm && got log\ .
3915 .Pp
3916 And this command has the same effect:
3917 .Pp
3918 .Dl $ cd sys/dev/usb && got log ../../uvm
3919 .Pp
3920 And this command displays work tree meta-data about all tracked files:
3921 .Pp
3922 .Dl $ cd /usr/src
3923 .Dl $ got info\ . | less
3924 .Pp
3925 Add new files and remove obsolete files in a work tree directory:
3926 .Pp
3927 .Dl $ got add sys/uvm/uvm_ubc.c
3928 .Dl $ got remove sys/uvm/uvm_vnode.c
3929 .Pp
3930 Create a new commit from local changes in a work tree directory
3931 with a pre-defined log message.
3932 .Pp
3933 .Dl $ got commit -m 'unify the buffer cache'
3934 .Pp
3935 Alternatively, create a new commit from local changes in a work tree
3936 directory with a log message that has been prepared in the file
3937 .Pa /tmp/msg :
3938 .Pp
3939 .Dl $ got commit -F /tmp/msg
3940 .Pp
3941 Update any work tree checked out from the
3942 .Dq unified-buffer-cache
3943 branch to the latest commit on this branch:
3944 .Pp
3945 .Dl $ got update
3946 .Pp
3947 Roll file content on the unified-buffer-cache branch back by one commit,
3948 and then fetch the rolled-back change into the work tree as a local change
3949 to be amended and perhaps committed again:
3950 .Pp
3951 .Dl $ got backout unified-buffer-cache
3952 .Dl $ got commit -m 'roll back previous'
3953 .Dl $ # now back out the previous backout :-)
3954 .Dl $ got backout unified-buffer-cache
3955 .Pp
3956 Fetch new changes on the remote repository's
3957 .Dq master
3958 branch, making them visible on the local repository's
3959 .Dq origin/master
3960 branch:
3961 .Pp
3962 .Dl $ cd /usr/src
3963 .Dl $ got fetch
3964 .Pp
3965 Rebase the local
3966 .Dq master
3967 branch to merge the new changes that are now visible on the
3968 .Dq origin/master
3969 branch:
3970 .Pp
3971 .Dl $ cd /usr/src
3972 .Dl $ got update -b origin/master
3973 .Dl $ got rebase master
3974 .Pp
3975 Rebase the
3976 .Dq unified-buffer-cache
3977 branch on top of the new head commit of the
3978 .Dq master
3979 branch.
3980 .Pp
3981 .Dl $ got update -b master
3982 .Dl $ got rebase unified-buffer-cache
3983 .Pp
3984 Create a patch from all changes on the unified-buffer-cache branch.
3985 The patch can be mailed out for review and applied to
3986 .Ox Ns 's
3987 CVS tree:
3988 .Pp
3989 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
3990 .Pp
3991 Edit the entire commit history of the
3992 .Dq unified-buffer-cache
3993 branch:
3994 .Pp
3995 .Dl $ got update -b unified-buffer-cache
3996 .Dl $ got update -c master
3997 .Dl $ got histedit
3998 .Pp
3999 Before working against existing branches in a repository cloned with
4000 .Cm git clone --bare
4001 instead of
4002 .Cm got clone ,
4003 a Git
4004 .Dq refspec
4005 must be configured to map all references in the remote repository
4006 into the
4007 .Dq refs/remotes
4008 namespace of the local repository.
4009 This can be achieved by setting Git's
4010 .Pa remote.origin.fetch
4011 configuration variable to the value
4012 .Dq +refs/heads/*:refs/remotes/origin/*
4013 with the
4014 .Cm git config
4015 command:
4016 .Pp
4017 .Dl $ cd /var/git/repo
4018 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
4019 .Pp
4020 Additionally, the
4021 .Dq mirror
4022 option must be disabled:
4023 .Pp
4024 .Dl $ cd /var/git/repo
4025 .Dl $ git config remote.origin.mirror false
4026 .Pp
4027 Alternatively, the following
4028 .Xr git-fetch 1
4029 configuration item can be added manually to the Git repository's
4030 .Pa config
4031 file:
4032 .Pp
4033 .Dl [remote \&"origin\&"]
4034 .Dl url = ...
4035 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
4036 .Dl mirror = false
4037 .Pp
4038 This configuration leaves the local repository's
4039 .Dq refs/heads
4040 namespace free for use by local branches checked out with
4041 .Cm got checkout
4042 and, if needed, created with
4043 .Cm got branch .
4044 Branches in the
4045 .Dq refs/remotes/origin
4046 namespace can now be updated with incoming changes from the remote
4047 repository with
4048 .Cm got fetch
4050 .Xr git-fetch 1
4051 without extra command line arguments.
4052 Newly fetched changes can be examined with
4053 .Cm got log .
4054 .Pp
4055 Display changes on the remote repository's version of the
4056 .Dq master
4057 branch, as of the last time
4058 .Cm got fetch
4059 was run:
4060 .Pp
4061 .Dl $ got log -c origin/master | less
4062 .Pp
4063 As shown here, most commands accept abbreviated reference names such as
4064 .Dq origin/master
4065 instead of
4066 .Dq refs/remotes/origin/master .
4067 The latter is only needed in case of ambiguity.
4068 .Pp
4069 .Cm got rebase
4070 can be used to merge changes which are visible on the
4071 .Dq origin/master
4072 branch into the
4073 .Dq master
4074 branch.
4075 This will also merge local changes, if any, with the incoming changes:
4076 .Pp
4077 .Dl $ got update -b origin/master
4078 .Dl $ got rebase master
4079 .Pp
4080 In order to make changes committed to the
4081 .Dq unified-buffer-cache
4082 visible on the
4083 .Dq master
4084 branch, the
4085 .Dq unified-buffer-cache
4086 branch can be rebased onto the
4087 .Dq master
4088 branch:
4089 .Pp
4090 .Dl $ got update -b master
4091 .Dl $ got rebase unified-buffer-cache
4092 .Pp
4093 Changes on the
4094 .Dq unified-buffer-cache
4095 branch can now be made visible on the
4096 .Dq master
4097 branch with
4098 .Cm got integrate .
4099 Because the rebase operation switched the work tree to the
4100 .Dq unified-buffer-cache
4101 branch, the work tree must be switched back to the
4102 .Dq master
4103 branch first:
4104 .Pp
4105 .Dl $ got update -b master
4106 .Dl $ got integrate unified-buffer-cache
4107 .Pp
4108 On the
4109 .Dq master
4110 branch, log messages for local changes can now be amended with
4111 .Dq OK
4112 by other developers and any other important new information:
4113 .Pp
4114 .Dl $ got update -c origin/master
4115 .Dl $ got histedit -m
4116 .Pp
4117 If the remote repository offers write access, local changes on the
4118 .Dq master
4119 branch can be sent to the remote repository with
4120 .Cm got send .
4121 Usually,
4122 .Cm got send
4123 can be run without further arguments.
4124 The arguments shown here match defaults, provided the work tree's
4125 current branch is the
4126 .Dq master
4127 branch:
4128 .Pp
4129 .Dl $ got send -b master origin
4130 .Pp
4131 If the remote repository requires the HTTPS protocol, the
4132 .Xr git-push 1
4133 command must be used instead:
4134 .Pp
4135 .Dl $ cd /var/git/src.git
4136 .Dl $ git push origin master
4137 .Pp
4138 When making contributions to projects which use the
4139 .Dq pull request
4140 workflow, SSH protocol repository access needs to be set up first.
4141 Once an account has been created on a Git hosting site it should
4142 be possible to upload a public SSH key for repository access
4143 authentication.
4144 .Pp
4145 The
4146 .Dq pull request
4147 workflow will usually involve two remote repositories.
4148 In the real-life example below, the
4149 .Dq origin
4150 repository was forked from the
4151 .Dq upstream
4152 repository by using the Git hosting site's web interface.
4153 The
4154 .Xr got.conf 5
4155 file in the local repository describes both remote repositories:
4156 .Bd -literal -offset indent
4157 # Jelmers's repository, which accepts pull requests
4158 remote "upstream" {
4159 server git@github.com
4160 protocol ssh
4161 repository "/jelmer/dulwich"
4162 branch { "master" }
4165 # Stefan's fork, used as the default remote repository
4166 remote "origin" {
4167 server git@github.com
4168 protocol ssh
4169 repository "/stspdotname/dulwich"
4170 branch { "master" }
4172 .Ed
4173 .Pp
4174 With this configuration, Stefan can create commits on
4175 .Dq refs/heads/master
4176 and send them to the
4177 .Dq origin
4178 repository by running:
4179 .Pp
4180 .Dl $ got send -b master origin
4181 .Pp
4182 The changes can now be proposed to Jelmer by opening a pull request
4183 via the Git hosting site's web interface.
4184 If Jelmer requests further changes to be made, additional commits
4185 can be created on the
4186 .Dq master
4187 branch and be added to the pull request by running
4188 .Cd got send
4189 again.
4190 .Pp
4191 If Jelmer prefers additional commits to be
4192 .Dq squashed
4193 then the following commands can be used to achieve this:
4194 .Pp
4195 .Dl $ got update -b master
4196 .Dl $ got update -c origin/master
4197 .Dl $ got histedit -f
4198 .Dl $ got send -f -b master origin
4199 .Pp
4200 In addition to reviewing the pull request in the web user interface,
4201 Jelmer can fetch the pull request's branch into his local repository
4202 and create a local branch which contains the proposed changes:
4203 .Pp
4204 .Dl $ got fetch -R refs/pull/1046/head origin
4205 .Dl $ got branch -c refs/remotes/origin/pull/1046/head pr1046
4206 .Pp
4207 Once Jelmer has accepted the pull request, Stefan can fetch the
4208 merged changes, and possibly several other new changes, by running:
4209 .Pp
4210 .Dl $ got fetch upstream
4211 .Pp
4212 The merged changes will now be visible under the reference
4213 .Dq refs/remotes/upstream/master .
4214 The local
4215 .Dq master
4216 branch can now be rebased on top of the latest changes
4217 from upstream:
4218 .Pp
4219 .Dl $ got update -b upstream/master
4220 .Dl $ got rebase master
4221 .Pp
4222 As an alternative to
4223 .Cm got rebase ,
4224 branches can be merged with
4225 .Cm got merge :
4226 .Pp
4227 .Dl $ got update -b master
4228 .Dl $ got merge upstream/master
4229 .Pp
4230 The question of whether to rebase or merge branches is philosophical.
4231 When in doubt, refer to the software project's policies set by project
4232 maintainers.
4233 .Pp
4234 As a final step, the forked repository's copy of the master branch needs
4235 to be kept in sync by sending the new changes there:
4236 .Pp
4237 .Dl $ got send -f -b master origin
4238 .Pp
4239 If multiple pull requests need to be managed in parallel, a separate branch
4240 must be created for each pull request with
4241 .Cm got branch .
4242 Each such branch can then be used as above, in place of
4243 .Dq refs/heads/master .
4244 Changes for any accepted pull requests will still appear under
4245 .Dq refs/remotes/upstream/master,
4246 regardless of which branch was used in the forked repository to
4247 create a pull request.
4248 .Sh SEE ALSO
4249 .Xr gotadmin 1 ,
4250 .Xr tog 1 ,
4251 .Xr git-repository 5 ,
4252 .Xr got-worktree 5 ,
4253 .Xr got.conf 5 ,
4254 .Xr gotwebd 8
4255 .Sh AUTHORS
4256 .An Anthony J. Bentley Aq Mt bentley@openbsd.org
4257 .An Christian Weisgerber Aq Mt naddy@openbsd.org
4258 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
4259 .An Josh Rickmar Aq Mt jrick@zettaport.com
4260 .An Joshua Stein Aq Mt jcs@openbsd.org
4261 .An Klemens Nanni Aq Mt kn@openbsd.org
4262 .An Martin Pieuchot Aq Mt mpi@openbsd.org
4263 .An Neels Hofmeyr Aq Mt neels@hofmeyr.de
4264 .An Omar Polo Aq Mt op@openbsd.org
4265 .An Ori Bernstein Aq Mt ori@openbsd.org
4266 .An Sebastien Marie Aq Mt semarie@openbsd.org
4267 .An Stefan Sperling Aq Mt stsp@openbsd.org
4268 .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au
4269 .An Theo Buehler Aq Mt tb@openbsd.org
4270 .An Thomas Adam Aq Mt thomas@xteddy.org
4271 .An Tracey Emery Aq Mt tracey@traceyemery.net
4272 .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org
4273 .Pp
4274 Parts of
4275 .Nm ,
4276 .Xr tog 1 ,
4277 and
4278 .Xr gotwebd 8
4279 were derived from code under copyright by:
4280 .Pp
4281 .An Caldera International
4282 .An Daniel Hartmeier
4283 .An Esben Norby
4284 .An Henning Brauer
4285 .An HÃ¥kan Olsson
4286 .An Ingo Schwarze
4287 .An Jean-Francois Brousseau
4288 .An Joris Vink
4289 .An Jyri J. Virkki
4290 .An Larry Wall
4291 .An Markus Friedl
4292 .An Niall O'Higgins
4293 .An Niklas Hallqvist
4294 .An Ray Lai
4295 .An Ryan McBride
4296 .An Theo de Raadt
4297 .An Todd C. Miller
4298 .An Xavier Santolaria
4299 .Pp
4300 .Nm
4301 contains code contributed to the public domain by
4302 .An Austin Appleby .
4303 .Sh CAVEATS
4304 .Nm
4305 is a work-in-progress and some features remain to be implemented.
4306 .Pp
4307 At present, the user has to fall back on
4308 .Xr git 1
4309 to perform some tasks.
4310 In particular:
4311 .Bl -bullet
4312 .It
4313 Writing to remote repositories over HTTP or HTTPS protocols requires
4314 .Xr git-push 1 .
4315 .It
4316 The creation of merge commits with more than two parent commits requires
4317 .Xr git-merge 1 .
4318 .It
4319 In situations where files or directories were moved around
4320 .Cm got
4321 will not automatically merge changes to new locations and
4322 .Xr git 1
4323 will usually produce better results.
4324 .El