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