Blob


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