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