Blob


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