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