Blob


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