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