Blob


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