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