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