Blob


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