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