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