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