Blob


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