Blob


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