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