Blob


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