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 NS
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 S
1736 Allow the addition of symbolic links which point outside of the path space
1737 that is under version control.
1738 By default,
1739 .Cm got commit
1740 will reject such symbolic links due to safety concerns.
1741 As a precaution,
1742 .Nm
1743 may decide to represent such a symbolic link as a regular file which contains
1744 the link's target path, rather than creating an actual symbolic link which
1745 points outside of the work tree.
1746 Use of this option is discouraged because external mechanisms such as
1747 .Dq make obj
1748 are better suited for managing symbolic links to paths not under
1749 version control.
1750 .El
1751 .Pp
1752 .Cm got commit
1753 will refuse to run if certain preconditions are not met.
1754 If the work tree's current branch is not in the
1755 .Dq refs/heads/
1756 reference namespace, new commits may not be created on this branch.
1757 Local changes may only be committed if they are based on file content
1758 found in the most recent commit on the work tree's branch.
1759 If a path is found to be out of date,
1760 .Cm got update
1761 must be used first in order to merge local changes with changes made
1762 in the repository.
1763 .Tg se
1764 .It Xo
1765 .Cm send
1766 .Op Fl afqTv
1767 .Op Fl b Ar branch
1768 .Op Fl d Ar branch
1769 .Op Fl r Ar repository-path
1770 .Op Fl t Ar tag
1771 .Op Ar remote-repository
1772 .Xc
1773 .Dl Pq alias: Cm se
1774 Send new changes to a remote repository.
1775 If no
1776 .Ar remote-repository
1777 is specified,
1778 .Dq origin
1779 will be used.
1780 The remote repository's URL is obtained from the corresponding entry in
1781 .Xr got.conf 5
1782 or Git's
1783 .Pa config
1784 file of the local repository, as created by
1785 .Cm got clone .
1786 .Pp
1787 All objects corresponding to new changes will be written to a temporary
1788 pack file which is then uploaded to the server.
1789 Upon success, references in the
1790 .Dq refs/remotes/
1791 reference namespace of the local repository will be updated to point at
1792 the commits which have been sent.
1793 .Pp
1794 By default, changes will only be sent if they are based on up-to-date
1795 copies of relevant branches in the remote repository.
1796 If any changes to be sent are based on out-of-date copies or would
1797 otherwise break linear history of existing branches, new changes must
1798 be fetched from the server with
1799 .Cm got fetch
1800 and local branches must be rebased with
1801 .Cm got rebase
1802 before
1803 .Cm got send
1804 can succeed.
1805 The
1806 .Fl f
1807 option can be used to make exceptions to these requirements.
1808 .Pp
1809 The options for
1810 .Cm got send
1811 are as follows:
1812 .Bl -tag -width Ds
1813 .It Fl a
1814 Send all branches from the local repository's
1815 .Dq refs/heads/
1816 reference namespace.
1817 The
1818 .Fl a
1819 option is equivalent to listing all branches with multiple
1820 .Fl b
1821 options.
1822 Cannot be used together with the
1823 .Fl b
1824 option.
1825 .It Fl b Ar branch
1826 Send the specified
1827 .Ar branch
1828 from the local repository's
1829 .Dq refs/heads/
1830 reference namespace.
1831 This option may be specified multiple times to build a list of branches
1832 to send.
1833 If this option is not specified, default to the work tree's current branch
1834 if invoked in a work tree, or to the repository's HEAD reference.
1835 Cannot be used together with the
1836 .Fl a
1837 option.
1838 .It Fl d Ar branch
1839 Delete the specified
1840 .Ar branch
1841 from the remote repository's
1842 .Dq refs/heads/
1843 reference namespace.
1844 This option may be specified multiple times to build a list of branches
1845 to delete.
1846 .Pp
1847 Only references are deleted.
1848 Any commit, tree, tag, and blob objects belonging to deleted branches
1849 may become subject to deletion by Git's garbage collector running on
1850 the server.
1851 .Pp
1852 Requesting deletion of branches results in an error if the server
1853 does not support this feature or disallows the deletion of branches
1854 based on its configuration.
1855 .It Fl f
1856 Attempt to force the server to overwrite existing branches or tags
1857 in the remote repository, even when
1858 .Cm got fetch
1859 and
1860 .Cm got rebase
1861 would usually be required before changes can be sent.
1862 The server may reject forced requests regardless, depending on its
1863 configuration.
1864 .Pp
1865 Any commit, tree, tag, and blob objects belonging to overwritten branches
1866 or tags may become subject to deletion by Git's garbage collector running
1867 on the server.
1868 .Pp
1869 The
1870 .Dq refs/tags
1871 reference namespace is globally shared between all repositories.
1872 Use of the
1873 .Fl f
1874 option to overwrite tags is discouraged because it can lead to
1875 inconsistencies between the tags present in different repositories.
1876 In general, creating a new tag with a different name is recommended
1877 instead of overwriting an existing tag.
1878 .Pp
1879 Use of the
1880 .Fl f
1881 option is particularly discouraged if changes being sent are based
1882 on an out-of-date copy of a branch in the remote repository.
1883 Instead of using the
1884 .Fl f
1885 option, new changes should
1886 be fetched with
1887 .Cm got fetch
1888 and local branches should be rebased with
1889 .Cm got rebase ,
1890 followed by another attempt to send the changes.
1891 .Pp
1892 The
1893 .Fl f
1894 option should only be needed in situations where the remote repository's
1895 copy of a branch or tag is known to be out-of-date and is considered
1896 disposable.
1897 The risks of creating inconsistencies between different repositories
1898 should also be taken into account.
1899 .It Fl q
1900 Suppress progress reporting output.
1901 The same option will be passed to
1902 .Xr ssh 1
1903 if applicable.
1904 .It Fl r Ar repository-path
1905 Use the repository at the specified path.
1906 If not specified, assume the repository is located at or above the current
1907 working directory.
1908 If this directory is a
1909 .Nm
1910 work tree, use the repository path associated with this work tree.
1911 .It Fl T
1912 Attempt to send all tags from the local repository's
1913 .Dq refs/tags/
1914 reference namespace.
1915 The
1916 .Fl T
1917 option is equivalent to listing all tags with multiple
1918 .Fl t
1919 options.
1920 Cannot be used together with the
1921 .Fl t
1922 option.
1923 .It Fl t Ar tag
1924 Send the specified
1925 .Ar tag
1926 from the local repository's
1927 .Dq refs/tags/
1928 reference namespace, in addition to any branches that are being sent.
1929 The
1930 .Fl t
1931 option may be specified multiple times to build a list of tags to send.
1932 No tags will be sent if the
1933 .Fl t
1934 option is not used.
1935 .Pp
1936 Raise an error if the specified
1937 .Ar tag
1938 already exists in the remote repository, unless the
1939 .Fl f
1940 option is used to overwrite the server's copy of the tag.
1941 In general, creating a new tag with a different name is recommended
1942 instead of overwriting an existing tag.
1943 .Pp
1944 Cannot be used together with the
1945 .Fl T
1946 option.
1947 .It Fl v
1948 Verbose mode.
1949 Causes
1950 .Cm got send
1951 to print debugging messages to standard error output.
1952 The same option will be passed to
1953 .Xr ssh 1
1954 if applicable.
1955 Multiple -v options increase the verbosity.
1956 The maximum is 3.
1957 .El
1958 .Tg cy
1959 .It Cm cherrypick Ar commit
1960 .Dl Pq alias: Cm cy
1961 Merge changes from a single
1962 .Ar commit
1963 into the work tree.
1964 The specified
1965 .Ar commit
1966 should be on a different branch than the work tree's base commit.
1967 The expected argument is a reference or a commit ID SHA1 hash.
1968 An abbreviated hash argument will be expanded to a full SHA1 hash
1969 automatically, provided the abbreviation is unique.
1970 .Pp
1971 Show the status of each affected file, using the following status codes:
1972 .Bl -column YXZ description
1973 .It G Ta file was merged
1974 .It C Ta file was merged and conflicts occurred during merge
1975 .It ! Ta changes destined for a missing file were not merged
1976 .It D Ta file was deleted
1977 .It d Ta file's deletion was prevented by local modifications
1978 .It A Ta new file was added
1979 .It \(a~ Ta changes destined for a non-regular file were not merged
1980 .It ? Ta changes destined for an unversioned file were not merged
1981 .El
1982 .Pp
1983 The merged changes will appear as local changes in the work tree, which
1984 may be viewed with
1985 .Cm got diff ,
1986 amended manually or with further
1987 .Cm got cherrypick
1988 commands,
1989 committed with
1990 .Cm got commit ,
1991 or discarded again with
1992 .Cm got revert .
1993 .Pp
1994 .Cm got cherrypick
1995 will refuse to run if certain preconditions are not met.
1996 If the work tree contains multiple base commits, it must first be updated
1997 to a single base commit with
1998 .Cm got update .
1999 If any relevant files already contain merge conflicts, these
2000 conflicts must be resolved first.
2001 .Tg bo
2002 .It Cm backout Ar commit
2003 .Dl Pq alias: Cm bo
2004 Reverse-merge changes from a single
2005 .Ar commit
2006 into the work tree.
2007 The specified
2008 .Ar commit
2009 should be on the same branch as the work tree's base commit.
2010 The expected argument is a reference or a commit ID SHA1 hash.
2011 An abbreviated hash argument will be expanded to a full SHA1 hash
2012 automatically, provided the abbreviation is unique.
2013 .Pp
2014 Show the status of each affected file, using the following status codes:
2015 .Bl -column YXZ description
2016 .It G Ta file was merged
2017 .It C Ta file was merged and conflicts occurred during merge
2018 .It ! Ta changes destined for a missing file were not merged
2019 .It D Ta file was deleted
2020 .It d Ta file's deletion was prevented by local modifications
2021 .It A Ta new file was added
2022 .It \(a~ Ta changes destined for a non-regular file were not merged
2023 .It ? Ta changes destined for an unversioned file were not merged
2024 .El
2025 .Pp
2026 The reverse-merged changes will appear as local changes in the work tree,
2027 which may be viewed with
2028 .Cm got diff ,
2029 amended manually or with further
2030 .Cm got backout
2031 commands,
2032 committed with
2033 .Cm got commit ,
2034 or discarded again with
2035 .Cm got revert .
2036 .Pp
2037 .Cm got backout
2038 will refuse to run if certain preconditions are not met.
2039 If the work tree contains multiple base commits, it must first be updated
2040 to a single base commit with
2041 .Cm got update .
2042 If any relevant files already contain merge conflicts, these
2043 conflicts must be resolved first.
2044 .Tg rb
2045 .It Xo
2046 .Cm rebase
2047 .Op Fl aclX
2048 .Op Ar branch
2049 .Xc
2050 .Dl Pq alias: Cm rb
2051 Rebase commits on the specified
2052 .Ar branch
2053 onto the tip of the current branch of the work tree.
2054 The
2055 .Ar branch
2056 must share common ancestry with the work tree's current branch.
2057 Rebasing begins with the first descendant commit of the youngest
2058 common ancestor commit shared by the specified
2059 .Ar branch
2060 and the work tree's current branch, and stops once the tip commit
2061 of the specified
2062 .Ar branch
2063 has been rebased.
2064 .Pp
2065 When
2066 .Cm got rebase
2067 is used as intended, the specified
2068 .Ar branch
2069 represents a local commit history and may already contain changes
2070 that are not yet visible in any other repositories.
2071 The work tree's current branch, which must be set with
2072 .Cm got update -b
2073 before starting the
2074 .Cm rebase
2075 operation, represents a branch from a remote repository which shares
2076 a common history with the specified
2077 .Ar branch
2078 but has progressed, and perhaps diverged, due to commits added to the
2079 remote repository.
2080 .Pp
2081 Rebased commits are accumulated on a temporary branch which the work tree
2082 will remain switched to throughout the entire rebase operation.
2083 Commits on this branch represent the same changes with the same log
2084 messages as their counterparts on the original
2085 .Ar branch ,
2086 but with different commit IDs.
2087 Once rebasing has completed successfully, the temporary branch becomes
2088 the new version of the specified
2089 .Ar branch
2090 and the work tree is automatically switched to it.
2091 If author information is available via the
2092 .Ev GOT_AUTHOR
2093 environment variable,
2094 .Xr got.conf 5
2095 or Git's
2096 .Dv user.name
2097 and
2098 .Dv user.email
2099 configuration settings, this author information will be used to identify
2100 the
2101 .Dq committer
2102 of rebased commits.
2103 .Pp
2104 Old commits in their pre-rebase state are automatically backed up in the
2105 .Dq refs/got/backup/rebase
2106 reference namespace.
2107 As long as these references are not removed older versions of rebased
2108 commits will remain in the repository and can be viewed with the
2109 .Cm got rebase -l
2110 command.
2111 Removal of these references makes objects which become unreachable via
2112 any reference subject to removal by Git's garbage collector or
2113 .Cm gotadmin cleanup .
2114 .Pp
2115 While rebasing commits, show the status of each affected file,
2116 using the following status codes:
2117 .Bl -column YXZ description
2118 .It G Ta file was merged
2119 .It C Ta file was merged and conflicts occurred during merge
2120 .It ! Ta changes destined for a missing file were not merged
2121 .It D Ta file was deleted
2122 .It d Ta file's deletion was prevented by local modifications
2123 .It A Ta new file was added
2124 .It \(a~ Ta changes destined for a non-regular file were not merged
2125 .It ? Ta changes destined for an unversioned file were not merged
2126 .El
2127 .Pp
2128 If merge conflicts occur, the rebase operation is interrupted and may
2129 be continued once conflicts have been resolved.
2130 If any files with destined changes are found to be missing or unversioned,
2131 or if files could not be deleted due to differences in deleted content,
2132 the rebase operation will be interrupted to prevent potentially incomplete
2133 changes from being committed to the repository without user intervention.
2134 The work tree may be modified as desired and the rebase operation can be
2135 continued once the changes present in the work tree are considered complete.
2136 Alternatively, the rebase operation may be aborted which will leave
2137 .Ar branch
2138 unmodified and the work tree switched back to its original branch.
2139 .Pp
2140 If a merge conflict is resolved in a way which renders the merged
2141 change into a no-op change, the corresponding commit will be elided
2142 when the rebase operation continues.
2143 .Pp
2144 .Cm got rebase
2145 will refuse to run if certain preconditions are not met.
2146 If the
2147 .Ar branch
2148 is not in the
2149 .Dq refs/heads/
2150 reference namespace, the branch may not be rebased.
2151 If the work tree is not yet fully updated to the tip commit of its
2152 branch, then the work tree must first be updated with
2153 .Cm got update .
2154 If changes have been staged with
2155 .Cm got stage ,
2156 these changes must first be committed with
2157 .Cm got commit
2158 or unstaged with
2159 .Cm got unstage .
2160 If the work tree contains local changes, these changes must first be
2161 committed with
2162 .Cm got commit
2163 or reverted with
2164 .Cm got revert .
2165 If the
2166 .Ar branch
2167 contains changes to files outside of the work tree's path prefix,
2168 the work tree cannot be used to rebase this branch.
2169 .Pp
2170 The
2171 .Cm got update
2172 and
2173 .Cm got commit
2174 commands will refuse to run while a rebase operation is in progress.
2175 Other commands which manipulate the work tree may be used for
2176 conflict resolution purposes.
2177 .Pp
2178 If the specified
2179 .Ar branch
2180 is already based on the work tree's current branch, then no commits
2181 need to be rebased and
2182 .Cm got rebase
2183 will simply switch the work tree to the specified
2184 .Ar branch
2185 and update files in the work tree accordingly.
2186 .Pp
2187 The options for
2188 .Cm got rebase
2189 are as follows:
2190 .Bl -tag -width Ds
2191 .It Fl a
2192 Abort an interrupted rebase operation.
2193 If this option is used, no other command-line arguments are allowed.
2194 .It Fl c
2195 Continue an interrupted rebase operation.
2196 If this option is used, no other command-line arguments are allowed.
2197 .It Fl l
2198 Show a list of past rebase operations, represented by references in the
2199 .Dq refs/got/backup/rebase
2200 reference namespace.
2201 .Pp
2202 Display the author, date, and log message of each backed up commit,
2203 the object ID of the corresponding post-rebase commit, and
2204 the object ID of their common ancestor commit.
2205 Given these object IDs,
2206 the
2207 .Cm got log
2208 command with the
2209 .Fl c
2210 and
2211 .Fl x
2212 options can be used to examine the history of either version of the branch,
2213 and the
2214 .Cm got branch
2215 command with the
2216 .Fl c
2217 option can be used to create a new branch from a pre-rebase state if desired.
2218 .Pp
2219 If a
2220 .Ar branch
2221 is specified, only show commits which at some point in time represented this
2222 branch.
2223 Otherwise, list all backed up commits for any branches.
2224 .Pp
2225 If this option is used,
2226 .Cm got rebase
2227 does not require a work tree.
2228 None of the other options can be used together with
2229 .Fl l .
2230 .It Fl X
2231 Delete backups created by past rebase operations, represented by references
2232 in the
2233 .Dq refs/got/backup/rebase
2234 reference namespace.
2235 .Pp
2236 If a
2237 .Ar branch
2238 is specified, only delete backups which at some point in time represented
2239 this branch.
2240 Otherwise, delete all references found within
2241 .Dq refs/got/backup/rebase .
2242 .Pp
2243 Any commit, tree, tag, and blob objects belonging to deleted backups
2244 remain in the repository and may be removed separately with
2245 Git's garbage collector or
2246 .Cm gotadmin cleanup .
2247 .Pp
2248 If this option is used,
2249 .Cm got rebase
2250 does not require a work tree.
2251 None of the other options can be used together with
2252 .Fl X .
2253 .El
2254 .Tg he
2255 .It Xo
2256 .Cm histedit
2257 .Op Fl aceflmX
2258 .Op Fl F Ar histedit-script
2259 .Op Ar branch
2260 .Xc
2261 .Dl Pq alias: Cm he
2262 Edit commit history between the work tree's current base commit and
2263 the tip commit of the work tree's current branch.
2264 .Pp
2265 The
2266 .Cm got histedit
2267 command requires the
2268 .Ev GOT_AUTHOR
2269 environment variable to be set,
2270 unless an author has been configured in
2271 .Xr got.conf 5
2272 or Git's
2273 .Dv user.name
2274 and
2275 .Dv user.email
2276 configuration settings can be obtained from the repository's
2277 .Pa .git/config
2278 file or from Git's global
2279 .Pa ~/.gitconfig
2280 configuration file.
2281 .Pp
2282 Before starting a
2283 .Cm histedit
2284 operation, the work tree's current branch must be set with
2285 .Cm got update -b
2286 to the branch which should be edited, unless this branch is already the
2287 current branch of the work tree.
2288 The tip of this branch represents the upper bound (inclusive) of commits
2289 touched by the
2290 .Cm histedit
2291 operation.
2292 .Pp
2293 Furthermore, the work tree's base commit
2294 must be set with
2295 .Cm got update -c
2296 to a point in this branch's commit history where editing should begin.
2297 This commit represents the lower bound (non-inclusive) of commits touched
2298 by the
2299 .Cm histedit
2300 operation.
2301 .Pp
2302 Editing of commit history is controlled via a
2303 .Ar histedit script
2304 which can be written in an editor based on a template, passed on the
2305 command line, or generated with the
2306 .Fl f
2308 .Fl m
2309 options.
2310 .Pp
2311 The format of the histedit script is line-based.
2312 Each line in the script begins with a command name, followed by
2313 whitespace and an argument.
2314 For most commands, the expected argument is a commit ID SHA1 hash.
2315 Any remaining text on the line is ignored.
2316 Lines which begin with the
2317 .Sq #
2318 character are ignored entirely.
2319 .Pp
2320 The available histedit script commands are as follows:
2321 .Bl -column YXZ pick-commit
2322 .It Cm pick Ar commit Ta Use the specified commit as it is.
2323 .It Cm edit Ar commit Ta Use the specified commit but once changes have been
2324 merged into the work tree interrupt the histedit operation for amending.
2325 .It Cm fold Ar commit Ta Combine the specified commit with the next commit
2326 listed further below that will be used.
2327 .It Cm drop Ar commit Ta Remove this commit from the edited history.
2328 .It Cm mesg Oo Ar log-message Oc Ta Create a new log message for the commit of
2329 a preceding
2330 .Cm pick
2332 .Cm edit
2333 command on the previous line of the histedit script.
2334 The optional
2335 .Ar log-message
2336 argument provides a new single-line log message to use.
2337 If the
2338 .Ar log-message
2339 argument is omitted, open an editor where a new log message can be written.
2340 .El
2341 .Pp
2342 Every commit in the history being edited must be mentioned in the script.
2343 Lines may be re-ordered to change the order of commits in the edited history.
2344 No commit may be listed more than once.
2345 .Pp
2346 Edited commits are accumulated on a temporary branch which the work tree
2347 will remain switched to throughout the entire histedit operation.
2348 Once history editing has completed successfully, the temporary branch becomes
2349 the new version of the work tree's branch and the work tree is automatically
2350 switched to it.
2351 .Pp
2352 Old commits in their pre-histedit state are automatically backed up in the
2353 .Dq refs/got/backup/histedit
2354 reference namespace.
2355 As long as these references are not removed older versions of edited
2356 commits will remain in the repository and can be viewed with the
2357 .Cm got histedit -l
2358 command.
2359 Removal of these references makes objects which become unreachable via
2360 any reference subject to removal by Git's garbage collector or
2361 .Cm gotadmin cleanup .
2362 .Pp
2363 While merging commits, show the status of each affected file,
2364 using the following status codes:
2365 .Bl -column YXZ description
2366 .It G Ta file was merged
2367 .It C Ta file was merged and conflicts occurred during merge
2368 .It ! Ta changes destined for a missing file were not merged
2369 .It D Ta file was deleted
2370 .It d Ta file's deletion was prevented by local modifications
2371 .It A Ta new file was added
2372 .It \(a~ Ta changes destined for a non-regular file were not merged
2373 .It ? Ta changes destined for an unversioned file were not merged
2374 .El
2375 .Pp
2376 If merge conflicts occur, the histedit operation is interrupted and may
2377 be continued once conflicts have been resolved.
2378 If any files with destined changes are found to be missing or unversioned,
2379 or if files could not be deleted due to differences in deleted content,
2380 the histedit operation will be interrupted to prevent potentially incomplete
2381 changes from being committed to the repository without user intervention.
2382 The work tree may be modified as desired and the histedit operation can be
2383 continued once the changes present in the work tree are considered complete.
2384 Alternatively, the histedit operation may be aborted which will leave
2385 the work tree switched back to its original branch.
2386 .Pp
2387 If a merge conflict is resolved in a way which renders the merged
2388 change into a no-op change, the corresponding commit will be elided
2389 when the histedit operation continues.
2390 .Pp
2391 .Cm got histedit
2392 will refuse to run if certain preconditions are not met.
2393 If the work tree's current branch is not in the
2394 .Dq refs/heads/
2395 reference namespace, the history of the branch may not be edited.
2396 If the work tree contains multiple base commits, it must first be updated
2397 to a single base commit with
2398 .Cm got update .
2399 If changes have been staged with
2400 .Cm got stage ,
2401 these changes must first be committed with
2402 .Cm got commit
2403 or unstaged with
2404 .Cm got unstage .
2405 If the work tree contains local changes, these changes must first be
2406 committed with
2407 .Cm got commit
2408 or reverted with
2409 .Cm got revert .
2410 If the edited history contains changes to files outside of the work tree's
2411 path prefix, the work tree cannot be used to edit the history of this branch.
2412 .Pp
2413 The
2414 .Cm got update ,
2415 .Cm got rebase ,
2416 and
2417 .Cm got integrate
2418 commands will refuse to run while a histedit operation is in progress.
2419 Other commands which manipulate the work tree may be used, and the
2420 .Cm got commit
2421 command may be used to commit arbitrary changes to the temporary branch
2422 while the histedit operation is interrupted.
2423 .Pp
2424 The options for
2425 .Cm got histedit
2426 are as follows:
2427 .Bl -tag -width Ds
2428 .It Fl a
2429 Abort an interrupted histedit operation.
2430 If this option is used, no other command-line arguments are allowed.
2431 .It Fl c
2432 Continue an interrupted histedit operation.
2433 If this option is used, no other command-line arguments are allowed.
2434 .It Fl e
2435 Interrupt the histedit operation for editing after merging each commit.
2436 This option is a quick equivalent to a histedit script which uses the
2437 .Cm edit
2438 command for all commits.
2439 The
2440 .Fl e
2441 option can only be used when starting a new histedit operation.
2442 If this option is used, no other command-line arguments are allowed.
2443 .It Fl F Ar histedit-script
2444 Use the specified
2445 .Ar histedit-script
2446 instead of opening a temporary file in an editor where a histedit script
2447 can be written.
2448 .It Fl f
2449 Fold all commits into a single commit.
2450 This option is a quick equivalent to a histedit script which folds all
2451 commits, combining them all into one commit.
2452 The
2453 .Fl f
2454 option can only be used when starting a new histedit operation.
2455 If this option is used, no other command-line arguments are allowed.
2456 .It Fl l
2457 Show a list of past histedit operations, represented by references in the
2458 .Dq refs/got/backup/histedit
2459 reference namespace.
2460 .Pp
2461 Display the author, date, and log message of each backed up commit,
2462 the object ID of the corresponding post-histedit commit, and
2463 the object ID of their common ancestor commit.
2464 Given these object IDs,
2465 the
2466 .Cm got log
2467 command with the
2468 .Fl c
2469 and
2470 .Fl x
2471 options can be used to examine the history of either version of the branch,
2472 and the
2473 .Cm got branch
2474 command with the
2475 .Fl c
2476 option can be used to create a new branch from a pre-histedit state if desired.
2477 .Pp
2478 If a
2479 .Ar branch
2480 is specified, only show commits which at some point in time represented this
2481 branch.
2482 Otherwise, list all backed up commits for any branches.
2483 .Pp
2484 If this option is used,
2485 .Cm got histedit
2486 does not require a work tree.
2487 None of the other options can be used together with
2488 .Fl l .
2489 .It Fl m
2490 Edit log messages only.
2491 This option is a quick equivalent to a histedit script which edits
2492 only log messages but otherwise leaves every picked commit as-is.
2493 The
2494 .Fl m
2495 option can only be used when starting a new histedit operation.
2496 If this option is used, no other command-line arguments are allowed.
2497 .It Fl X
2498 Delete backups created by past histedit operations, represented by references
2499 in the
2500 .Dq refs/got/backup/histedit
2501 reference namespace.
2502 .Pp
2503 If a
2504 .Ar branch
2505 is specified, only delete backups which at some point in time represented
2506 this branch.
2507 Otherwise, delete all references found within
2508 .Dq refs/got/backup/histedit .
2509 .Pp
2510 Any commit, tree, tag, and blob objects belonging to deleted backups
2511 remain in the repository and may be removed separately with
2512 Git's garbage collector or
2513 .Cm gotadmin cleanup .
2514 .Pp
2515 If this option is used,
2516 .Cm got histedit
2517 does not require a work tree.
2518 None of the other options can be used together with
2519 .Fl X .
2520 .El
2521 .Tg ig
2522 .It Cm integrate Ar branch
2523 .Dl Pq alias: Cm ig
2524 Integrate the specified
2525 .Ar branch
2526 into the work tree's current branch.
2527 Files in the work tree are updated to match the contents on the integrated
2528 .Ar branch ,
2529 and the reference of the work tree's branch is changed to point at the
2530 head commit of the integrated
2531 .Ar branch .
2532 .Pp
2533 Both branches can be considered equivalent after integration since they
2534 will be pointing at the same commit.
2535 Both branches remain available for future work, if desired.
2536 In case the integrated
2537 .Ar branch
2538 is no longer needed it may be deleted with
2539 .Cm got branch -d .
2540 .Pp
2541 Show the status of each affected file, using the following status codes:
2542 .Bl -column YXZ description
2543 .It U Ta file was updated
2544 .It D Ta file was deleted
2545 .It A Ta new file was added
2546 .It \(a~ Ta versioned file is obstructed by a non-regular file
2547 .It ! Ta a missing versioned file was restored
2548 .El
2549 .Pp
2550 .Cm got integrate
2551 will refuse to run if certain preconditions are not met.
2552 Most importantly, the
2553 .Ar branch
2554 must have been rebased onto the work tree's current branch with
2555 .Cm got rebase
2556 before it can be integrated, in order to linearize commit history and
2557 resolve merge conflicts.
2558 If the work tree contains multiple base commits, it must first be updated
2559 to a single base commit with
2560 .Cm got update .
2561 If changes have been staged with
2562 .Cm got stage ,
2563 these changes must first be committed with
2564 .Cm got commit
2565 or unstaged with
2566 .Cm got unstage .
2567 If the work tree contains local changes, these changes must first be
2568 committed with
2569 .Cm got commit
2570 or reverted with
2571 .Cm got revert .
2572 .Tg mg
2573 .It Xo
2574 .Cm merge
2575 .Op Fl acn
2576 .Op Ar branch
2577 .Xc
2578 .Dl Pq alias: Cm mg
2579 Create a merge commit based on the current branch of the work tree and
2580 the specified
2581 .Ar branch .
2582 If a linear project history is desired, then use of
2583 .Cm got rebase
2584 should be preferred over
2585 .Cm got merge .
2586 However, even strictly linear projects may require merge commits in order
2587 to merge in new versions of third-party code stored on vendor branches
2588 created with
2589 .Cm got import .
2590 .Pp
2591 Merge commits are commits based on multiple parent commits.
2592 The tip commit of the work tree's current branch, which must be set with
2593 .Cm got update -b
2594 before starting the
2595 .Cm merge
2596 operation, will be used as the first parent.
2597 The tip commit of the specified
2598 .Ar branch
2599 will be used as the second parent.
2600 .Pp
2601 No ancestral relationship between the two branches is required.
2602 If the two branches have already been merged previously, only new changes
2603 will be merged.
2604 .Pp
2605 It is not possible to create merge commits with more than two parents.
2606 If more than one branch needs to be merged, then multiple merge commits
2607 with two parents each can be created in sequence.
2608 .Pp
2609 While merging changes found on the
2610 .Ar branch
2611 into the work tree, show the status of each affected file,
2612 using the following status codes:
2613 .Bl -column YXZ description
2614 .It G Ta file was merged
2615 .It C Ta file was merged and conflicts occurred during merge
2616 .It ! Ta changes destined for a missing file were not merged
2617 .It D Ta file was deleted
2618 .It d Ta file's deletion was prevented by local modifications
2619 .It A Ta new file was added
2620 .It \(a~ Ta changes destined for a non-regular file were not merged
2621 .It ? Ta changes destined for an unversioned file were not merged
2622 .El
2623 .Pp
2624 If merge conflicts occur, the merge operation is interrupted and conflicts
2625 must be resolved before the merge operation can continue.
2626 If any files with destined changes are found to be missing or unversioned,
2627 or if files could not be deleted due to differences in deleted content,
2628 the merge operation will be interrupted to prevent potentially incomplete
2629 changes from being committed to the repository without user intervention.
2630 The work tree may be modified as desired and the merge can be continued
2631 once the changes present in the work tree are considered complete.
2632 Alternatively, the merge operation may be aborted which will leave
2633 the work tree's current branch unmodified.
2634 .Pp
2635 If a merge conflict is resolved in a way which renders all merged
2636 changes into no-op changes, the merge operation cannot continue
2637 and must be aborted.
2638 .Pp
2639 .Cm got merge
2640 will refuse to run if certain preconditions are not met.
2641 If history of the
2642 .Ar branch
2643 is based on the work tree's current branch, then no merge commit can
2644 be created and
2645 .Cm got integrate
2646 may be used to integrate the
2647 .Ar branch
2648 instead.
2649 If the work tree is not yet fully updated to the tip commit of its
2650 branch, then the work tree must first be updated with
2651 .Cm got update .
2652 If the work tree contains multiple base commits, it must first be updated
2653 to a single base commit with
2654 .Cm got update .
2655 If changes have been staged with
2656 .Cm got stage ,
2657 these changes must first be committed with
2658 .Cm got commit
2659 or unstaged with
2660 .Cm got unstage .
2661 If the work tree contains local changes, these changes must first be
2662 committed with
2663 .Cm got commit
2664 or reverted with
2665 .Cm got revert .
2666 If the
2667 .Ar branch
2668 contains changes to files outside of the work tree's path prefix,
2669 the work tree cannot be used to merge this branch.
2670 .Pp
2671 The
2672 .Cm got update ,
2673 .Cm got commit ,
2674 .Cm got rebase ,
2675 .Cm got histedit ,
2676 .Cm got integrate ,
2677 and
2678 .Cm got stage
2679 commands will refuse to run while a merge operation is in progress.
2680 Other commands which manipulate the work tree may be used for
2681 conflict resolution purposes.
2682 .Pp
2683 The options for
2684 .Cm got merge
2685 are as follows:
2686 .Bl -tag -width Ds
2687 .It Fl a
2688 Abort an interrupted merge operation.
2689 If this option is used, no other command-line arguments are allowed.
2690 .It Fl c
2691 Continue an interrupted merge operation.
2692 If this option is used, no other command-line arguments are allowed.
2693 .It Fl n
2694 Merge changes into the work tree as usual but do not create a merge
2695 commit immediately.
2696 The merge result can be adjusted as desired before a merge commit is
2697 created with
2698 .Cm got merge -c .
2699 Alternatively, the merge may be aborted with
2700 .Cm got merge -a .
2701 .El
2702 .Tg sg
2703 .It Xo
2704 .Cm stage
2705 .Op Fl lpS
2706 .Op Fl F Ar response-script
2707 .Op Ar path ...
2708 .Xc
2709 .Dl Pq alias: Cm sg
2710 Stage local changes for inclusion in the next commit.
2711 If no
2712 .Ar path
2713 is specified, stage all changes in the work tree.
2714 Otherwise, stage changes at or within the specified paths.
2715 Paths may be staged if they are added, modified, or deleted according to
2716 .Cm got status .
2717 .Pp
2718 Show the status of each affected file, using the following status codes:
2719 .Bl -column YXZ description
2720 .It A Ta file addition has been staged
2721 .It M Ta file modification has been staged
2722 .It D Ta file deletion has been staged
2723 .El
2724 .Pp
2725 Staged file contents are saved in newly created blob objects in the repository.
2726 These blobs will be referred to by tree objects once staged changes have been
2727 committed.
2728 .Pp
2729 Staged changes affect the behaviour of
2730 .Cm got commit ,
2731 .Cm got status ,
2732 and
2733 .Cm got diff .
2734 While paths with staged changes exist, the
2735 .Cm got commit
2736 command will refuse to commit any paths which do not have staged changes.
2737 Local changes created on top of staged changes can only be committed if
2738 the path is staged again, or if the staged changes are committed first.
2739 The
2740 .Cm got status
2741 command will show both local changes and staged changes.
2742 The
2743 .Cm got diff
2744 command is able to display local changes relative to staged changes,
2745 and to display staged changes relative to the repository.
2746 The
2747 .Cm got revert
2748 command cannot revert staged changes but may be used to revert
2749 local changes created on top of staged changes.
2750 .Pp
2751 The options for
2752 .Cm got stage
2753 are as follows:
2754 .Bl -tag -width Ds
2755 .It Fl F Ar response-script
2756 With the
2757 .Fl p
2758 option, read
2759 .Dq y ,
2760 .Dq n ,
2761 and
2762 .Dq q
2763 responses line-by-line from the specified
2764 .Ar response-script
2765 file instead of prompting interactively.
2766 .It Fl l
2767 Instead of staging new changes, list paths which are already staged,
2768 along with the IDs of staged blob objects and stage status codes.
2769 If paths were provided on the command line, show the staged paths
2770 among the specified paths.
2771 Otherwise, show all staged paths.
2772 .It Fl p
2773 Instead of staging the entire content of a changed file, interactively
2774 select or reject changes for staging based on
2775 .Dq y
2776 (stage change),
2777 .Dq n
2778 (reject change), and
2779 .Dq q
2780 (quit staging this file) responses.
2781 If a file is in modified status, individual patches derived from the
2782 modified file content can be staged.
2783 Files in added or deleted status may only be staged or rejected in
2784 their entirety.
2785 .It Fl S
2786 Allow staging of symbolic links which point outside of the path space
2787 that is under version control.
2788 By default,
2789 .Cm got stage
2790 will reject such symbolic links due to safety concerns.
2791 As a precaution,
2792 .Nm
2793 may decide to represent such a symbolic link as a regular file which contains
2794 the link's target path, rather than creating an actual symbolic link which
2795 points outside of the work tree.
2796 Use of this option is discouraged because external mechanisms such as
2797 .Dq make obj
2798 are better suited for managing symbolic links to paths not under
2799 version control.
2800 .El
2801 .Pp
2802 .Cm got stage
2803 will refuse to run if certain preconditions are not met.
2804 If a file contains merge conflicts, these conflicts must be resolved first.
2805 If a file is found to be out of date relative to the head commit on the
2806 work tree's current branch, the file must be updated with
2807 .Cm got update
2808 before it can be staged (however, this does not prevent the file from
2809 becoming out-of-date at some point after having been staged).
2810 .Pp
2811 The
2812 .Cm got update ,
2813 .Cm got rebase ,
2814 and
2815 .Cm got histedit
2816 commands will refuse to run while staged changes exist.
2817 If staged changes cannot be committed because a staged path
2818 is out of date, the path must be unstaged with
2819 .Cm got unstage
2820 before it can be updated with
2821 .Cm got update ,
2822 and may then be staged again if necessary.
2823 .Tg ug
2824 .It Xo
2825 .Cm unstage
2826 .Op Fl p
2827 .Op Fl F Ar response-script
2828 .Op Ar path ...
2829 .Xc
2830 .Dl Pq alias: Cm ug
2831 Merge staged changes back into the work tree and put affected paths
2832 back into non-staged status.
2833 If no
2834 .Ar path
2835 is specified, unstage all staged changes across the entire work tree.
2836 Otherwise, unstage changes at or within the specified paths.
2837 .Pp
2838 Show the status of each affected file, using the following status codes:
2839 .Bl -column YXZ description
2840 .It G Ta file was unstaged
2841 .It C Ta file was unstaged and conflicts occurred during merge
2842 .It ! Ta changes destined for a missing file were not merged
2843 .It D Ta file was staged as deleted and still is deleted
2844 .It d Ta file's deletion was prevented by local modifications
2845 .It \(a~ Ta changes destined for a non-regular file were not merged
2846 .El
2847 .Pp
2848 The options for
2849 .Cm got unstage
2850 are as follows:
2851 .Bl -tag -width Ds
2852 .It Fl F Ar response-script
2853 With the
2854 .Fl p
2855 option, read
2856 .Dq y ,
2857 .Dq n ,
2858 and
2859 .Dq q
2860 responses line-by-line from the specified
2861 .Ar response-script
2862 file instead of prompting interactively.
2863 .It Fl p
2864 Instead of unstaging the entire content of a changed file, interactively
2865 select or reject changes for unstaging based on
2866 .Dq y
2867 (unstage change),
2868 .Dq n
2869 (keep change staged), and
2870 .Dq q
2871 (quit unstaging this file) responses.
2872 If a file is staged in modified status, individual patches derived from the
2873 staged file content can be unstaged.
2874 Files staged in added or deleted status may only be unstaged in their entirety.
2875 .El
2876 .It Xo
2877 .Cm cat
2878 .Op Fl P
2879 .Op Fl c Ar commit
2880 .Op Fl r Ar repository-path
2881 .Ar arg ...
2882 .Xc
2883 Parse and print contents of objects to standard output in a line-based
2884 text format.
2885 Content of commit, tree, and tag objects is printed in a way similar
2886 to the actual content stored in such objects.
2887 Blob object contents are printed as they would appear in files on disk.
2888 .Pp
2889 Attempt to interpret each argument as a reference, a tag name, or
2890 an object ID SHA1 hash.
2891 References will be resolved to an object ID.
2892 Tag names will resolved to a tag object.
2893 An abbreviated hash argument will be expanded to a full SHA1 hash
2894 automatically, provided the abbreviation is unique.
2895 .Pp
2896 If none of the above interpretations produce a valid result, or if the
2897 .Fl P
2898 option is used, attempt to interpret the argument as a path which will
2899 be resolved to the ID of an object found at this path in the repository.
2900 .Pp
2901 The options for
2902 .Cm got cat
2903 are as follows:
2904 .Bl -tag -width Ds
2905 .It Fl c Ar commit
2906 Look up paths in the specified
2907 .Ar commit .
2908 If this option is not used, paths are looked up in the commit resolved
2909 via the repository's HEAD reference.
2910 The expected argument is a commit ID SHA1 hash or an existing reference
2911 or tag name which will be resolved to a commit ID.
2912 An abbreviated hash argument will be expanded to a full SHA1 hash
2913 automatically, provided the abbreviation is unique.
2914 .It Fl P
2915 Interpret all arguments as paths only.
2916 This option can be used to resolve ambiguity in cases where paths
2917 look like tag names, reference names, or object IDs.
2918 .It Fl r Ar repository-path
2919 Use the repository at the specified path.
2920 If not specified, assume the repository is located at or above the current
2921 working directory.
2922 If this directory is a
2923 .Nm
2924 work tree, use the repository path associated with this work tree.
2925 .El
2926 .It Cm info Op Ar path ...
2927 Display meta-data stored in a work tree.
2928 See
2929 .Xr got-worktree 5
2930 for details.
2931 .Pp
2932 The work tree to use is resolved implicitly by walking upwards from the
2933 current working directory.
2934 .Pp
2935 If one or more
2936 .Ar path
2937 arguments are specified, show additional per-file information for tracked
2938 files located at or within these paths.
2939 If a
2940 .Ar path
2941 argument corresponds to the work tree's root directory, display information
2942 for all tracked files.
2943 .El
2944 .Sh ENVIRONMENT
2945 .Bl -tag -width GOT_IGNORE_GITCONFIG
2946 .It Ev GOT_AUTHOR
2947 The author's name and email address, such as
2948 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
2949 Used by the
2950 .Cm got commit ,
2951 .Cm got import ,
2952 .Cm got rebase ,
2953 and
2954 .Cm got histedit
2955 commands.
2956 Because
2957 .Xr git 1
2958 may fail to parse commits without an email address in author data,
2959 .Nm
2960 attempts to reject
2961 .Ev GOT_AUTHOR
2962 environment variables with a missing email address.
2963 .Pp
2964 .Ev GOT_AUTHOR will be overridden by configuration settings in
2965 .Xr got.conf 5
2966 or by Git's
2967 .Dv user.name
2968 and
2969 .Dv user.email
2970 configuration settings in the repository's
2971 .Pa .git/config
2972 file.
2973 The
2974 .Dv user.name
2975 and
2976 .Dv user.email
2977 configuration settings contained in Git's global
2978 .Pa ~/.gitconfig
2979 configuration file will only be used if neither
2980 .Xr got.conf 5
2981 nor the
2982 .Ev GOT_AUTHOR
2983 environment variable provide author information.
2984 .It Ev VISUAL , EDITOR
2985 The editor spawned by
2986 .Cm got commit ,
2987 .Cm got histedit ,
2988 .Cm got import ,
2990 .Cm got tag .
2991 If not set, the
2992 .Xr ed 1
2993 text editor will be spawned in order to give
2994 .Xr ed 1
2995 the attention it deserves.
2996 .It Ev GOT_LOG_DEFAULT_LIMIT
2997 The default limit on the number of commits traversed by
2998 .Cm got log .
2999 If set to zero, the limit is unbounded.
3000 This variable will be silently ignored if it is set to a non-numeric value.
3001 .It Ev GOT_IGNORE_GITCONFIG
3002 If this variable is set then any remote repository definitions or author
3003 information found in Git configuration files will be ignored.
3004 .El
3005 .Sh FILES
3006 .Bl -tag -width packed-refs -compact
3007 .It Pa got.conf
3008 Repository-wide configuration settings for
3009 .Nm .
3010 If present, a
3011 .Xr got.conf 5
3012 configuration file located in the root directory of a Git repository
3013 supersedes any relevant settings in Git's
3014 .Pa config
3015 file.
3016 .Pp
3017 .It Pa .got/got.conf
3018 Worktree-specific configuration settings for
3019 .Nm .
3020 If present, a
3021 .Xr got.conf 5
3022 configuration file in the
3023 .Pa .got
3024 meta-data directory of a work tree supersedes any relevant settings in
3025 the repository's
3026 .Xr got.conf 5
3027 configuration file and Git's
3028 .Pa config
3029 file.
3030 .El
3031 .Sh EXIT STATUS
3032 .Ex -std got
3033 .Sh EXAMPLES
3034 Enable tab-completion of
3035 .Nm
3036 command names in
3037 .Xr ksh 1 :
3038 .Pp
3039 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
3040 .Pp
3041 Clone an existing Git repository for use with
3042 .Nm .
3043 .Pp
3044 .Dl $ cd /var/git/
3045 .Dl $ got clone ssh://git@github.com/openbsd/src.git
3046 .Pp
3047 Use of HTTP URLs currently requires
3048 .Xr git 1 :
3049 .Pp
3050 .Dl $ cd /var/git/
3051 .Dl $ git clone --bare https://github.com/openbsd/src.git
3052 .Pp
3053 Alternatively, for quick and dirty local testing of
3054 .Nm
3055 a new Git repository could be created and populated with files,
3056 e.g. from a temporary CVS checkout located at
3057 .Pa /tmp/src :
3058 .Pp
3059 .Dl $ gotadmin init /var/git/src.git
3060 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
3061 .Pp
3062 Check out a work tree from the Git repository to /usr/src:
3063 .Pp
3064 .Dl $ got checkout /var/git/src.git /usr/src
3065 .Pp
3066 View local changes in a work tree directory:
3067 .Pp
3068 .Dl $ got diff | less
3069 .Pp
3070 In a work tree, display files in a potentially problematic state:
3071 .Pp
3072 .Dl $ got status -s 'C!~?'
3073 .Pp
3074 Interactively revert selected local changes in a work tree directory:
3075 .Pp
3076 .Dl $ got revert -p -R\ .
3077 .Pp
3078 In a work tree or a git repository directory, list all branch references:
3079 .Pp
3080 .Dl $ got branch -l
3081 .Pp
3082 In a work tree or a git repository directory, create a new branch called
3083 .Dq unified-buffer-cache
3084 which is forked off the
3085 .Dq master
3086 branch:
3087 .Pp
3088 .Dl $ got branch -c master unified-buffer-cache
3089 .Pp
3090 Switch an existing work tree to the branch
3091 .Dq unified-buffer-cache .
3092 Local changes in the work tree will be preserved and merged if necessary:
3093 .Pp
3094 .Dl $ got update -b unified-buffer-cache
3095 .Pp
3096 Create a new commit from local changes in a work tree directory.
3097 This new commit will become the head commit of the work tree's current branch:
3098 .Pp
3099 .Dl $ got commit
3100 .Pp
3101 In a work tree or a git repository directory, view changes committed in
3102 the 3 most recent commits to the work tree's branch, or the branch resolved
3103 via the repository's HEAD reference, respectively:
3104 .Pp
3105 .Dl $ got log -p -l 3
3106 .Pp
3107 As above, but display changes in the order in which
3108 .Xr patch 1
3109 could apply them in sequence:
3110 .Pp
3111 .Dl $ got log -p -l 3 -R
3112 .Pp
3113 In a work tree or a git repository directory, log the history of a subdirectory:
3114 .Pp
3115 .Dl $ got log sys/uvm
3116 .Pp
3117 While operating inside a work tree, paths are specified relative to the current
3118 working directory, so this command will log the subdirectory
3119 .Pa sys/uvm :
3120 .Pp
3121 .Dl $ cd sys/uvm && got log\ .
3122 .Pp
3123 And this command has the same effect:
3124 .Pp
3125 .Dl $ cd sys/dev/usb && got log ../../uvm
3126 .Pp
3127 And this command displays work tree meta-data about all tracked files:
3128 .Pp
3129 .Dl $ cd /usr/src
3130 .Dl $ got info\ . | less
3131 .Pp
3132 Add new files and remove obsolete files in a work tree directory:
3133 .Pp
3134 .Dl $ got add sys/uvm/uvm_ubc.c
3135 .Dl $ got remove sys/uvm/uvm_vnode.c
3136 .Pp
3137 Create a new commit from local changes in a work tree directory
3138 with a pre-defined log message.
3139 .Pp
3140 .Dl $ got commit -m 'unify the buffer cache'
3141 .Pp
3142 Alternatively, create a new commit from local changes in a work tree
3143 directory with a log message that has been prepared in the file
3144 .Pa /tmp/msg :
3145 .Pp
3146 .Dl $ got commit -F /tmp/msg
3147 .Pp
3148 Update any work tree checked out from the
3149 .Dq unified-buffer-cache
3150 branch to the latest commit on this branch:
3151 .Pp
3152 .Dl $ got update
3153 .Pp
3154 Roll file content on the unified-buffer-cache branch back by one commit,
3155 and then fetch the rolled-back change into the work tree as a local change
3156 to be amended and perhaps committed again:
3157 .Pp
3158 .Dl $ got backout unified-buffer-cache
3159 .Dl $ got commit -m 'roll back previous'
3160 .Dl $ # now back out the previous backout :-)
3161 .Dl $ got backout unified-buffer-cache
3162 .Pp
3163 Fetch new changes on the remote repository's
3164 .Dq master
3165 branch, making them visible on the local repository's
3166 .Dq origin/master
3167 branch:
3168 .Pp
3169 .Dl $ cd /usr/src
3170 .Dl $ got fetch
3171 .Pp
3172 In a repository created with a HTTP URL and
3173 .Cm git clone --bare
3174 the
3175 .Xr git-fetch 1
3176 command must be used instead:
3177 .Pp
3178 .Dl $ cd /var/git/src.git
3179 .Dl $ git fetch origin master:refs/remotes/origin/master
3180 .Pp
3181 Rebase the local
3182 .Dq master
3183 branch to merge the new changes that are now visible on the
3184 .Dq origin/master
3185 branch:
3186 .Pp
3187 .Dl $ cd /usr/src
3188 .Dl $ got update -b origin/master
3189 .Dl $ got rebase master
3190 .Pp
3191 Rebase the
3192 .Dq unified-buffer-cache
3193 branch on top of the new head commit of the
3194 .Dq master
3195 branch.
3196 .Pp
3197 .Dl $ got update -b master
3198 .Dl $ got rebase unified-buffer-cache
3199 .Pp
3200 Create a patch from all changes on the unified-buffer-cache branch.
3201 The patch can be mailed out for review and applied to
3202 .Ox Ns 's
3203 CVS tree:
3204 .Pp
3205 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
3206 .Pp
3207 Edit the entire commit history of the
3208 .Dq unified-buffer-cache
3209 branch:
3210 .Pp
3211 .Dl $ got update -b unified-buffer-cache
3212 .Dl $ got update -c master
3213 .Dl $ got histedit
3214 .Pp
3215 Before working against existing branches in a repository cloned with
3216 .Cm git clone --bare
3217 instead of
3218 .Cm got clone ,
3219 a Git
3220 .Dq refspec
3221 must be configured to map all references in the remote repository
3222 into the
3223 .Dq refs/remotes
3224 namespace of the local repository.
3225 This can be achieved by setting Git's
3226 .Pa remote.origin.fetch
3227 configuration variable to the value
3228 .Dq +refs/heads/*:refs/remotes/origin/*
3229 with the
3230 .Cm git config
3231 command:
3232 .Pp
3233 .Dl $ cd /var/git/repo
3234 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
3235 .Pp
3236 Additionally, the
3237 .Dq mirror
3238 option must be disabled:
3239 .Pp
3240 .Dl $ cd /var/git/repo
3241 .Dl $ git config remote.origin.mirror false
3242 .Pp
3243 Alternatively, the following
3244 .Xr git-fetch 1
3245 configuration item can be added manually to the Git repository's
3246 .Pa config
3247 file:
3248 .Pp
3249 .Dl [remote \&"origin\&"]
3250 .Dl url = ...
3251 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
3252 .Dl mirror = false
3253 .Pp
3254 This configuration leaves the local repository's
3255 .Dq refs/heads
3256 namespace free for use by local branches checked out with
3257 .Cm got checkout
3258 and, if needed, created with
3259 .Cm got branch .
3260 Branches in the
3261 .Dq refs/remotes/origin
3262 namespace can now be updated with incoming changes from the remote
3263 repository with
3264 .Cm got fetch
3266 .Xr git-fetch 1
3267 without extra command line arguments.
3268 Newly fetched changes can be examined with
3269 .Cm got log .
3270 .Pp
3271 Display changes on the remote repository's version of the
3272 .Dq master
3273 branch, as of the last time
3274 .Cm got fetch
3275 was run:
3276 .Pp
3277 .Dl $ got log -c origin/master | less
3278 .Pp
3279 As shown here, most commands accept abbreviated reference names such as
3280 .Dq origin/master
3281 instead of
3282 .Dq refs/remotes/origin/master .
3283 The latter is only needed in case of ambiguity.
3284 .Pp
3285 .Cm got rebase
3286 must be used to merge changes which are visible on the
3287 .Dq origin/master
3288 branch into the
3289 .Dq master
3290 branch.
3291 This will also merge local changes, if any, with the incoming changes:
3292 .Pp
3293 .Dl $ got update -b origin/master
3294 .Dl $ got rebase master
3295 .Pp
3296 In order to make changes committed to the
3297 .Dq unified-buffer-cache
3298 visible on the
3299 .Dq master
3300 branch, the
3301 .Dq unified-buffer-cache
3302 branch must first be rebased onto the
3303 .Dq master
3304 branch:
3305 .Pp
3306 .Dl $ got update -b master
3307 .Dl $ got rebase unified-buffer-cache
3308 .Pp
3309 Changes on the
3310 .Dq unified-buffer-cache
3311 branch can now be made visible on the
3312 .Dq master
3313 branch with
3314 .Cm got integrate .
3315 Because the rebase operation switched the work tree to the
3316 .Dq unified-buffer-cache
3317 branch, the work tree must be switched back to the
3318 .Dq master
3319 branch first:
3320 .Pp
3321 .Dl $ got update -b master
3322 .Dl $ got integrate unified-buffer-cache
3323 .Pp
3324 On the
3325 .Dq master
3326 branch, log messages for local changes can now be amended with
3327 .Dq OK
3328 by other developers and any other important new information:
3329 .Pp
3330 .Dl $ got update -c origin/master
3331 .Dl $ got histedit -m
3332 .Pp
3333 If the remote repository offers write access, local changes on the
3334 .Dq master
3335 branch can be sent to the remote repository with
3336 .Cm got send .
3337 Usually,
3338 .Cm got send
3339 can be run without further arguments.
3340 The arguments shown here match defaults, provided the work tree's
3341 current branch is the
3342 .Dq master
3343 branch:
3344 .Pp
3345 .Dl $ got send -b master origin
3346 .Pp
3347 If the remote repository requires the HTTPS protocol, the
3348 .Xr git-push 1
3349 command must be used instead:
3350 .Pp
3351 .Dl $ cd /var/git/src.git
3352 .Dl $ git push origin master
3353 .Pp
3354 When making contributions to projects which use the
3355 .Dq pull request
3356 workflow, SSH protocol repository access needs to be set up first.
3357 Once an account has been created on a Git hosting site it should
3358 be possible to upload a public SSH key for repository access
3359 authentication.
3360 .Pp
3361 The
3362 .Dq pull request
3363 workflow will usually involve two remote repositories.
3364 In the real-life example below, the
3365 .Dq origin
3366 repository was forked from the
3367 .Dq upstream
3368 repository by using the Git hosting site's web interface.
3369 The
3370 .Xr got.conf 5
3371 file in the local repository describes both remote repositories:
3372 .Bd -literal -offset indent
3373 # Jelmers's repository, which accepts pull requests
3374 remote "upstream" {
3375 server git@github.com
3376 protocol ssh
3377 repository "/jelmer/dulwich"
3378 branch { "master" }
3381 # Stefan's fork, used as the default remote repository
3382 remote "origin" {
3383 server git@github.com
3384 protocol ssh
3385 repository "/stspdotname/dulwich"
3386 branch { "master" }
3388 .Ed
3389 .Pp
3390 With this configuration, Stefan can create commits on
3391 .Dq refs/heads/master
3392 and send them to the
3393 .Dq origin
3394 repository by running:
3395 .Pp
3396 .Dl $ got send -b master origin
3397 .Pp
3398 The changes can now be proposed to Jelmer by opening a pull request
3399 via the Git hosting site's web interface.
3400 If Jelmer requests further changes to be made, additional commits
3401 can be created on the
3402 .Dq master
3403 branch and be added to the pull request by running
3404 .Cd got send
3405 again.
3406 .Pp
3407 If Jelmer prefers additional commits to be
3408 .Dq squashed
3409 then the following commands can be used to achieve this:
3410 .Pp
3411 .Dl $ got update -b master
3412 .Dl $ got update -c origin/master
3413 .Dl $ got histedit -f
3414 .Dl $ got send -f -b master origin
3415 .Pp
3416 Once Jelmer has accepted the pull request, Stefan can fetch the
3417 merged changes, and possibly several other new changes, by running:
3418 .Pp
3419 .Dl $ got fetch upstream
3420 .Pp
3421 The merged changes will now be visible under the reference
3422 .Dq refs/remotes/upstream/master .
3423 The local
3424 .Dq master
3425 branch can now be rebased on top of the latest changes
3426 from upstream:
3427 .Pp
3428 .Dl $ got update -b upstream/master
3429 .Dl $ got rebase master
3430 .Pp
3431 As a final step, the forked repository's copy of the master branch needs
3432 to be kept in sync by sending the new changes there:
3433 .Pp
3434 .Dl $ got send -f -b master origin
3435 .Pp
3436 If multiple pull requests need to be managed in parallel, a separate branch
3437 must be created for each pull request with
3438 .Cm got branch .
3439 Each such branch can then be used as above, in place of
3440 .Dq refs/heads/master .
3441 Changes for any accepted pull requests will still appear under
3442 .Dq refs/remotes/upstream/master,
3443 regardless of which branch was used in the forked repository to
3444 create a pull request.
3445 .Sh SEE ALSO
3446 .Xr gotadmin 1 ,
3447 .Xr tog 1 ,
3448 .Xr git-repository 5 ,
3449 .Xr got-worktree 5 ,
3450 .Xr got.conf 5 ,
3451 .Xr gotweb 8
3452 .Sh AUTHORS
3453 .An Anthony J. Bentley Aq Mt bentley@openbsd.org
3454 .An Christian Weisgerber Aq Mt naddy@openbsd.org
3455 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
3456 .An Josh Rickmar Aq Mt jrick@zettaport.com
3457 .An Joshua Stein Aq Mt jcs@openbsd.org
3458 .An Klemens Nanni Aq Mt kn@openbsd.org
3459 .An Martin Pieuchot Aq Mt mpi@openbsd.org
3460 .An Neels Hofmeyr Aq Mt neels@hofmeyr.de
3461 .An Omar Polo Aq Mt op@openbsd.org
3462 .An Ori Bernstein Aq Mt ori@openbsd.org
3463 .An Sebastien Marie Aq Mt semarie@openbsd.org
3464 .An Stefan Sperling Aq Mt stsp@openbsd.org
3465 .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au
3466 .An Theo Buehler Aq Mt tb@openbsd.org
3467 .An Thomas Adam Aq Mt thomas@xteddy.org
3468 .An Tracey Emery Aq Mt tracey@traceyemery.net
3469 .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org
3470 .Pp
3471 Parts of
3472 .Nm ,
3473 .Xr tog 1 ,
3474 and
3475 .Xr gotweb 8
3476 were derived from code under copyright by:
3477 .Pp
3478 .An Caldera International
3479 .An Daniel Hartmeier
3480 .An Esben Norby
3481 .An Henning Brauer
3482 .An HÃ¥kan Olsson
3483 .An Ingo Schwarze
3484 .An Jean-Francois Brousseau
3485 .An Joris Vink
3486 .An Jyri J. Virkki
3487 .An Larry Wall
3488 .An Markus Friedl
3489 .An Niall O'Higgins
3490 .An Niklas Hallqvist
3491 .An Ray Lai
3492 .An Ryan McBride
3493 .An Theo de Raadt
3494 .An Todd C. Miller
3495 .An Xavier Santolaria
3496 .Pp
3497 .Nm
3498 contains code contributed to the public domain by
3499 .An Austin Appleby
3500 .Sh CAVEATS
3501 .Nm
3502 is a work-in-progress and some features remain to be implemented.
3503 .Pp
3504 At present, the user has to fall back on
3505 .Xr git 1
3506 to perform some tasks.
3507 In particular:
3508 .Bl -bullet
3509 .It
3510 Reading from remote repositories over HTTP or HTTPS protocols requires
3511 .Xr git-clone 1
3512 and
3513 .Xr git-fetch 1 .
3514 .It
3515 Writing to remote repositories over HTTP or HTTPS protocols requires
3516 .Xr git-push 1 .
3517 .It
3518 The creation of merge commits with more than two parent commits requires
3519 .Xr git-merge 1 .
3520 .It
3521 In situations where files or directories were moved around
3522 .Cm got
3523 will not automatically merge changes to new locations and
3524 .Xr git 1
3525 will usually produce better results.
3526 .El