Blob


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