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