Blob


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