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