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