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