make got-read-gotconfig clear its imsgbuf before exit in an error case
[got-portable.git] / cvg / cvg.1
blob5e361ba7f6fa77f9358deaad245b6589b7c35e15
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 CVG 1
19 .Os
20 .Sh NAME
21 .Nm cvg
22 .Nd CVS-like Git client
23 .Sh SYNOPSIS
24 .Nm
25 .Op Fl hV
26 .Ar command
27 .Op Ar arg ...
28 .Sh DESCRIPTION
29 .Nm
30 is a Git-compatible version control system with a user interface
31 similar to
32 .Xr cvs 1 .
33 .Pp
34 .Nm
35 supports local and remote Git repositories.
36 The Git repository format is described in
37 .Xr git-repository 5 .
38 .Pp
39 Files managed by
40 .Nm
41 must be checked out from the repository for modification.
42 Checked out files are stored in a
43 .Em work tree
44 which can be placed at an arbitrary directory in the filesystem hierarchy.
45 The on-disk format of this work tree is described in
46 .Xr cvg-worktree 5 .
47 .Pp
48 .Nm
49 provides global and command-specific options.
50 Global options must precede the command name, and are as follows:
51 .Bl -tag -width tenletters
52 .It Fl h
53 Display usage information and exit immediately.
54 .It Fl V , -version
55 Display program version and exit immediately.
56 .El
57 .Pp
58 The commands for
59 .Nm
60 are as follows:
61 .Bl -tag -width checkout
62 .Tg im
63 .It Xo
64 .Cm import
65 .Op Fl b Ar branch
66 .Op Fl I Ar pattern
67 .Op Fl m Ar message
68 .Op Fl r Ar repository-path
69 .Ar directory
70 .Xc
71 .Dl Pq alias: Cm im
72 Create an initial commit in a repository from the file hierarchy
73 within the specified
74 .Ar directory .
75 The created commit will not have any parent commits, i.e. it will be a
76 root commit.
77 Also create a new reference which provides a branch name for the newly
78 created commit.
79 Show the path of each imported file to indicate progress.
80 .Pp
81 The
82 .Cm got import
83 command requires the
84 .Ev GOT_AUTHOR
85 environment variable to be set,
86 unless an author has been configured in
87 .Xr got.conf 5
88 or Git's
89 .Dv user.name
90 and
91 .Dv user.email
92 configuration settings can be obtained from the repository's
93 .Pa .git/config
94 file or from Git's global
95 .Pa ~/.gitconfig
96 configuration file.
97 .Pp
98 The options for
99 .Cm got import
100 are as follows:
101 .Bl -tag -width Ds
102 .It Fl b Ar branch
103 Create the specified
104 .Ar branch .
105 If this option is not specified, a branch corresponding to the repository's
106 HEAD reference will be used.
107 Use of this option is required if the branch resolved via the repository's
108 HEAD reference already exists.
109 .It Fl I Ar pattern
110 Ignore files or directories with a name which matches the specified
111 .Ar pattern .
112 This option may be specified multiple times to build a list of ignore patterns.
114 .Ar pattern
115 follows the globbing rules documented in
116 .Xr glob 7 .
117 Ignore patterns which end with a slash,
118 .Dq / ,
119 will only match directories.
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 Quitting the editor without saving the file will abort the import operation.
128 .It Fl r Ar repository-path
129 Use the repository at the specified path.
130 If not specified, assume the repository is located at or above the current
131 working directory.
133 .Tg cl
134 .It Xo
135 .Cm clone
136 .Op Fl almqv
137 .Op Fl b Ar branch
138 .Op Fl J Ar jumphost
139 .Op Fl R Ar reference
140 .Ar repository-URL
141 .Op Ar directory
143 .Dl Pq alias: Cm cl
144 Clone a Git repository at the specified
145 .Ar repository-URL
146 into the specified
147 .Ar directory .
148 If no
149 .Ar directory
150 is specified, the directory name will be derived from the name of the
151 cloned repository.
152 .Cm got clone
153 will refuse to run if the
154 .Ar directory
155 already exists.
158 .Ar repository-URL
159 specifies a protocol scheme, a server hostname, an optional port number
160 separated from the hostname by a colon, and a path to the repository on
161 the server:
162 .Lk scheme://hostname:port/path/to/repository
164 The following protocol schemes are supported:
165 .Bl -tag -width git+ssh
166 .It git
167 The Git protocol as implemented by the
168 .Xr git-daemon 1
169 server.
170 Use of this protocol is discouraged since it supports neither authentication
171 nor encryption.
172 .It git+ssh
173 The Git protocol wrapped in an authenticated and encrypted
174 .Xr ssh 1
175 tunnel.
176 With this protocol the hostname may contain an embedded username for
177 .Xr ssh 1
178 to use:
179 .Mt user@hostname
180 .It ssh
181 Short alias for git+ssh.
184 Objects in the cloned repository are stored in a pack file which is downloaded
185 from the server.
186 This pack file will then be indexed to facilitate access to the objects stored
187 within.
188 If any objects in the pack file are stored in deltified form, all deltas will
189 be fully resolved in order to compute the ID of such objects.
190 This can take some time.
191 More details about the pack file format are documented in
192 .Xr git-repository 5 .
194 .Cm got clone
195 creates a remote repository entry in the
196 .Xr got.conf 5
198 .Pa config
199 files of the cloned repository to store the
200 .Ar repository-url
201 and any
202 .Ar branch
204 .Ar reference
205 arguments for future use by
206 .Cm got fetch
208 .Xr git-fetch 1 .
210 The options for
211 .Cm got clone
212 are as follows:
213 .Bl -tag -width Ds
214 .It Fl a
215 Fetch all branches from the remote repository's
216 .Dq refs/heads/
217 reference namespace and set
218 .Cm fetch_all_branches
219 in the cloned repository's
220 .Xr got.conf 5
221 file for future use by
222 .Cm got fetch .
223 If this option is not specified, a branch resolved via the remote
224 repository's HEAD reference will be fetched.
225 Cannot be used together with the
226 .Fl b
227 option.
228 .It Fl b Ar branch
229 Fetch the specified
230 .Ar branch
231 from the remote repository's
232 .Dq refs/heads/
233 reference namespace.
234 This option may be specified multiple times to build a list of branches
235 to fetch.
236 If the branch corresponding to the remote repository's HEAD reference is not
237 in this list, the cloned repository's HEAD reference will be set to the first
238 branch which was fetched.
239 If this option is not specified, a branch resolved via the remote
240 repository's HEAD reference will be fetched.
241 Cannot be used together with the
242 .Fl a
243 option.
244 .It Fl J Ar jumphost
245 Specify a
246 .Ar jumphost
247 to use with SSH connections.
248 The same option will be passed to
249 .Xr ssh 1 .
250 .It Fl l
251 List branches and tags available for fetching from the remote repository
252 and exit immediately.
253 Cannot be used together with any of the other options except
254 .Fl q
256 .Fl v .
257 .It Fl m
258 Create the cloned repository as a mirror of the original repository.
259 This is useful if the cloned repository will not be used to store
260 locally created commits.
262 The repository's
263 .Xr got.conf 5
265 .Pa config
266 files will be set up with the
267 .Dq mirror
268 option enabled, such that
269 .Cm got fetch
271 .Xr git-fetch 1
272 will write incoming changes directly to branches in the
273 .Dq refs/heads/
274 reference namespace, rather than to branches in the
275 .Dq refs/remotes/
276 namespace.
277 This avoids the usual requirement of having to run
278 .Cm got rebase
280 .Cm got merge
281 after
282 .Cm got fetch
283 in order to make incoming changes appear on branches in the
284 .Dq refs/heads/
285 namespace.
286 But maintaining custom changes in the cloned repository becomes difficult
287 since such changes will be at risk of being discarded whenever incoming
288 changes are fetched.
289 .It Fl q
290 Suppress progress reporting output.
291 The same option will be passed to
292 .Xr ssh 1
293 if applicable.
294 .It Fl R Ar reference
295 In addition to the branches and tags that will be fetched, fetch an arbitrary
296 .Ar reference
297 from the remote repository's
298 .Dq refs/
299 namespace.
300 This option may be specified multiple times to build a list of additional
301 references to fetch.
302 The specified
303 .Ar reference
304 may either be a path to a specific reference, or a reference namespace
305 which will cause all references in this namespace to be fetched.
307 Each reference will be mapped into the cloned repository's
308 .Dq refs/remotes/
309 namespace, unless the
310 .Fl m
311 option is used to mirror references directly into the cloned repository's
312 .Dq refs/
313 namespace.
315 .Cm got clone
316 will refuse to fetch references from the remote repository's
317 .Dq refs/remotes/
319 .Dq refs/got/
320 namespace.
321 .It Fl v
322 Verbose mode.
323 Causes
324 .Cm got clone
325 to print debugging messages to standard error output.
326 This option will be passed to
327 .Xr ssh 1
328 if applicable.
329 Multiple -v options increase the verbosity.
330 The maximum is 3.
332 .Tg co
333 .It Xo
334 .Cm checkout
335 .Op Fl Eq
336 .Op Fl b Ar branch
337 .Op Fl c Ar commit
338 .Op Fl p Ar path-prefix
339 .Ar repository-path
340 .Op Ar work-tree-path
342 .Dl Pq alias: Cm co
343 Copy files from a repository into a new work tree.
344 Show the status of each affected file, using the following status codes:
345 .Bl -column YXZ description
346 .It A Ta new file was added
347 .It E Ta file already exists in work tree's meta-data
350 If the
351 .Ar work tree path
352 is not specified, either use the last component of
353 .Ar repository path ,
354 or if a
355 .Ar path prefix
356 was specified use the last component of
357 .Ar path prefix .
359 The options for
360 .Cm got checkout
361 are as follows:
362 .Bl -tag -width Ds
363 .It Fl b Ar branch
364 Check out files from a commit on the specified
365 .Ar branch .
366 If this option is not specified, a branch resolved via the repository's HEAD
367 reference will be used.
368 .It Fl c Ar commit
369 Check out files from the specified
370 .Ar commit
371 on the selected branch.
372 The expected argument is a commit ID or an existing reference
373 or tag name which will be resolved to a commit ID.
374 An abbreviated hash argument will be expanded to a commit ID
375 automatically, provided the abbreviation is unique.
376 If this option is not specified, the most recent commit on the selected
377 branch will be used.
379 If the specified
380 .Ar commit
381 is not contained in the selected branch, a different branch which contains
382 this commit must be specified with the
383 .Fl b
384 option.
385 If no such branch is known, a new branch must be created for this
386 commit with
387 .Cm got branch
388 before
389 .Cm got checkout
390 can be used.
391 Checking out work trees with an unknown branch is intentionally not supported.
392 .It Fl E
393 Proceed with the checkout operation even if the directory at
394 .Ar work-tree-path
395 is not empty.
396 Existing files will be left intact.
397 .It Fl p Ar path-prefix
398 Restrict the work tree to a subset of the repository's tree hierarchy.
399 Only files beneath the specified
400 .Ar path-prefix
401 will be checked out.
402 .It Fl q
403 Silence progress output.
405 .Tg up
406 .It Xo
407 .Cm update
408 .Op Fl q
409 .Op Fl b Ar branch
410 .Op Fl c Ar commit
411 .Op Fl J Ar jumphost
412 .Op Ar path ...
414 .Dl Pq alias: Cm up
415 Update an existing work tree to a different
416 .Ar commit .
417 Change existing files in the work tree as necessary to match file contents
418 of this commit.
419 Preserve any local changes in the work tree and merge them with the
420 incoming changes.
422 Files which already contain merge conflicts will not be updated to avoid
423 further complications.
424 Such files will be updated when
425 .Cm got update
426 is run again after merge conflicts have been resolved.
427 If the conflicting changes are no longer needed, affected files can be
428 reverted with
429 .Cm got revert
430 before running
431 .Cm got update
432 again.
434 Show the status of each affected file, using the following status codes:
435 .Bl -column YXZ description
436 .It U Ta file was updated and contained no local changes
437 .It G Ta file was updated and local changes were merged cleanly
438 .It C Ta file was updated and conflicts occurred during merge
439 .It D Ta file was deleted
440 .It d Ta file's deletion was prevented by local modifications
441 .It A Ta new file was added
442 .It \(a~ Ta versioned file is obstructed by a non-regular file
443 .It ! Ta a missing versioned file was restored
444 .It # Ta file was not updated because it contains merge conflicts
445 .It ? Ta changes destined for an unversioned file were not merged
448 If no
449 .Ar path
450 is specified, update the entire work tree.
451 Otherwise, restrict the update operation to files at or within the
452 specified paths.
453 Each path is required to exist in the update operation's target commit.
454 Files in the work tree outside specified paths will remain unchanged and
455 will retain their previously recorded base commit.
456 Some
458 commands may refuse to run while the work tree contains files from
459 multiple base commits.
460 The base commit of such a work tree can be made consistent by running
461 .Cm got update
462 across the entire work tree.
463 Specifying a
464 .Ar path
465 is incompatible with the
466 .Fl b
467 option.
469 .Cm got update
470 cannot update paths with staged changes.
471 If changes have been staged with
472 .Cm got stage ,
473 these changes must first be committed with
474 .Cm got commit
475 or unstaged with
476 .Cm got unstage .
478 The options for
479 .Cm got update
480 are as follows:
481 .Bl -tag -width Ds
482 .It Fl b Ar branch
483 Switch the work tree's branch reference to the specified
484 .Ar branch
485 before updating the work tree.
486 This option requires that all paths in the work tree are updated.
488 As usual, any local changes in the work tree will be preserved.
489 This can be useful when switching to a newly created branch in order
490 to commit existing local changes to this branch.
492 Any local changes must be dealt with separately in order to obtain a
493 work tree with pristine file contents corresponding exactly to the specified
494 .Ar branch .
495 Such changes could first be committed to a different branch with
496 .Cm got commit ,
497 or could be discarded with
498 .Cm got revert .
499 .It Fl c Ar commit
500 Update the work tree to the specified
501 .Ar commit .
502 The expected argument is a commit ID or an existing reference
503 or tag name which will be resolved to a commit ID.
504 An abbreviated hash argument will be expanded to a commit ID
505 automatically, provided the abbreviation is unique.
506 If this option is not specified, the most recent commit on the work tree's
507 branch will be used.
508 .It Fl J Ar jumphost
509 Specify a
510 .Ar jumphost
511 to use with SSH connections.
512 The same option will be passed to
513 .Xr ssh 1 .
514 .It Fl q
515 Silence progress output.
517 .Tg st
518 .It Xo
519 .Cm status
520 .Op Fl I
521 .Op Fl S Ar status-codes
522 .Op Fl s Ar status-codes
523 .Op Ar path ...
525 .Dl Pq alias: Cm st
526 Show the current modification status of files in a work tree,
527 using the following status codes:
528 .Bl -column YXZ description
529 .It M Ta modified file
530 .It A Ta file scheduled for addition in next commit
531 .It D Ta file scheduled for deletion in next commit
532 .It C Ta modified or added file which contains merge conflicts
533 .It ! Ta versioned file was expected on disk but is missing
534 .It \(a~ Ta versioned file is obstructed by a non-regular file
535 .It ? Ta unversioned item not tracked by
537 .It m Ta modified file modes (executable bit only)
538 .It N Ta non-existent
539 .Ar path
540 specified on the command line
543 If no
544 .Ar path
545 is specified, show modifications in the entire work tree.
546 Otherwise, show modifications at or within the specified paths.
548 If changes have been staged with
549 .Cm got stage ,
550 staged changes are shown in the second output column, using the following
551 status codes:
552 .Bl -column YXZ description
553 .It M Ta file modification is staged
554 .It A Ta file addition is staged
555 .It D Ta file deletion is staged
558 Changes created on top of staged changes are indicated in the first column:
559 .Bl -column YXZ description
560 .It MM Ta file was modified after earlier changes have been staged
561 .It MA Ta file was modified after having been staged for addition
564 The options for
565 .Cm got status
566 are as follows:
567 .Bl -tag -width Ds
568 .It Fl I
569 Show unversioned files even if they match an ignore pattern.
570 .It Fl S Ar status-codes
571 Suppress the output of files with a modification status matching any of the
572 single-character status codes contained in the
573 .Ar status-codes
574 argument.
575 Any combination of codes from the above list of possible status codes
576 may be specified.
577 For staged files, status codes displayed in either column will be matched.
578 Cannot be used together with the
579 .Fl s
580 option.
581 .It Fl s Ar status-codes
582 Only show files with a modification status matching any of the
583 single-character status codes contained in the
584 .Ar status-codes
585 argument.
586 Any combination of codes from the above list of possible status codes
587 may be specified.
588 For staged files, status codes displayed in either column will be matched.
589 Cannot be used together with the
590 .Fl S
591 option.
594 For compatibility with
595 .Xr cvs 1
597 .Xr git 1 ,
598 .Cm got status
599 reads
600 .Xr glob 7
601 patterns from
602 .Pa .cvsignore
604 .Pa .gitignore
605 files in each traversed directory and will not display unversioned files
606 which match these patterns.
607 Ignore patterns which end with a slash,
608 .Dq / ,
609 will only match directories.
610 As an extension to
611 .Xr glob 7
612 matching rules,
613 .Cm got status
614 supports consecutive asterisks,
615 .Dq ** ,
616 which will match an arbitrary amount of directories.
617 Unlike
618 .Xr cvs 1 ,
619 .Cm got status
620 only supports a single ignore pattern per line.
621 Unlike
622 .Xr git 1 ,
623 .Cm got status
624 does not support negated ignore patterns prefixed with
625 .Dq \&! ,
626 and gives no special significance to the location of path component separators,
627 .Dq / ,
628 in a pattern.
629 .It Xo
630 .Cm log
631 .Op Fl bdPpRs
632 .Op Fl C Ar number
633 .Op Fl c Ar commit
634 .Op Fl l Ar N
635 .Op Fl r Ar repository-path
636 .Op Fl S Ar search-pattern
637 .Op Fl x Ar commit
638 .Op Ar path
640 Display history of a repository.
641 If a
642 .Ar path
643 is specified, show only commits which modified this path.
644 If invoked in a work tree, the
645 .Ar path
646 is interpreted relative to the current working directory,
647 and the work tree's path prefix is implicitly prepended.
648 Otherwise, the path is interpreted relative to the repository root.
650 The options for
651 .Cm got log
652 are as follows:
653 .Bl -tag -width Ds
654 .It Fl b
655 Display individual commits which were merged into the current branch
656 from other branches.
657 By default,
658 .Cm got log
659 shows the linear history of the current branch only.
660 .It Fl C Ar number
661 Set the number of context lines shown in diffs with
662 .Fl p .
663 By default, 3 lines of context are shown.
664 .It Fl c Ar commit
665 Start traversing history at the specified
666 .Ar commit .
667 The expected argument is a commit ID or an existing reference
668 or tag name which will be resolved to a commit ID.
669 An abbreviated hash argument will be expanded to a commit ID
670 automatically, provided the abbreviation is unique.
671 If this option is not specified, default to the work tree's current branch
672 if invoked in a work tree, or to the repository's HEAD reference.
673 .It Fl d
674 Display diffstat of changes introduced in each commit.
675 Cannot be used with the
676 .Fl s
677 option.
678 .It Fl l Ar N
679 Limit history traversal to a given number of commits.
680 If this option is not specified, a default limit value of zero is used,
681 which is treated as an unbounded limit.
683 .Ev GOT_LOG_DEFAULT_LIMIT
684 environment variable may be set to change this default value.
685 .It Fl P
686 Display the list of file paths changed in each commit, using the following
687 status codes:
688 .Bl -column YXZ description
689 .It M Ta modified file
690 .It D Ta file was deleted
691 .It A Ta new file was added
692 .It m Ta modified file modes (executable bit only)
695 Cannot be used with the
696 .Fl s
697 option.
698 .It Fl p
699 Display the patch of modifications made in each commit.
700 If a
701 .Ar path
702 is specified, only show the patch of modifications at or within this path.
703 Cannot be used with the
704 .Fl s
705 option.
706 .It Fl R
707 Determine a set of commits to display as usual, but display these commits
708 in reverse order.
709 .It Fl r Ar repository-path
710 Use the repository at the specified path.
711 If not specified, assume the repository is located at or above the current
712 working directory.
713 If this directory is a
715 work tree, use the repository path associated with this work tree.
716 .It Fl S Ar search-pattern
717 If specified, show only commits with a log message, author name,
718 committer name, or commit ID matched by the extended regular
719 expression
720 .Ar search-pattern .
721 Lines in committed patches will be matched if
722 .Fl p
723 is specified.
724 File paths changed by a commit will be matched if
725 .Fl P
726 is specified.
727 Regular expression syntax is documented in
728 .Xr re_format 7 .
729 .It Fl s
730 Display a short one-line summary of each commit, instead of the default
731 history format.
732 Cannot be used together with the
733 .Fl p
735 .Fl P
736 option.
737 .It Fl x Ar commit
738 Stop traversing commit history immediately after the specified
739 .Ar commit
740 has been traversed.
741 This option has no effect if the specified
742 .Ar commit
743 is never traversed.
745 .Tg di
746 .It Xo
747 .Cm diff
748 .Op Fl adPsw
749 .Op Fl C Ar number
750 .Op Fl c Ar commit
751 .Op Fl r Ar repository-path
752 .Op Ar object1 Ar object2 | Ar path ...
754 .Dl Pq alias: Cm di
755 When invoked within a work tree without any arguments, display all
756 local changes in the work tree.
757 If one or more
758 .Ar path
759 arguments are specified, only show changes within the specified paths.
761 If two arguments are provided, treat each argument as a reference, a tag
762 name, or an object ID, and display differences between the
763 corresponding objects.
764 Both objects must be of the same type (blobs, trees, or commits).
765 An abbreviated hash argument will be expanded to a full commit ID
766 automatically, provided the abbreviation is unique.
767 If none of these interpretations produce a valid result or if the
768 .Fl P
769 option is used,
770 and if
771 .Cm got diff
772 is running in a work tree, attempt to interpret the two arguments as paths.
774 The options for
775 .Cm got diff
776 are as follows:
777 .Bl -tag -width Ds
778 .It Fl a
779 Treat file contents as ASCII text even if binary data is detected.
780 .It Fl C Ar number
781 Set the number of context lines shown in the diff.
782 By default, 3 lines of context are shown.
783 .It Fl c Ar commit
784 Show differences between commits in the repository.
785 This option may be used up to two times.
786 When used only once, show differences between the specified
787 .Ar commit
788 and its first parent commit.
789 When used twice, show differences between the two specified commits.
791 The expected argument is a commit ID or an existing reference
792 or tag name which will be resolved to a commit ID.
793 An abbreviated hash argument will be expanded to a commit ID
794 automatically, provided the abbreviation is unique.
796 If the
797 .Fl c
798 option is used, all non-option arguments will be interpreted as paths.
799 If one or more such
800 .Ar path
801 arguments are provided, only show differences for the specified paths.
803 Cannot be used together with the
804 .Fl P
805 option.
806 .It Fl d
807 Display diffstat of changes before the actual diff by annotating each file path
808 or blob hash being diffed with the total number of lines added and removed.
809 A summary line will display the total number of changes across all files.
810 .It Fl P
811 Interpret all arguments as paths only.
812 This option can be used to resolve ambiguity in cases where paths
813 look like tag names, reference names, or object IDs.
814 This option is only valid when
815 .Cm got diff
816 is invoked in a work tree.
817 .It Fl r Ar repository-path
818 Use the repository at the specified path.
819 If not specified, assume the repository is located at or above the current
820 working directory.
821 If this directory is a
823 work tree, use the repository path associated with this work tree.
824 .It Fl s
825 Show changes staged with
826 .Cm got stage
827 instead of showing local changes in the work tree.
828 This option is only valid when
829 .Cm got diff
830 is invoked in a work tree.
831 .It Fl w
832 Ignore whitespace-only changes.
834 .Tg bl
835 .It Xo
836 .Cm blame
837 .Op Fl c Ar commit
838 .Op Fl r Ar repository-path
839 .Ar path
841 .Dl Pq alias: Cm bl
842 Display line-by-line history of a file at the specified path.
844 The options for
845 .Cm got blame
846 are as follows:
847 .Bl -tag -width Ds
848 .It Fl c Ar commit
849 Start traversing history at the specified
850 .Ar commit .
851 The expected argument is a commit ID or an existing reference
852 or tag name which will be resolved to a commit ID.
853 An abbreviated hash argument will be expanded to a commit ID
854 automatically, provided the abbreviation is unique.
855 .It Fl r Ar repository-path
856 Use the repository at the specified path.
857 If not specified, assume the repository is located at or above the current
858 working directory.
859 If this directory is a
861 work tree, use the repository path associated with this work tree.
863 .Tg tr
864 .It Xo
865 .Cm tree
866 .Op Fl iR
867 .Op Fl c Ar commit
868 .Op Fl r Ar repository-path
869 .Op Ar path
871 .Dl Pq alias: Cm tr
872 Display a listing of files and directories at the specified
873 directory path in the repository.
874 Entries shown in this listing may carry one of the following trailing
875 annotations:
876 .Bl -column YXZ description
877 .It @ Ta entry is a symbolic link
878 .It / Ta entry is a directory
879 .It * Ta entry is an executable file
880 .It $ Ta entry is a Git submodule
883 Symbolic link entries are also annotated with the target path of the link.
885 If no
886 .Ar path
887 is specified, list the repository path corresponding to the current
888 directory of the work tree, or the root directory of the repository
889 if there is no work tree.
891 The options for
892 .Cm got tree
893 are as follows:
894 .Bl -tag -width Ds
895 .It Fl c Ar commit
896 List files and directories as they appear in the specified
897 .Ar commit .
898 The expected argument is a commit ID or an existing reference
899 or tag name which will be resolved to a commit ID.
900 An abbreviated hash argument will be expanded to a commit ID
901 automatically, provided the abbreviation is unique.
902 .It Fl i
903 Show object IDs of files (blob objects) and directories (tree objects).
904 .It Fl R
905 Recurse into sub-directories in the repository.
906 .It Fl r Ar repository-path
907 Use the repository at the specified path.
908 If not specified, assume the repository is located at or above the current
909 working directory.
910 If this directory is a
912 work tree, use the repository path associated with this work tree.
914 .It Xo
915 .Cm tag
916 .Op Fl lVv
917 .Op Fl c Ar commit
918 .Op Fl m Ar message
919 .Op Fl r Ar repository-path
920 .Op Fl s Ar signer-id
921 .Ar name
923 Manage tags in a repository.
925 Tags are managed via references which live in the
926 .Dq refs/tags/
927 reference namespace.
929 .Cm got tag
930 command operates on references in this namespace only.
931 References in this namespace point at tag objects which contain a pointer
932 to another object, a tag message, as well as author and timestamp information.
934 Attempt to create a tag with the given
935 .Ar name ,
936 and make this tag point at the given
937 .Ar commit .
938 If no commit is specified, default to the latest commit on the work tree's
939 current branch if invoked in a work tree, and to a commit resolved via
940 the repository's HEAD reference otherwise.
942 The options for
943 .Cm got tag
944 are as follows:
945 .Bl -tag -width Ds
946 .It Fl c Ar commit
947 Make the newly created tag reference point at the specified
948 .Ar commit .
949 The expected
950 .Ar commit
951 argument is a commit ID or an existing reference or tag name which
952 will be resolved to a commit ID.
953 An abbreviated hash argument will be expanded to a commit ID
954 automatically, provided the abbreviation is unique.
955 .It Fl l
956 List all existing tags in the repository instead of creating a new tag.
957 If a
958 .Ar name
959 argument is passed, show only the tag with the given
960 .Ar name .
961 .It Fl m Ar message
962 Use the specified tag message when creating the new tag.
963 Without the
964 .Fl m
965 option,
966 .Cm got tag
967 opens a temporary file in an editor where a tag message can be written.
968 Quitting the editor without saving the file will abort the tag operation.
969 .It Fl r Ar repository-path
970 Use the repository at the specified path.
971 If not specified, assume the repository is located at or above the current
972 working directory.
973 If this directory is a
975 work tree, use the repository path associated with this work tree.
976 .It Fl s Ar signer-id
977 While creating a new tag, sign this tag with the identity given in
978 .Ar signer-id .
980 For SSH-based signatures,
981 .Ar signer-id
982 is the path to a file which may refer to either a private SSH key,
983 or a public SSH key with the private half available via
984 .Xr ssh-agent 1 .
985 .Cm got tag
986 will sign the tag object by invoking
987 .Xr ssh-keygen 1
988 with the
989 .Fl Y Cm sign
990 command, using the signature namespace
991 .Dq git
992 for compatibility with
993 .Xr git 1 .
994 .It Fl V
995 Verify tag object signatures.
996 If a
997 .Ar name
998 is specified, show and verify the tag object with the provided name.
999 Otherwise, list all tag objects and verify signatures where present.
1001 .Cm got tag
1002 verifies SSH-based signatures by invoking
1003 .Xr ssh-keygen 1
1004 with the options
1005 .Fl Y Cm verify Fl f Ar allowed_signers .
1006 A path to the
1007 .Ar allowed_signers
1008 file must be set in
1009 .Xr got.conf 5 ,
1010 otherwise verification is impossible.
1011 .It Fl v
1012 Verbose mode.
1013 During SSH signature creation and verification this option will be passed to
1014 .Xr ssh-keygen 1 .
1015 Multiple -v options increase the verbosity.
1016 The maximum is 3.
1019 By design, the
1020 .Cm got tag
1021 command will not delete tags or change existing tags.
1022 If a tag must be deleted, the
1023 .Cm got ref
1024 command may be used to delete a tag's reference.
1025 This should only be done if the tag has not already been copied to
1026 another repository.
1027 .It Xo
1028 .Cm add
1029 .Op Fl IR
1030 .Ar path ...
1032 Schedule unversioned files in a work tree for addition to the
1033 repository in the next commit.
1034 By default, files which match a
1035 .Cm got status
1036 ignore pattern will not be added.
1038 If a
1039 .Ar path
1040 mentioned in the command line is not an unversioned file then
1041 .Cm got add
1042 may raise an error.
1043 To avoid unnecessary errors from paths picked up by file globbing patterns
1044 in the shell, paths in the argument list will be silently ignored if they
1045 are not reported by
1046 .Cm got status
1047 at all, or if they are reported with one of the following status codes
1048 and do not have changes staged via
1049 .Cm got stage :
1050 .Bl -column YXZ description
1051 .It M Ta modified file
1052 .It A Ta file scheduled for addition in next commit
1053 .It C Ta modified or added file which contains merge conflicts
1054 .It m Ta modified file modes (executable bit only)
1057 The options for
1058 .Cm got add
1059 are as follows:
1060 .Bl -tag -width Ds
1061 .It Fl I
1062 Add files even if they match a
1063 .Cm got status
1064 ignore pattern.
1065 .It Fl R
1066 Permit recursion into directories.
1067 If this option is not specified,
1068 .Cm got add
1069 will refuse to run if a specified
1070 .Ar path
1071 is a directory.
1073 .Tg rm
1074 .It Xo
1075 .Cm remove
1076 .Op Fl fkR
1077 .Op Fl s Ar status-codes
1078 .Ar path ...
1080 .Dl Pq alias: Cm rm
1081 Remove versioned files from a work tree and schedule them for deletion
1082 from the repository in the next commit.
1084 The options for
1085 .Cm got remove
1086 are as follows:
1087 .Bl -tag -width Ds
1088 .It Fl f
1089 Perform the operation even if a file contains local modifications,
1090 and do not raise an error if a specified
1091 .Ar path
1092 does not exist on disk.
1093 .It Fl k
1094 Keep affected files on disk.
1095 .It Fl R
1096 Permit recursion into directories.
1097 If this option is not specified,
1098 .Cm got remove
1099 will refuse to run if a specified
1100 .Ar path
1101 is a directory.
1102 .It Fl s Ar status-codes
1103 Only delete files with a modification status matching one of the
1104 single-character status codes contained in the
1105 .Ar status-codes
1106 argument.
1107 The following status codes may be specified:
1108 .Bl -column YXZ description
1109 .It M Ta modified file (this implies the
1110 .Fl f
1111 option)
1112 .It ! Ta versioned file expected on disk but missing
1115 .Tg pa
1116 .It Xo
1117 .Cm patch
1118 .Op Fl nR
1119 .Op Fl c Ar commit
1120 .Op Fl p Ar strip-count
1121 .Op Ar patchfile
1123 .Dl Pq alias: Cm pa
1124 Apply changes from
1125 .Ar patchfile
1126 to files in a work tree.
1127 Files added or removed by a patch will be scheduled for addition or removal in
1128 the work tree.
1130 The patch must be in the unified diff format as produced by
1131 .Cm got diff ,
1132 .Xr git-diff 1 ,
1133 or by
1134 .Xr diff 1
1136 .Xr cvs 1
1137 diff when invoked with their
1138 .Fl u
1139 options.
1140 If no
1141 .Ar patchfile
1142 argument is provided, read unified diff data from standard input instead.
1144 If the
1145 .Ar patchfile
1146 contains multiple patches, then attempt to apply each of them in sequence.
1148 Show the status of each affected file, using the following status codes:
1149 .Bl -column XYZ description
1150 .It M Ta file was modified
1151 .It G Ta file was merged using a merge-base found in the repository
1152 .It C Ta file was merged and conflicts occurred during merge
1153 .It D Ta file was deleted
1154 .It A Ta file was added
1155 .It # Ta failed to patch the file
1158 If a change does not match at its exact line number, attempt to
1159 apply it somewhere else in the file if a good spot can be found.
1160 Otherwise, the patch will fail to apply.
1163 .Cm patch
1164 will refuse to apply a patch if certain preconditions are not met.
1165 Files to be deleted must already be under version control, and must
1166 not have been scheduled for deletion already.
1167 Files to be added must not yet be under version control and must not
1168 already be present on disk.
1169 Files to be modified must already be under version control and may not
1170 contain conflict markers.
1172 If an error occurs, the
1173 .Cm patch
1174 operation will be aborted.
1175 Any changes made to the work tree up to this point will be left behind.
1176 Such changes can be viewed with
1177 .Cm got diff
1178 and can be reverted with
1179 .Cm got revert
1180 if needed.
1182 The options for
1183 .Cm got patch
1184 are as follows:
1185 .Bl -tag -width Ds
1186 .It Fl c Ar commit
1187 Attempt to locate files within the specified
1188 .Ar commit
1189 for use as a merge-base for 3-way merges.
1190 Ideally, the specified
1191 .Ar commit
1192 should contain versions of files which the changes contained in the
1193 .Ar patchfile
1194 were based on.
1195 Files will be located by path, relative to the repository root.
1196 If the
1197 .Fl p
1198 option is used then leading path components will be stripped
1199 before paths are looked up in the repository.
1201 If the
1202 .Fl c
1203 option is not used then
1204 .Cm got patch
1205 will attempt to locate merge-bases via object IDs found in
1206 .Ar patchfile
1207 meta-data, such as produced by
1208 .Cm got diff
1210 .Xr git-diff 1 .
1211 Use of the
1212 .Fl c
1213 option is only recommended in the absence of such meta-data.
1215 In case no merge-base is available for a file, changes will be applied
1216 without doing a 3-way merge.
1217 Changes which do not apply cleanly may then be rejected entirely, rather
1218 than producing merge conflicts in the patched target file.
1219 .It Fl n
1220 Do not make any modifications to the work tree.
1221 This can be used to check whether a patch would apply without issues.
1222 If the
1223 .Ar patchfile
1224 contains diffs that affect the same file multiple times, the results
1225 displayed may be incorrect.
1226 .It Fl p Ar strip-count
1227 Specify the number of leading path components to strip from paths
1228 parsed from
1229 .Ar patchfile .
1230 If the
1231 .Fl p
1232 option is not used,
1233 .Sq a/
1235 .Sq b/
1236 path prefixes generated by
1237 .Xr git-diff 1
1238 will be recognized and stripped automatically.
1239 .It Fl R
1240 Reverse the patch before applying it.
1242 .Tg rv
1243 .It Xo
1244 .Cm revert
1245 .Op Fl pR
1246 .Op Fl F Ar response-script
1247 .Ar path ...
1249 .Dl Pq alias: Cm rv
1250 Revert any local changes in files at the specified paths in a work tree.
1251 File contents will be overwritten with those contained in the
1252 work tree's base commit.
1253 There is no way to bring discarded changes back after
1254 .Cm got revert !
1256 If a file was added with
1257 .Cm got add ,
1258 it will become an unversioned file again.
1259 If a file was deleted with
1260 .Cm got remove ,
1261 it will be restored.
1263 The options for
1264 .Cm got revert
1265 are as follows:
1266 .Bl -tag -width Ds
1267 .It Fl F Ar response-script
1268 With the
1269 .Fl p
1270 option, read
1271 .Dq y ,
1272 .Dq n ,
1274 .Dq q
1275 responses line-by-line from the specified
1276 .Ar response-script
1277 file instead of prompting interactively.
1278 .It Fl p
1279 Instead of reverting all changes in files, interactively select or reject
1280 changes to revert based on
1281 .Dq y
1282 (revert change),
1283 .Dq n
1284 (keep change), and
1285 .Dq q
1286 (quit reverting this file) responses.
1287 If a file is in modified status, individual patches derived from the
1288 modified file content can be reverted.
1289 Files in added or deleted status may only be reverted in their entirety.
1290 .It Fl R
1291 Permit recursion into directories.
1292 If this option is not specified,
1293 .Cm got revert
1294 will refuse to run if a specified
1295 .Ar path
1296 is a directory.
1298 .Tg ci
1299 .It Xo
1300 .Cm commit
1301 .Op Fl CNnS
1302 .Op Fl A Ar author
1303 .Op Fl F Ar path
1304 .Op Fl J Ar jumphost
1305 .Op Fl m Ar message
1306 .Op Ar path ...
1308 .Dl Pq alias: Cm ci
1309 Create a new commit in the repository from changes in a work tree
1310 and use this commit as the new base commit for the work tree.
1311 If no
1312 .Ar path
1313 is specified, commit all changes in the work tree.
1314 Otherwise, commit changes at or within the specified paths.
1316 If changes have been explicitly staged for commit with
1317 .Cm got stage ,
1318 only commit staged changes and reject any specified paths which
1319 have not been staged.
1321 .Cm got commit
1322 opens a temporary file in an editor where a log message can be written
1323 unless the
1324 .Fl m
1325 option is used
1326 or the
1327 .Fl F
1329 .Fl N
1330 options are used together.
1331 Quitting the editor without saving the file will abort the commit operation.
1333 Show the status of each affected file, using the following status codes:
1334 .Bl -column YXZ description
1335 .It M Ta modified file
1336 .It D Ta file was deleted
1337 .It A Ta new file was added
1338 .It m Ta modified file modes (executable bit only)
1341 Files which are not part of the new commit will retain their previously
1342 recorded base commit.
1343 Some
1345 commands may refuse to run while the work tree contains files from
1346 multiple base commits.
1347 The base commit of such a work tree can be made consistent by running
1348 .Cm got update
1349 across the entire work tree.
1352 .Cm got commit
1353 command requires the
1354 .Ev GOT_AUTHOR
1355 environment variable to be set,
1356 unless an author has been configured in
1357 .Xr got.conf 5
1358 or Git's
1359 .Dv user.name
1361 .Dv user.email
1362 configuration settings can be
1363 obtained from the repository's
1364 .Pa .git/config
1365 file or from Git's global
1366 .Pa ~/.gitconfig
1367 configuration file.
1369 The options for
1370 .Cm got commit
1371 are as follows:
1372 .Bl -tag -width Ds
1373 .It Fl A Ar author
1374 Set author information in the newly created commit to
1375 .Ar author .
1376 This is useful when committing changes on behalf of someone else.
1378 .Ar author
1379 argument must use the same format as the
1380 .Ev GOT_AUTHOR
1381 environment variable.
1383 In addition to storing author information, the newly created commit
1384 object will retain
1385 .Dq committer
1386 information which is obtained, as usual, from the
1387 .Ev GOT_AUTHOR
1388 environment variable, or
1389 .Xr got.conf 5 ,
1390 or Git configuration settings.
1391 .It Fl C
1392 Allow committing files in conflicted status.
1394 Committing files with conflict markers should generally be avoided.
1395 Cases where conflict markers must be stored in the repository for
1396 some legitimate reason should be very rare.
1397 There are usually ways to avoid storing conflict markers verbatim by
1398 applying appropriate programming tricks.
1399 .It Fl F Ar path
1400 Use the prepared log message stored in the file found at
1401 .Ar path
1402 when creating the new commit.
1403 .Cm got commit
1404 opens a temporary file in an editor where the prepared log message can be
1405 reviewed and edited further if needed.
1406 Cannot be used together with the
1407 .Fl m
1408 option.
1409 .It Fl m Ar message
1410 Use the specified log message when creating the new commit.
1411 Cannot be used together with the
1412 .Fl F
1413 option.
1414 .It Fl J Ar jumphost
1415 Specify a
1416 .Ar jumphost
1417 to use with SSH connections.
1418 The same option will be passed to
1419 .Xr ssh 1 .
1420 .It Fl N
1421 This option prevents
1422 .Cm got commit
1423 from opening the commit message in an editor.
1424 It has no effect unless it is used together with the
1425 .Fl F
1426 option and is intended for non-interactive use such as scripting.
1427 .It Fl n
1428 This option prevents
1429 .Cm got commit
1430 from generating a diff of the to-be-committed changes in a temporary file
1431 which can be viewed while editing a commit message.
1432 .It Fl S
1433 Allow the addition of symbolic links which point outside of the path space
1434 that is under version control.
1435 By default,
1436 .Cm got commit
1437 will reject such symbolic links due to safety concerns.
1438 As a precaution,
1440 may decide to represent such a symbolic link as a regular file which contains
1441 the link's target path, rather than creating an actual symbolic link which
1442 points outside of the work tree.
1443 Use of this option is discouraged because external mechanisms such as
1444 .Dq make obj
1445 are better suited for managing symbolic links to paths not under
1446 version control.
1449 .Cm got commit
1450 will refuse to run if certain preconditions are not met.
1451 If the work tree's current branch is not in the
1452 .Dq refs/heads/
1453 reference namespace, new commits may not be created on this branch.
1454 Local changes may only be committed if they are based on file content
1455 found in the most recent commit on the work tree's branch.
1456 If a path is found to be out of date,
1457 .Cm got update
1458 must be used first in order to merge local changes with changes made
1459 in the repository.
1460 .Tg cy
1461 .It Xo
1462 .Cm cherrypick
1463 .Op Fl lX
1464 .Op Ar commit
1466 .Dl Pq alias: Cm cy
1467 Merge changes from a single
1468 .Ar commit
1469 into the work tree.
1470 The specified
1471 .Ar commit
1472 should be on a different branch than the work tree's base commit.
1473 The expected argument is a reference or a commit ID.
1474 An abbreviated hash argument will be expanded to a commit ID
1475 automatically, provided the abbreviation is unique.
1477 Show the status of each affected file, using the following status codes:
1478 .Bl -column YXZ description
1479 .It G Ta file was merged
1480 .It C Ta file was merged and conflicts occurred during merge
1481 .It ! Ta changes destined for a missing file were not merged
1482 .It D Ta file was deleted
1483 .It d Ta file's deletion was prevented by local modifications
1484 .It A Ta new file was added
1485 .It \(a~ Ta changes destined for a non-regular file were not merged
1486 .It ? Ta changes destined for an unversioned file were not merged
1489 The merged changes will appear as local changes in the work tree, which
1490 may be viewed with
1491 .Cm got diff ,
1492 amended manually or with further
1493 .Cm got cherrypick
1494 commands,
1495 committed with
1496 .Cm got commit .
1498 If invoked in a work tree where no
1499 .Cm rebase ,
1500 .Cm histedit ,
1502 .Cm merge
1503 operation is taking place,
1504 .Cm got cherrypick
1505 creates a record of commits which have been merged into the work tree.
1506 When a file changed by
1507 .Cm got cherrypick
1508 is committed with
1509 .Cm got commit ,
1510 the log messages of relevant merged commits will then appear in the editor,
1511 where the messages should be further adjusted to convey the reasons for
1512 cherrypicking the changes.
1513 Upon exiting the editor, if the time stamp of the log message file
1514 is unchanged or the log message is empty,
1515 .Cm got commit
1516 will fail with an unmodified or empty log message error.
1518 If all the changes in all files touched by a given commit are discarded,
1519 e.g. with
1520 .Cm got revert ,
1521 this commit's log message record will also disappear.
1523 .Cm got cherrypick
1524 will refuse to run if certain preconditions are not met.
1525 If the work tree contains multiple base commits, it must first be updated
1526 to a single base commit with
1527 .Cm got update .
1528 If any relevant files already contain merge conflicts, these
1529 conflicts must be resolved first.
1531 The options for
1533 .Cm cherrypick
1534 are as follows:
1535 .Bl -tag -width Ds
1536 .It Fl l
1537 Display a list of commit log messages recorded by cherrypick operations,
1538 represented by references in the
1539 .Dq refs/got/worktree
1540 reference namespace.
1541 If a
1542 .Ar commit
1543 is specified, only show the log message of the specified commit.
1545 If invoked in a work tree, only log messages recorded by cherrypick operations
1546 in the current work tree will be displayed.
1547 Otherwise, all commit log messages will be displayed irrespective of the
1548 work tree in which they were created.
1549 This option cannot be used with
1550 .Fl X .
1551 .It Fl X
1552 Delete log messages created by previous cherrypick operations, represented by
1553 references in the
1554 .Dq refs/got/worktree
1555 reference namespace.
1556 If a
1557 .Ar commit
1558 is specified, only delete the log message of the specified commit.
1560 If invoked in a work tree, only log messages recorded by cherrypick operations
1561 in the current work tree will be deleted.
1562 Otherwise, all commit log messages will be deleted irrespective of the
1563 work tree in which they were created.
1564 This option cannot be used with
1565 .Fl l .
1568 .Tg bo
1569 .It Xo
1570 .Cm backout
1571 .Op Fl lX
1572 .Op Ar commit
1574 .Dl Pq alias: Cm bo
1575 Reverse-merge changes from a single
1576 .Ar commit
1577 into the work tree.
1578 The specified
1579 .Ar commit
1580 should be on the same branch as the work tree's base commit.
1581 The expected argument is a reference or a commit ID.
1582 An abbreviated hash argument will be expanded to a commit ID
1583 automatically, provided the abbreviation is unique.
1585 Show the status of each affected file, using the following status codes:
1586 .Bl -column YXZ description
1587 .It G Ta file was merged
1588 .It C Ta file was merged and conflicts occurred during merge
1589 .It ! Ta changes destined for a missing file were not merged
1590 .It D Ta file was deleted
1591 .It d Ta file's deletion was prevented by local modifications
1592 .It A Ta new file was added
1593 .It \(a~ Ta changes destined for a non-regular file were not merged
1594 .It ? Ta changes destined for an unversioned file were not merged
1597 The reverse-merged changes will appear as local changes in the work tree,
1598 which may be viewed with
1599 .Cm got diff ,
1600 amended manually or with further
1601 .Cm got backout
1602 commands,
1603 committed with
1604 .Cm got commit .
1606 If invoked in a work tree where no
1607 .Cm rebase ,
1608 .Cm histedit ,
1610 .Cm merge
1611 operation is taking place,
1612 .Cm got backout
1613 creates a record of commits which have been reverse-merged into the work tree.
1614 When a file changed by
1615 .Cm got backout
1616 is committed with
1617 .Cm got commit ,
1618 the log messages of relevant reverse-merged commits will then appear in
1619 the editor, where the messages should be further adjusted to convey the
1620 reasons for backing out the changes.
1621 Upon exiting the editor, if the time stamp of the log message file
1622 is unchanged or the log message is empty,
1623 .Cm got commit
1624 will fail with an unmodified or empty log message error.
1626 If all the changes in all files touched by a given commit are discarded,
1627 e.g. with
1628 .Cm got revert ,
1629 this commit's log message record will also disappear.
1631 .Cm got backout
1632 will refuse to run if certain preconditions are not met.
1633 If the work tree contains multiple base commits, it must first be updated
1634 to a single base commit with
1635 .Cm got update .
1636 If any relevant files already contain merge conflicts, these
1637 conflicts must be resolved first.
1639 The options for
1641 .Cm backout
1642 are as follows:
1643 .Bl -tag -width Ds
1644 .It Fl l
1645 Display a list of commit log messages recorded by backout operations,
1646 represented by references in the
1647 .Dq refs/got/worktree
1648 reference namespace.
1649 If a
1650 .Ar commit
1651 is specified, only show the log message of the specified commit.
1653 If invoked in a work tree, only log messages recorded by backout operations
1654 in the current work tree will be displayed.
1655 Otherwise, all commit log messages will be displayed irrespective of the
1656 work tree in which they were created.
1657 This option cannot be used with
1658 .Fl X .
1659 .It Fl X
1660 Delete log messages created by previous backout operations, represented by
1661 references in the
1662 .Dq refs/got/worktree
1663 reference namespace.
1664 If a
1665 .Ar commit
1666 is specified, only delete the log message of the specified commit.
1668 If invoked in a work tree, only log messages recorded by backout operations
1669 in the current work tree will be deleted.
1670 Otherwise, all commit log messages will be deleted irrespective of the
1671 work tree in which they were created.
1672 This option cannot be used with
1673 .Fl l .
1675 .It Xo
1676 .Cm cat
1677 .Op Fl P
1678 .Op Fl c Ar commit
1679 .Op Fl r Ar repository-path
1680 .Ar arg ...
1682 Parse and print contents of objects to standard output in a line-based
1683 text format.
1684 Content of commit, tree, and tag objects is printed in a way similar
1685 to the actual content stored in such objects.
1686 Blob object contents are printed as they would appear in files on disk.
1688 Attempt to interpret each argument as a reference, a tag name, or
1689 an object ID.
1690 References will be resolved to an object ID.
1691 Tag names will resolved to a tag object.
1692 An abbreviated hash argument will be expanded to a commit ID
1693 automatically, provided the abbreviation is unique.
1695 If none of the above interpretations produce a valid result, or if the
1696 .Fl P
1697 option is used, attempt to interpret the argument as a path which will
1698 be resolved to the ID of an object found at this path in the repository.
1700 The options for
1701 .Cm got cat
1702 are as follows:
1703 .Bl -tag -width Ds
1704 .It Fl c Ar commit
1705 Look up paths in the specified
1706 .Ar commit .
1707 If this option is not used, paths are looked up in the commit resolved
1708 via the repository's HEAD reference.
1709 The expected argument is a commit ID or an existing reference
1710 or tag name which will be resolved to a commit ID.
1711 An abbreviated hash argument will be expanded to a commit ID
1712 automatically, provided the abbreviation is unique.
1713 .It Fl P
1714 Interpret all arguments as paths only.
1715 This option can be used to resolve ambiguity in cases where paths
1716 look like tag names, reference names, or object IDs.
1717 .It Fl r Ar repository-path
1718 Use the repository at the specified path.
1719 If not specified, assume the repository is located at or above the current
1720 working directory.
1721 If this directory is a
1723 work tree, use the repository path associated with this work tree.
1725 .It Cm info Op Ar path ...
1726 Display meta-data stored in a work tree.
1728 .Xr got-worktree 5
1729 for details.
1731 The work tree to use is resolved implicitly by walking upwards from the
1732 current working directory.
1734 If one or more
1735 .Ar path
1736 arguments are specified, show additional per-file information for tracked
1737 files located at or within these paths.
1738 If a
1739 .Ar path
1740 argument corresponds to the work tree's root directory, display information
1741 for all tracked files.
1743 .Sh ENVIRONMENT
1744 .Bl -tag -width GOT_IGNORE_GITCONFIG
1745 .It Ev GOT_AUTHOR
1746 The author's name and email address, such as
1747 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1748 Used by the
1749 .Cm got commit ,
1750 .Cm got import ,
1751 .Cm got rebase ,
1752 .Cm got merge ,
1754 .Cm got histedit
1755 commands.
1756 Because
1757 .Xr git 1
1758 may fail to parse commits without an email address in author data,
1760 attempts to reject
1761 .Ev GOT_AUTHOR
1762 environment variables with a missing email address.
1764 .Ev GOT_AUTHOR will be overridden by configuration settings in
1765 .Xr got.conf 5
1766 or by Git's
1767 .Dv user.name
1769 .Dv user.email
1770 configuration settings in the repository's
1771 .Pa .git/config
1772 file.
1774 .Dv user.name
1776 .Dv user.email
1777 configuration settings contained in Git's global
1778 .Pa ~/.gitconfig
1779 configuration file will only be used if neither
1780 .Xr got.conf 5
1781 nor the
1782 .Ev GOT_AUTHOR
1783 environment variable provide author information.
1784 .It Ev GOT_IGNORE_GITCONFIG
1785 If this variable is set then any remote repository definitions or author
1786 information found in Git configuration files will be ignored.
1787 .It Ev GOT_LOG_DEFAULT_LIMIT
1788 The default limit on the number of commits traversed by
1789 .Cm got log .
1790 If set to zero, the limit is unbounded.
1791 This variable will be silently ignored if it is set to a non-numeric value.
1792 .It Ev VISUAL , EDITOR
1793 The editor spawned by
1794 .Cm got commit ,
1795 .Cm got histedit ,
1796 .Cm got import ,
1798 .Cm got tag .
1799 If not set, the
1800 .Xr vi 1
1801 text editor will be spawned.
1803 .Sh FILES
1804 .Bl -tag -width packed-refs -compact
1805 .It Pa got.conf
1806 Repository-wide configuration settings for
1807 .Nm .
1808 If present, a
1809 .Xr got.conf 5
1810 configuration file located in the root directory of a Git repository
1811 supersedes any relevant settings in Git's
1812 .Pa config
1813 file.
1815 .It Pa .cvg/got.conf
1816 Worktree-specific configuration settings for
1817 .Nm .
1818 If present, a
1819 .Xr got.conf 5
1820 configuration file in the
1821 .Pa .cvg
1822 meta-data directory of a work tree supersedes any relevant settings in
1823 the repository's
1824 .Xr got.conf 5
1825 configuration file and Git's
1826 .Pa config
1827 file.
1829 .Sh EXIT STATUS
1830 .Ex -std got
1831 .Sh EXAMPLES
1832 Enable tab-completion of
1834 command names in
1835 .Xr ksh 1 :
1837 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
1839 Clone an existing Git repository for use with
1840 .Nm :
1842 .Dl $ cd /var/git/
1843 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1845 Unfortunately, many of the popular Git hosting sites do not offer anonymous
1846 access via SSH.
1847 Such sites will require an account to be created, and a public SSH key to be
1848 uploaded to this account, before repository access via ssh:// URLs will work.
1850 Use of HTTP URLs currently requires
1851 .Xr git 1 :
1853 .Dl $ cd /var/git/
1854 .Dl $ git clone --bare https://github.com/openbsd/src.git
1856 Alternatively, for quick and dirty local testing of
1858 a new Git repository could be created and populated with files,
1859 e.g. from a temporary CVS checkout located at
1860 .Pa /tmp/src :
1862 .Dl $ gotadmin init /var/git/src.git
1863 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1865 Check out a work tree from the Git repository to /usr/src:
1867 .Dl $ got checkout /var/git/src.git /usr/src
1869 View local changes in a work tree directory:
1871 .Dl $ got diff | less
1873 In a work tree, display files in a potentially problematic state:
1875 .Dl $ got status -s 'C!~?'
1877 Interactively revert selected local changes in a work tree directory:
1879 .Dl $ got revert -p -R\ .
1881 In a work tree or a git repository directory, list all branch references:
1883 .Dl $ got branch -l
1885 As above, but list the most recently modified branches only:
1887 .Dl $ got branch -lt | head
1889 In a work tree or a git repository directory, create a new branch called
1890 .Dq unified-buffer-cache
1891 which is forked off the
1892 .Dq master
1893 branch:
1895 .Dl $ got branch -c master unified-buffer-cache
1897 Switch an existing work tree to the branch
1898 .Dq unified-buffer-cache .
1899 Local changes in the work tree will be preserved and merged if necessary:
1901 .Dl $ got update -b unified-buffer-cache
1903 Create a new commit from local changes in a work tree directory.
1904 This new commit will become the head commit of the work tree's current branch:
1906 .Dl $ got commit
1908 In a work tree or a git repository directory, view changes committed in
1909 the 3 most recent commits to the work tree's branch, or the branch resolved
1910 via the repository's HEAD reference, respectively:
1912 .Dl $ got log -p -l 3
1914 As above, but display changes in the order in which
1915 .Xr patch 1
1916 could apply them in sequence:
1918 .Dl $ got log -p -l 3 -R
1920 In a work tree or a git repository directory, log the history of a subdirectory:
1922 .Dl $ got log sys/uvm
1924 While operating inside a work tree, paths are specified relative to the current
1925 working directory, so this command will log the subdirectory
1926 .Pa sys/uvm :
1928 .Dl $ cd sys/uvm && got log\ .
1930 And this command has the same effect:
1932 .Dl $ cd sys/dev/usb && got log ../../uvm
1934 And this command displays work tree meta-data about all tracked files:
1936 .Dl $ cd /usr/src
1937 .Dl $ got info\ . | less
1939 Add new files and remove obsolete files in a work tree directory:
1941 .Dl $ got add sys/uvm/uvm_ubc.c
1942 .Dl $ got remove sys/uvm/uvm_vnode.c
1944 Create a new commit from local changes in a work tree directory
1945 with a pre-defined log message.
1947 .Dl $ got commit -m 'unify the buffer cache'
1949 Alternatively, create a new commit from local changes in a work tree
1950 directory with a log message that has been prepared in the file
1951 .Pa /tmp/msg :
1953 .Dl $ got commit -F /tmp/msg
1955 Update any work tree checked out from the
1956 .Dq unified-buffer-cache
1957 branch to the latest commit on this branch:
1959 .Dl $ got update
1961 Roll file content on the unified-buffer-cache branch back by one commit,
1962 and then fetch the rolled-back change into the work tree as a local change
1963 to be amended and perhaps committed again:
1965 .Dl $ got backout unified-buffer-cache
1966 .Dl $ got commit -m 'roll back previous'
1967 .Dl $ # now back out the previous backout :-)
1968 .Dl $ got backout unified-buffer-cache
1970 Fetch new changes on the remote repository's
1971 .Dq master
1972 branch, making them visible on the local repository's
1973 .Dq origin/master
1974 branch:
1976 .Dl $ cd /usr/src
1977 .Dl $ got fetch
1979 In a repository created with a HTTP URL and
1980 .Cm git clone --bare
1982 .Xr git-fetch 1
1983 command must be used instead:
1985 .Dl $ cd /var/git/src.git
1986 .Dl $ git fetch origin master:refs/remotes/origin/master
1988 Rebase the local
1989 .Dq master
1990 branch to merge the new changes that are now visible on the
1991 .Dq origin/master
1992 branch:
1994 .Dl $ cd /usr/src
1995 .Dl $ got update -b origin/master
1996 .Dl $ got rebase master
1998 Rebase the
1999 .Dq unified-buffer-cache
2000 branch on top of the new head commit of the
2001 .Dq master
2002 branch.
2004 .Dl $ got update -b master
2005 .Dl $ got rebase unified-buffer-cache
2007 Create a patch from all changes on the unified-buffer-cache branch.
2008 The patch can be mailed out for review and applied to
2009 .Ox Ns 's
2010 CVS tree:
2012 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
2014 Edit the entire commit history of the
2015 .Dq unified-buffer-cache
2016 branch:
2018 .Dl $ got update -b unified-buffer-cache
2019 .Dl $ got update -c master
2020 .Dl $ got histedit
2022 Before working against existing branches in a repository cloned with
2023 .Cm git clone --bare
2024 instead of
2025 .Cm got clone ,
2026 a Git
2027 .Dq refspec
2028 must be configured to map all references in the remote repository
2029 into the
2030 .Dq refs/remotes
2031 namespace of the local repository.
2032 This can be achieved by setting Git's
2033 .Pa remote.origin.fetch
2034 configuration variable to the value
2035 .Dq +refs/heads/*:refs/remotes/origin/*
2036 with the
2037 .Cm git config
2038 command:
2040 .Dl $ cd /var/git/repo
2041 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
2043 Additionally, the
2044 .Dq mirror
2045 option must be disabled:
2047 .Dl $ cd /var/git/repo
2048 .Dl $ git config remote.origin.mirror false
2050 Alternatively, the following
2051 .Xr git-fetch 1
2052 configuration item can be added manually to the Git repository's
2053 .Pa config
2054 file:
2056 .Dl [remote \&"origin\&"]
2057 .Dl url = ...
2058 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
2059 .Dl mirror = false
2061 This configuration leaves the local repository's
2062 .Dq refs/heads
2063 namespace free for use by local branches checked out with
2064 .Cm got checkout
2065 and, if needed, created with
2066 .Cm got branch .
2067 Branches in the
2068 .Dq refs/remotes/origin
2069 namespace can now be updated with incoming changes from the remote
2070 repository with
2071 .Cm got fetch
2073 .Xr git-fetch 1
2074 without extra command line arguments.
2075 Newly fetched changes can be examined with
2076 .Cm got log .
2078 Display changes on the remote repository's version of the
2079 .Dq master
2080 branch, as of the last time
2081 .Cm got fetch
2082 was run:
2084 .Dl $ got log -c origin/master | less
2086 As shown here, most commands accept abbreviated reference names such as
2087 .Dq origin/master
2088 instead of
2089 .Dq refs/remotes/origin/master .
2090 The latter is only needed in case of ambiguity.
2092 .Cm got rebase
2093 can be used to merge changes which are visible on the
2094 .Dq origin/master
2095 branch into the
2096 .Dq master
2097 branch.
2098 This will also merge local changes, if any, with the incoming changes:
2100 .Dl $ got update -b origin/master
2101 .Dl $ got rebase master
2103 In order to make changes committed to the
2104 .Dq unified-buffer-cache
2105 visible on the
2106 .Dq master
2107 branch, the
2108 .Dq unified-buffer-cache
2109 branch can be rebased onto the
2110 .Dq master
2111 branch:
2113 .Dl $ got update -b master
2114 .Dl $ got rebase unified-buffer-cache
2116 Changes on the
2117 .Dq unified-buffer-cache
2118 branch can now be made visible on the
2119 .Dq master
2120 branch with
2121 .Cm got integrate .
2122 Because the rebase operation switched the work tree to the
2123 .Dq unified-buffer-cache
2124 branch, the work tree must be switched back to the
2125 .Dq master
2126 branch first:
2128 .Dl $ got update -b master
2129 .Dl $ got integrate unified-buffer-cache
2131 On the
2132 .Dq master
2133 branch, log messages for local changes can now be amended with
2134 .Dq OK
2135 by other developers and any other important new information:
2137 .Dl $ got update -c origin/master
2138 .Dl $ got histedit -m
2140 If the remote repository offers write access, local changes on the
2141 .Dq master
2142 branch can be sent to the remote repository with
2143 .Cm got send .
2144 Usually,
2145 .Cm got send
2146 can be run without further arguments.
2147 The arguments shown here match defaults, provided the work tree's
2148 current branch is the
2149 .Dq master
2150 branch:
2152 .Dl $ got send -b master origin
2154 If the remote repository requires the HTTPS protocol, the
2155 .Xr git-push 1
2156 command must be used instead:
2158 .Dl $ cd /var/git/src.git
2159 .Dl $ git push origin master
2161 When making contributions to projects which use the
2162 .Dq pull request
2163 workflow, SSH protocol repository access needs to be set up first.
2164 Once an account has been created on a Git hosting site it should
2165 be possible to upload a public SSH key for repository access
2166 authentication.
2169 .Dq pull request
2170 workflow will usually involve two remote repositories.
2171 In the real-life example below, the
2172 .Dq origin
2173 repository was forked from the
2174 .Dq upstream
2175 repository by using the Git hosting site's web interface.
2177 .Xr got.conf 5
2178 file in the local repository describes both remote repositories:
2179 .Bd -literal -offset indent
2180 # Jelmers's repository, which accepts pull requests
2181 remote "upstream" {
2182         server git@github.com
2183         protocol ssh
2184         repository "/jelmer/dulwich"
2185         branch { "master" }
2188 # Stefan's fork, used as the default remote repository
2189 remote "origin" {
2190         server git@github.com
2191         protocol ssh
2192         repository "/stspdotname/dulwich"
2193         branch { "master" }
2197 With this configuration, Stefan can create commits on
2198 .Dq refs/heads/master
2199 and send them to the
2200 .Dq origin
2201 repository by running:
2203 .Dl $ got send -b master origin
2205 The changes can now be proposed to Jelmer by opening a pull request
2206 via the Git hosting site's web interface.
2207 If Jelmer requests further changes to be made, additional commits
2208 can be created on the
2209 .Dq master
2210 branch and be added to the pull request by running
2211 .Cd got send
2212 again.
2214 If Jelmer prefers additional commits to be
2215 .Dq squashed
2216 then the following commands can be used to achieve this:
2218 .Dl $ got update -b master
2219 .Dl $ got update -c origin/master
2220 .Dl $ got histedit -f
2221 .Dl $ got send -f -b master origin
2223 In addition to reviewing the pull request in the web user interface,
2224 Jelmer can fetch the pull request's branch into his local repository
2225 and create a local branch which contains the proposed changes:
2227 .Dl $ got fetch -R refs/pull/1046/head origin
2228 .Dl $ got branch -c refs/remotes/origin/pull/1046/head pr1046
2230 Once Jelmer has accepted the pull request, Stefan can fetch the
2231 merged changes, and possibly several other new changes, by running:
2233 .Dl $ got fetch upstream
2235 The merged changes will now be visible under the reference
2236 .Dq refs/remotes/upstream/master .
2237 The local
2238 .Dq master
2239 branch can now be rebased on top of the latest changes
2240 from upstream:
2242 .Dl $ got update -b upstream/master
2243 .Dl $ got rebase master
2245 As an alternative to
2246 .Cm got rebase ,
2247 branches can be merged with
2248 .Cm got merge :
2250 .Dl $ got update -b master
2251 .Dl $ got merge upstream/master
2253 The question of whether to rebase or merge branches is philosophical.
2254 When in doubt, refer to the software project's policies set by project
2255 maintainers.
2257 As a final step, the forked repository's copy of the master branch needs
2258 to be kept in sync by sending the new changes there:
2260 .Dl $ got send -f -b master origin
2262 If multiple pull requests need to be managed in parallel, a separate branch
2263 must be created for each pull request with
2264 .Cm got branch .
2265 Each such branch can then be used as above, in place of
2266 .Dq refs/heads/master .
2267 Changes for any accepted pull requests will still appear under
2268 .Dq refs/remotes/upstream/master,
2269 regardless of which branch was used in the forked repository to
2270 create a pull request.
2271 .Sh SEE ALSO
2272 .Xr gotadmin 1 ,
2273 .Xr tog 1 ,
2274 .Xr git-repository 5 ,
2275 .Xr got-worktree 5 ,
2276 .Xr got.conf 5 ,
2277 .Xr gotwebd 8
2278 .Sh AUTHORS
2279 .An Anthony J. Bentley Aq Mt bentley@openbsd.org
2280 .An Christian Weisgerber Aq Mt naddy@openbsd.org
2281 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
2282 .An Josh Rickmar Aq Mt jrick@zettaport.com
2283 .An Joshua Stein Aq Mt jcs@openbsd.org
2284 .An Klemens Nanni Aq Mt kn@openbsd.org
2285 .An Martin Pieuchot Aq Mt mpi@openbsd.org
2286 .An Neels Hofmeyr Aq Mt neels@hofmeyr.de
2287 .An Omar Polo Aq Mt op@openbsd.org
2288 .An Ori Bernstein Aq Mt ori@openbsd.org
2289 .An Sebastien Marie Aq Mt semarie@openbsd.org
2290 .An Stefan Sperling Aq Mt stsp@openbsd.org
2291 .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au
2292 .An Theo Buehler Aq Mt tb@openbsd.org
2293 .An Thomas Adam Aq Mt thomas@xteddy.org
2294 .An Tracey Emery Aq Mt tracey@traceyemery.net
2295 .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org
2297 Parts of
2298 .Nm ,
2299 .Xr tog 1 ,
2301 .Xr gotwebd 8
2302 were derived from code under copyright by:
2304 .An Caldera International
2305 .An Daniel Hartmeier
2306 .An Esben Norby
2307 .An Henning Brauer
2308 .An HÃ¥kan Olsson
2309 .An Ingo Schwarze
2310 .An Jean-Francois Brousseau
2311 .An Joris Vink
2312 .An Jyri J. Virkki
2313 .An Larry Wall
2314 .An Markus Friedl
2315 .An Niall O'Higgins
2316 .An Niklas Hallqvist
2317 .An Ray Lai
2318 .An Ryan McBride
2319 .An Theo de Raadt
2320 .An Todd C. Miller
2321 .An Xavier Santolaria
2324 contains code contributed to the public domain by
2325 .An Austin Appleby .
2326 .Sh CAVEATS
2328 is a work-in-progress and some features remain to be implemented.
2330 At present, the user has to fall back on
2331 .Xr git 1
2332 to perform some tasks.
2333 In particular:
2334 .Bl -bullet
2336 Reading from remote repositories over HTTP or HTTPS protocols requires
2337 .Xr git-clone 1
2339 .Xr git-fetch 1 .
2341 Writing to remote repositories over HTTP or HTTPS protocols requires
2342 .Xr git-push 1 .
2344 The creation of merge commits with more than two parent commits requires
2345 .Xr git-merge 1 .
2347 In situations where files or directories were moved around
2348 .Cm got
2349 will not automatically merge changes to new locations and
2350 .Xr git 1
2351 will usually produce better results.