Blob


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