Blob


1 .\"
2 .\" Copyright (c) 2017 Martin Pieuchot
3 .\" Copyright (c) 2018, 2019, 2020 Stefan Sperling
4 .\"
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
8 .\"
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .\"
17 .Dd $Mdocdate$
18 .Dt GOT 1
19 .Os
20 .Sh NAME
21 .Nm got
22 .Nd Game of Trees
23 .Sh SYNOPSIS
24 .Nm
25 .Ar command
26 .Op Fl h
27 .Op Ar arg ...
28 .Sh DESCRIPTION
29 .Nm
30 is a version control system which stores the history of tracked files
31 in a Git repository, as used by the Git version control system.
32 This repository format is described in
33 .Xr git-repository 5 .
34 .Pp
35 .Nm
36 is a
37 .Dq distributed
38 version control system because every copy of a repository is writeable.
39 Modifications made to files can be synchronized between repositories
40 at any time.
41 .Pp
42 Files managed by
43 .Nm
44 must be checked out from the repository for modification.
45 Checked out files are stored in a
46 .Em work tree
47 which can be placed at an arbitrary directory in the filesystem hierarchy.
48 The on-disk format of this work tree is described in
49 .Xr got-worktree 5 .
50 .Pp
51 .Nm
52 provides global and command-specific options.
53 Global options must precede the command name, and are as follows:
54 .Bl -tag -width tenletters
55 .It Fl h
56 Display usage information and exit immediately.
57 .It Fl V , -version
58 Display program version and exit immediately.
59 .El
60 .Pp
61 The commands for
62 .Nm
63 are as follows:
64 .Bl -tag -width checkout
65 .It Cm init Ar repository-path
66 Create a new empty repository at the specified
67 .Ar repository-path .
68 .Pp
69 After
70 .Cm got init ,
71 the
72 .Cm got import
73 command must be used to populate the empty repository before
74 .Cm got checkout
75 can be used.
76 .It Cm import Oo Fl b Ar branch Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl I Ar pattern Oc Ar directory
77 Create an initial commit in a repository from the file hierarchy
78 within the specified
79 .Ar directory .
80 The created commit will not have any parent commits, i.e. it will be a
81 root commit.
82 Also create a new reference which provides a branch name for the newly
83 created commit.
84 Show the path of each imported file to indicate progress.
85 .Pp
86 The
87 .Cm got import
88 command requires the
89 .Ev GOT_AUTHOR
90 environment variable to be set,
91 unless an author has been configured in
92 .Xr got.conf 5
93 or Git's
94 .Dv user.name
95 and
96 .Dv user.email
97 configuration settings can be obtained from the repository's
98 .Pa .git/config
99 file or from Git's global
100 .Pa ~/.gitconfig
101 configuration file.
102 .Pp
103 The options for
104 .Cm got import
105 are as follows:
106 .Bl -tag -width Ds
107 .It Fl b Ar branch
108 Create the specified
109 .Ar branch
110 instead of creating the default branch
111 .Dq main .
112 Use of this option is required if the
113 .Dq main
114 branch already exists.
115 .It Fl m Ar message
116 Use the specified log message when creating the new commit.
117 Without the
118 .Fl m
119 option,
120 .Cm got import
121 opens a temporary file in an editor where a log message can be written.
122 .It Fl r Ar repository-path
123 Use the repository at the specified path.
124 If not specified, assume the repository is located at or above the current
125 working directory.
126 .It Fl I Ar pattern
127 Ignore files or directories with a name which matches the specified
128 .Ar pattern .
129 This option may be specified multiple times to build a list of ignore patterns.
130 The
131 .Ar pattern
132 follows the globbing rules documented in
133 .Xr glob 7 .
134 .El
135 .It Cm im
136 Short alias for
137 .Cm import .
138 .It Cm clone Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl l Oc Oo Fl m Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Ar repository-URL Op Ar directory
139 Clone a Git repository at the specified
140 .Ar repository-URL
141 into the specified
142 .Ar directory .
143 If no
144 .Ar directory
145 is specified the directory name will be derived from the name of the
146 cloned repository.
147 .Cm got clone
148 will refuse to run if the
149 .Ar directory
150 already exists.
151 .Pp
152 The
153 .Ar repository-URL
154 specifies a protocol scheme, a server hostname, an optional port number
155 separated from the hostname by a colon, and a path to the repository on
156 the server:
157 .Lk scheme://hostname:port/path/to/repository
158 .Pp
159 The following protocol schemes are supported:
160 .Bl -tag -width git+ssh
161 .It git
162 The Git protocol as implemented by the
163 .Xr git-daemon 1
164 server.
165 Use of this protocol is discouraged since it supports neither authentication
166 nor encryption.
167 .It git+ssh
168 The Git protocol wrapped in an authenticated and encrypted
169 .Xr ssh 1
170 tunnel.
171 With this protocol the hostname may contain an embedded username for
172 .Xr ssh 1
173 to use:
174 .Mt user@hostname
175 .It ssh
176 Short alias for git+ssh.
177 .El
178 .Pp
179 Objects in the cloned repository are stored in a pack file which is downloaded
180 from the server.
181 This pack file will then be indexed to facilitate access to the objects stored
182 within.
183 If any objects in the pack file are stored in deltified form, all deltas will
184 be fully resolved in order to compute the ID of such objects.
185 This can take some time.
186 More details about the pack file format are documented in
187 .Xr git-repository 5 .
188 .Pp
189 .Cm got clone
190 creates a remote repository entry in the
191 .Xr got.conf 5
192 and
193 .Pa config
194 files of the cloned repository to store the
195 .Ar repository-url
196 and any
197 .Ar branch
198 or
199 .Ar reference
200 arguments for future use by
201 .Cm got fetch
202 or
203 .Xr git-fetch 1 .
204 .Pp
205 The options for
206 .Cm got clone
207 are as follows:
208 .Bl -tag -width Ds
209 .It Fl a
210 Fetch all branches from the remote repository's
211 .Dq refs/heads/
212 reference namespace and set
213 .Cm fetch-all-branches
214 in the cloned repository's
215 .Xr got.conf 5
216 file for future use by
217 .Cm got fetch .
218 If this option is not specified, a branch resolved via the remote
219 repository's HEAD reference will be fetched.
220 Cannot be used together with the
221 .Fl b
222 option.
223 .It Fl b Ar branch
224 Fetch the specified
225 .Ar branch
226 from the remote repository's
227 .Dq refs/heads/
228 reference namespace.
229 This option may be specified multiple times to build a list of branches
230 to fetch.
231 If the branch corresponding to the remote repository's HEAD reference is not
232 in this list, the cloned repository's HEAD reference will be set to the first
233 branch which was fetched.
234 If this option is not specified, a branch resolved via the remote
235 repository's HEAD reference will be fetched.
236 Cannot be used together with the
237 .Fl a
238 option.
239 .It Fl l
240 List branches and tags available for fetching from the remote repository
241 and exit immediately.
242 Cannot be used together with any of the other options except
243 .Fl q
244 and
245 .Fl v .
246 .It Fl m
247 Create the cloned repository as a mirror of the original repository.
248 This is useful if the cloned repository will not be used to store
249 locally created commits.
250 .Pp
251 The repository's
252 .Xr got.conf 5
253 and
254 .Pa config
255 files will be set up with the
256 .Dq mirror
257 option enabled, such that
258 .Cm got fetch
259 or
260 .Xr git-fetch 1
261 will write incoming changes directly to branches in the
262 .Dq refs/heads/
263 reference namespace, rather than to branches in the
264 .Dq refs/remotes/
265 namespace.
266 This avoids the usual requirement of having to run
267 .Cm got rebase
268 after
269 .Cm got fetch
270 in order to make incoming changes appear on branches in the
271 .Dq refs/heads/
272 namespace.
273 But maintaining custom changes in the cloned repository becomes difficult
274 since such changes will be at risk of being discarded whenever incoming
275 changes are fetched.
276 .It Fl q
277 Suppress progress reporting output.
278 The same option will be passed to
279 .Xr ssh 1
280 if applicable.
281 .It Fl v
282 Verbose mode.
283 Causes
284 .Cm got clone
285 to print debugging messages to standard error output.
286 This option will be passed to
287 .Xr ssh 1
288 if applicable.
289 Multiple -v options increase the verbosity.
290 The maximum is 3.
291 .It Fl R Ar reference
292 In addition to the branches and tags that will be fetched, fetch an arbitrary
293 .Ar reference
294 from the remote repository's
295 .Dq refs/
296 namespace.
297 This option may be specified multiple times to build a list of additional
298 references to fetch.
299 The specified
300 .Ar reference
301 may either be a path to a specific reference, or a reference namespace
302 which will cause all references in this namespace to be fetched.
303 .Pp
304 Each reference will be mapped into the cloned repository's
305 .Dq refs/remotes/
306 namespace, unless the
307 .Fl m
308 option is used to mirror references directly into the cloned repository's
309 .Dq refs/
310 namespace.
311 .Pp
312 .Cm got clone
313 will refuse to fetch references from the remote repository's
314 .Dq refs/remotes/
315 or
316 .Dq refs/got/
317 namespace.
318 .El
319 .It Cm cl
320 Short alias for
321 .Cm clone .
322 .It Cm fetch Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl d Oc Oo Fl l Oc Oo Fl r Ar repository-path Oc Oo Fl t Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Op Ar remote-repository
323 Fetch new changes from a remote repository.
324 If no
325 .Ar remote-repository
326 is specified,
327 .Dq origin
328 will be used.
329 The remote repository's URL is obtained from the corresponding entry in
330 .Xr got.conf 5
331 or Git's
332 .Pa config
333 file of the local repository, as created by
334 .Cm got clone .
335 .Pp
336 New changes will be stored in a separate pack file downloaded from the server.
337 Optionally, separate pack files stored in the repository can be combined with
338 .Xr git-repack 1 .
339 .Pp
340 By default, branch references in the
341 .Dq refs/remotes/
342 reference namespace will be updated to point at the newly fetched commits.
343 The
344 .Cm got rebase
345 command can then be used to make new changes visible on branches in the
346 .Dq refs/heads/
347 namespace, merging incoming changes with the changes on those branches
348 as necessary.
349 .Pp
350 If the repository was created as a mirror with
351 .Cm got clone -m
352 then all branches in the
353 .Dq refs/heads/
354 namespace will be updated directly to match the corresponding branches in
355 the remote repository.
356 If those branches contained local commits, these commits will no longer be
357 reachable via a reference and will therefore be at risk of being discarded
358 by Git's garbage collector or
359 .Cm gotadmin cleanup .
360 Maintaining custom changes in a mirror repository is therefore discouraged.
361 .Pp
362 In any case, references in the
363 .Dq refs/tags/
364 namespace will always be fetched and mapped directly to local references
365 in the same namespace.
366 .Pp
367 The options for
368 .Cm got fetch
369 are as follows:
370 .Bl -tag -width Ds
371 .It Fl a
372 Fetch all branches from the remote repository's
373 .Dq refs/heads/
374 reference namespace.
375 This option can be enabled by default for specific repositories in
376 .Xr got.conf 5 .
377 If this option is not specified, a branch resolved via the remote
378 repository's HEAD reference will be fetched.
379 Cannot be used together with the
380 .Fl b
381 option.
382 .It Fl b Ar branch
383 Fetch the specified
384 .Ar branch
385 from the remote repository's
386 .Dq refs/heads/
387 reference namespace.
388 This option may be specified multiple times to build a list of branches
389 to fetch.
390 If this option is not specified, a branch resolved via the remote
391 repository's HEAD reference will be fetched.
392 Cannot be used together with the
393 .Fl a
394 option.
395 .It Fl d
396 Delete branches and tags from the local repository which are no longer
397 present in the remote repository.
398 Only references are deleted.
399 Any commit, tree, tag, and blob objects belonging to deleted branches or
400 tags remain in the repository and may be removed separately with
401 Git's garbage collector or
402 .Cm gotadmin cleanup .
403 .It Fl l
404 List branches and tags available for fetching from the remote repository
405 and exit immediately.
406 Cannot be used together with any of the other options except
407 .Fl v ,
408 .Fl q ,
409 and
410 .Fl r .
411 .It Fl t
412 Allow existing references in the
413 .Dq refs/tags
414 namespace to be updated if they have changed on the server.
415 If not specified, only new tag references will be created.
416 .It Fl r Ar repository-path
417 Use the repository at the specified path.
418 If not specified, assume the repository is located at or above the current
419 working directory.
420 If this directory is a
421 .Nm
422 work tree, use the repository path associated with this work tree.
423 .It Fl q
424 Suppress progress reporting output.
425 The same option will be passed to
426 .Xr ssh 1
427 if applicable.
428 .It Fl v
429 Verbose mode.
430 Causes
431 .Cm got fetch
432 to print debugging messages to standard error output.
433 The same option will be passed to
434 .Xr ssh 1
435 if applicable.
436 Multiple -v options increase the verbosity.
437 The maximum is 3.
438 .It Fl R Ar reference
439 In addition to the branches and tags that will be fetched, fetch an arbitrary
440 .Ar reference
441 from the remote repository's
442 .Dq refs/
443 namespace.
444 This option may be specified multiple times to build a list of additional
445 references to fetch.
446 The specified
447 .Ar reference
448 may either be a path to a specific reference, or a reference namespace
449 which will cause all references in this namespace to be fetched.
450 .Pp
451 Each reference will be mapped into the local repository's
452 .Dq refs/remotes/
453 namespace, unless the local repository was created as a mirror with
454 .Cm got clone -m
455 in which case references will be mapped directly into the local repository's
456 .Dq refs/
457 namespace.
458 .Pp
459 Once a reference has been fetched, a branch based on it can be created with
460 .Cm got branch
461 if needed.
462 .Pp
463 .Cm got fetch
464 will refuse to fetch references from the remote repository's
465 .Dq refs/remotes/
466 or
467 .Dq refs/got/
468 namespace.
469 .El
470 .It Cm fe
471 Short alias for
472 .Cm fetch .
473 .It Cm checkout Oo Fl E Oc Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Oo Fl p Ar path-prefix Oc Ar repository-path Op Ar work-tree-path
474 Copy files from a repository into a new work tree.
475 Show the status of each affected file, using the following status codes:
476 .Bl -column YXZ description
477 .It A Ta new file was added
478 .It E Ta file already exists in work tree's meta-data
479 .El
480 .Pp
481 If the
482 .Ar work tree path
483 is not specified, either use the last component of
484 .Ar repository path ,
485 or if a
486 .Ar path prefix
487 was specified use the last component of
488 .Ar path prefix .
489 .Pp
490 The options for
491 .Cm got checkout
492 are as follows:
493 .Bl -tag -width Ds
494 .It Fl E
495 Proceed with the checkout operation even if the directory at
496 .Ar work-tree-path
497 is not empty.
498 Existing files will be left intact.
499 .It Fl b Ar branch
500 Check out files from a commit on the specified
501 .Ar branch .
502 If this option is not specified, a branch resolved via the repository's HEAD
503 reference will be used.
504 .It Fl c Ar commit
505 Check out files from the specified
506 .Ar commit
507 on the selected branch.
508 The expected argument is a commit ID SHA1 hash or an existing reference
509 or tag name which will be resolved to a commit ID.
510 An abbreviated hash argument will be expanded to a full SHA1 hash
511 automatically, provided the abbreviation is unique.
512 If this option is not specified, the most recent commit on the selected
513 branch will be used.
514 .Pp
515 If the specified
516 .Ar commit
517 is not contained in the selected branch, a different branch which contains
518 this commit must be specified with the
519 .Fl b
520 option.
521 If no such branch is known a new branch must be created for this
522 commit with
523 .Cm got branch
524 before
525 .Cm got checkout
526 can be used.
527 Checking out work trees with an unknown branch is intentionally not supported.
528 .It Fl p Ar path-prefix
529 Restrict the work tree to a subset of the repository's tree hierarchy.
530 Only files beneath the specified
531 .Ar path-prefix
532 will be checked out.
533 .El
534 .It Cm co
535 Short alias for
536 .Cm checkout .
537 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
538 Update an existing work tree to a different
539 .Ar commit .
540 Change existing files in the work tree as necessary to match file contents
541 of this commit.
542 Preserve any local changes in the work tree and merge them with the
543 incoming changes.
544 .Pp
545 Files which already contain merge conflicts will not be updated to avoid
546 further complications.
547 Such files will be updated when
548 .Cm got update
549 is run again after merge conflicts have been resolved.
550 If the conflicting changes are no longer needed affected files can be
551 reverted with
552 .Cm got revert
553 before running
554 .Cm got update
555 again.
556 .Pp
557 Show the status of each affected file, using the following status codes:
558 .Bl -column YXZ description
559 .It U Ta file was updated and contained no local changes
560 .It G Ta file was updated and local changes were merged cleanly
561 .It C Ta file was updated and conflicts occurred during merge
562 .It D Ta file was deleted
563 .It A Ta new file was added
564 .It \(a~ Ta versioned file is obstructed by a non-regular file
565 .It ! Ta a missing versioned file was restored
566 .It # Ta file was not updated because it contains merge conflicts
567 .It ? Ta changes destined for an unversioned file were not merged
568 .El
569 .Pp
570 If no
571 .Ar path
572 is specified, update the entire work tree.
573 Otherwise, restrict the update operation to files at or within the
574 specified paths.
575 Each path is required to exist in the update operation's target commit.
576 Files in the work tree outside specified paths will remain unchanged and
577 will retain their previously recorded base commit.
578 Some
579 .Nm
580 commands may refuse to run while the work tree contains files from
581 multiple base commits.
582 The base commit of such a work tree can be made consistent by running
583 .Cm got update
584 across the entire work tree.
585 Specifying a
586 .Ar path
587 is incompatible with the
588 .Fl b
589 option.
590 .Pp
591 .Cm got update
592 cannot update paths with staged changes.
593 If changes have been staged with
594 .Cm got stage ,
595 these changes must first be committed with
596 .Cm got commit
597 or unstaged with
598 .Cm got unstage .
599 .Pp
600 The options for
601 .Cm got update
602 are as follows:
603 .Bl -tag -width Ds
604 .It Fl b Ar branch
605 Switch the work tree's branch reference to the specified
606 .Ar branch
607 before updating the work tree.
608 This option requires that all paths in the work tree are updated.
609 .Pp
610 As usual, any local changes in the work tree will be preserved.
611 This can be useful when switching to a newly created branch in order
612 to commit existing local changes to this branch.
613 .Pp
614 Any local changes must be dealt with separately in order to obtain a
615 work tree with pristine file contents corresponding exactly to the specified
616 .Ar branch .
617 Such changes could first be committed to a different branch with
618 .Cm got commit ,
619 or could be discarded with
620 .Cm got revert .
621 .It Fl c Ar commit
622 Update the work tree to the specified
623 .Ar commit .
624 The expected argument is a commit ID SHA1 hash or an existing reference
625 or tag name which will be resolved to a commit ID.
626 An abbreviated hash argument will be expanded to a full SHA1 hash
627 automatically, provided the abbreviation is unique.
628 If this option is not specified, the most recent commit on the work tree's
629 branch will be used.
630 .El
631 .It Cm up
632 Short alias for
633 .Cm update .
634 .It Cm status Oo Fl I Oc Oo Fl s Ar status-codes Oc Op Ar path ...
635 Show the current modification status of files in a work tree,
636 using the following status codes:
637 .Bl -column YXZ description
638 .It M Ta modified file
639 .It A Ta file scheduled for addition in next commit
640 .It D Ta file scheduled for deletion in next commit
641 .It C Ta modified or added file which contains merge conflicts
642 .It ! Ta versioned file was expected on disk but is missing
643 .It \(a~ Ta versioned file is obstructed by a non-regular file
644 .It ? Ta unversioned item not tracked by
645 .Nm
646 .It m Ta modified file modes (executable bit only)
647 .It N Ta non-existent
648 .Ar path
649 specified on the command line
650 .El
651 .Pp
652 If no
653 .Ar path
654 is specified, show modifications in the entire work tree.
655 Otherwise, show modifications at or within the specified paths.
656 .Pp
657 If changes have been staged with
658 .Cm got stage ,
659 staged changes are shown in the second output column, using the following
660 status codes:
661 .Bl -column YXZ description
662 .It M Ta file modification is staged
663 .It A Ta file addition is staged
664 .It D Ta file deletion is staged
665 .El
666 .Pp
667 Changes created on top of staged changes are indicated in the first column:
668 .Bl -column YXZ description
669 .It MM Ta file was modified after earlier changes have been staged
670 .It MA Ta file was modified after having been staged for addition
671 .El
672 .Pp
673 The options for
674 .Cm got status
675 are as follows:
676 .Bl -tag -width Ds
677 .It Fl I
678 Show unversioned files even if they match an ignore pattern.
679 .It Fl s Ar status-codes
680 Only show files with a modification status matching any of the
681 single-character status codes contained in the
682 .Ar status-codes
683 argument.
684 Any combination of codes from the above list of possible status codes
685 may be specified.
686 For staged files, status codes displayed in either column will be matched.
687 .El
688 .Pp
689 For compatibility with
690 .Xr cvs 1
691 and
692 .Xr git 1 ,
693 .Cm got status
694 reads
695 .Xr glob 7
696 patterns from
697 .Pa .cvsignore
698 and
699 .Pa .gitignore
700 files in each traversed directory and will not display unversioned files
701 which match these patterns.
702 As an extension to
703 .Xr glob 7
704 matching rules,
705 .Cm got status
706 supports consecutive asterisks,
707 .Dq ** ,
708 which will match an arbitrary amount of directories.
709 Unlike
710 .Xr cvs 1 ,
711 .Cm got status
712 only supports a single ignore pattern per line.
713 Unlike
714 .Xr git 1 ,
715 .Cm got status
716 does not support negated ignore patterns prefixed with
717 .Dq \&! ,
718 and gives no special significance to the location of path component separators,
719 .Dq / ,
720 in a pattern.
721 .It Cm st
722 Short alias for
723 .Cm status .
724 .It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl P Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Oo Fl R Oc Oo Fl x Ar commit Oc Op Ar path
725 Display history of a repository.
726 If a
727 .Ar path
728 is specified, show only commits which modified this path.
729 If invoked in a work tree, the
730 .Ar path
731 is interpreted relative to the current working directory,
732 and the work tree's path prefix is implicitly prepended.
733 Otherwise, the path is interpreted relative to the repository root.
734 .Pp
735 The options for
736 .Cm got log
737 are as follows:
738 .Bl -tag -width Ds
739 .It Fl b
740 Display individual commits which were merged into the current branch
741 from other branches.
742 By default,
743 .Cm got log
744 shows the linear history of the current branch only.
745 .It Fl c Ar commit
746 Start traversing history at the specified
747 .Ar commit .
748 The expected argument is a commit ID SHA1 hash or an existing reference
749 or tag name which will be resolved to a commit ID.
750 An abbreviated hash argument will be expanded to a full SHA1 hash
751 automatically, provided the abbreviation is unique.
752 If this option is not specified, default to the work tree's current branch
753 if invoked in a work tree, or to the repository's HEAD reference.
754 .It Fl C Ar number
755 Set the number of context lines shown in diffs with
756 .Fl p .
757 By default, 3 lines of context are shown.
758 .It Fl l Ar N
759 Limit history traversal to a given number of commits.
760 If this option is not specified, a default limit value of zero is used,
761 which is treated as an unbounded limit.
762 The
763 .Ev GOT_LOG_DEFAULT_LIMIT
764 environment variable may be set to change this default value.
765 .It Fl p
766 Display the patch of modifications made in each commit.
767 If a
768 .Ar path
769 is specified, only show the patch of modifications at or within this path.
770 .It Fl P
771 Display the list of file paths changed in each commit, using the following
772 status codes:
773 .Bl -column YXZ description
774 .It M Ta modified file
775 .It D Ta file was deleted
776 .It A Ta new file was added
777 .It m Ta modified file modes (executable bit only)
778 .El
779 .It Fl s Ar search-pattern
780 If specified, show only commits with a log message matched by the extended
781 regular expression
782 .Ar search-pattern .
783 When used together with
784 .Fl P
785 then the file paths changed by a commit can be matched as well.
786 Regular expression syntax is documented in
787 .Xr re_format 7 .
788 .It Fl r Ar repository-path
789 Use the repository at the specified path.
790 If not specified, assume the repository is located at or above the current
791 working directory.
792 If this directory is a
793 .Nm
794 work tree, use the repository path associated with this work tree.
795 .It Fl R
796 Determine a set of commits to display as usual, but display these commits
797 in reverse order.
798 .It Fl x Ar commit
799 Stop traversing commit history immediately after the specified
800 .Ar commit
801 has been traversed.
802 This option has no effect if the specified
803 .Ar commit
804 is never traversed.
805 .El
806 .It Cm diff Oo Fl a Oc Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path
807 When invoked within a work tree with less than two arguments, display
808 local changes in the work tree.
809 If a
810 .Ar path
811 is specified, only show changes within this path.
812 .Pp
813 If two arguments are provided, treat each argument as a reference, a tag
814 name, or an object ID SHA1 hash, and display differences between the
815 corresponding objects.
816 Both objects must be of the same type (blobs, trees, or commits).
817 An abbreviated hash argument will be expanded to a full SHA1 hash
818 automatically, provided the abbreviation is unique.
819 .Pp
820 The options for
821 .Cm got diff
822 are as follows:
823 .Bl -tag -width Ds
824 .It Fl a
825 Treat file contents as ASCII text even if binary data is detected.
826 .It Fl C Ar number
827 Set the number of context lines shown in the diff.
828 By default, 3 lines of context are shown.
829 .It Fl r Ar repository-path
830 Use the repository at the specified path.
831 If not specified, assume the repository is located at or above the current
832 working directory.
833 If this directory is a
834 .Nm
835 work tree, use the repository path associated with this work tree.
836 .It Fl s
837 Show changes staged with
838 .Cm got stage
839 instead of showing local changes in the work tree.
840 This option is only valid when
841 .Cm got diff
842 is invoked in a work tree.
843 .It Fl w
844 Ignore whitespace-only changes.
845 .El
846 .It Cm di
847 Short alias for
848 .Cm diff .
849 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
850 Display line-by-line history of a file at the specified path.
851 .Pp
852 The options for
853 .Cm got blame
854 are as follows:
855 .Bl -tag -width Ds
856 .It Fl c Ar commit
857 Start traversing history at the specified
858 .Ar commit .
859 The expected argument is a commit ID SHA1 hash or an existing reference
860 or tag name which will be resolved to a commit ID.
861 An abbreviated hash argument will be expanded to a full SHA1 hash
862 automatically, provided the abbreviation is unique.
863 .It Fl r Ar repository-path
864 Use the repository at the specified path.
865 If not specified, assume the repository is located at or above the current
866 working directory.
867 If this directory is a
868 .Nm
869 work tree, use the repository path associated with this work tree.
870 .El
871 .It Cm bl
872 Short alias for
873 .Cm blame .
874 .It Cm tree Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl i Oc Oo Fl R Oc Op Ar path
875 Display a listing of files and directories at the specified
876 directory path in the repository.
877 Entries shown in this listing may carry one of the following trailing
878 annotations:
879 .Bl -column YXZ description
880 .It @ Ta entry is a symbolic link
881 .It / Ta entry is a directory
882 .It * Ta entry is an executable file
883 .It $ Ta entry is a Git submodule
884 .El
885 .Pp
886 Symbolic link entries are also annotated with the target path of the link.
887 .Pp
888 If no
889 .Ar path
890 is specified, list the repository path corresponding to the current
891 directory of the work tree, or the root directory of the repository
892 if there is no work tree.
893 .Pp
894 The options for
895 .Cm got tree
896 are as follows:
897 .Bl -tag -width Ds
898 .It Fl c Ar commit
899 List files and directories as they appear in the specified
900 .Ar commit .
901 The expected argument is a commit ID SHA1 hash or an existing reference
902 or tag name which will be resolved to a commit ID.
903 An abbreviated hash argument will be expanded to a full SHA1 hash
904 automatically, provided the abbreviation is unique.
905 .It Fl r Ar repository-path
906 Use the repository at the specified path.
907 If not specified, assume the repository is located at or above the current
908 working directory.
909 If this directory is a
910 .Nm
911 work tree, use the repository path associated with this work tree.
912 .It Fl i
913 Show object IDs of files (blob objects) and directories (tree objects).
914 .It Fl R
915 Recurse into sub-directories in the repository.
916 .El
917 .It Cm tr
918 Short alias for
919 .Cm tree .
920 .It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl c Ar object Oc Oo Fl s Ar reference Oc Oo Fl d Oc Op Ar name
921 Manage references in a repository.
922 .Pp
923 References may be listed, created, deleted, and changed.
924 When creating, deleting, or changing a reference the specified
925 .Ar name
926 must be an absolute reference name, i.e. it must begin with
927 .Dq refs/ .
928 .Pp
929 The options for
930 .Cm got ref
931 are as follows:
932 .Bl -tag -width Ds
933 .It Fl r Ar repository-path
934 Use the repository at the specified path.
935 If not specified, assume the repository is located at or above the current
936 working directory.
937 If this directory is a
938 .Nm
939 work tree, use the repository path associated with this work tree.
940 .It Fl l
941 List references in the repository.
942 If no
943 .Ar name
944 is specified, list all existing references in the repository.
945 If
946 .Ar name
947 is a reference namespace, list all references in this namespace.
948 Otherwise, show only the reference with the given
949 .Ar name .
950 Cannot be used together with any other options except
951 .Fl r .
952 .It Fl c Ar object
953 Create a reference or change an existing reference.
954 The reference with the specified
955 .Ar name
956 will point at the specified
957 .Ar object .
958 The expected
959 .Ar object
960 argument is a ID SHA1 hash or an existing reference or tag name which will
961 be resolved to the ID of a corresponding commit, tree, tag, or blob object.
962 Cannot be used together with any other options except
963 .Fl r .
964 .It Fl s Ar reference
965 Create a symbolic reference, or change an existing symbolic reference.
966 The symbolic reference with the specified
967 .Ar name
968 will point at the specified
969 .Ar reference
970 which must already exist in the repository.
971 Care should be taken not to create loops between references when
972 this option is used.
973 Cannot be used together with any other options except
974 .Fl r .
975 .It Fl d
976 Delete the reference with the specified
977 .Ar name
978 from the repository.
979 Any commit, tree, tag, and blob objects belonging to deleted references
980 remain in the repository and may be removed separately with
981 Git's garbage collector or
982 .Cm gotadmin cleanup .
983 Cannot be used together with any other options except
984 .Fl r .
985 .El
986 .It Cm branch Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Oo Fl n Oc Op Ar name
987 Create, list, or delete branches.
988 .Pp
989 Local branches are managed via references which live in the
990 .Dq refs/heads/
991 reference namespace.
992 The
993 .Cm got branch
994 command creates or deletes references in this namespace only.
995 .Pp
996 If invoked in a work tree without any arguments, print the name of the
997 work tree's current branch.
998 .Pp
999 If a
1000 .Ar name
1001 argument is passed, attempt to create a branch reference with the given name.
1002 By default the new branch reference will point at the latest commit on the
1003 work tree's current branch if invoked in a work tree, and otherwise to a commit
1004 resolved via the repository's HEAD reference.
1005 .Pp
1006 If invoked in a work tree, once the branch was created successfully
1007 switch the work tree's head reference to the newly created branch and
1008 update files across the entire work tree, just like
1009 .Cm got update -b Ar name
1010 would do.
1011 Show the status of each affected file, using the following status codes:
1012 .Bl -column YXZ description
1013 .It U Ta file was updated and contained no local changes
1014 .It G Ta file was updated and local changes were merged cleanly
1015 .It C Ta file was updated and conflicts occurred during merge
1016 .It D Ta file was deleted
1017 .It A Ta new file was added
1018 .It \(a~ Ta versioned file is obstructed by a non-regular file
1019 .It ! Ta a missing versioned file was restored
1020 .El
1021 .Pp
1022 The options for
1023 .Cm got branch
1024 are as follows:
1025 .Bl -tag -width Ds
1026 .It Fl c Ar commit
1027 Make a newly created branch reference point at the specified
1028 .Ar commit .
1029 The expected
1030 .Ar commit
1031 argument is a commit ID SHA1 hash or an existing reference
1032 or tag name which will be resolved to a commit ID.
1033 .It Fl r Ar repository-path
1034 Use the repository at the specified path.
1035 If not specified, assume the repository is located at or above the current
1036 working directory.
1037 If this directory is a
1038 .Nm
1039 work tree, use the repository path associated with this work tree.
1040 .It Fl l
1041 List all existing branches in the repository, including copies of remote
1042 repositories' branches in the
1043 .Dq refs/remotes/
1044 reference namespace.
1045 .Pp
1046 If invoked in a work tree, the work tree's current branch is shown
1047 with one the following annotations:
1048 .Bl -column YXZ description
1049 .It * Ta work tree's base commit matches the branch tip
1050 .It \(a~ Ta work tree's base commit is out-of-date
1051 .El
1052 .It Fl d Ar name
1053 Delete the branch with the specified name from the repository.
1054 Only the branch reference is deleted.
1055 Any commit, tree, and blob objects belonging to the branch
1056 remain in the repository and may be removed separately with
1057 Git's garbage collector or
1058 .Cm gotadmin cleanup .
1059 .It Fl n
1060 Do not switch and update the work tree after creating a new branch.
1061 .El
1062 .It Cm br
1063 Short alias for
1064 .Cm branch .
1065 .It Cm tag Oo Fl c Ar commit Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Ar name
1066 Manage tags in a repository.
1067 .Pp
1068 Tags are managed via references which live in the
1069 .Dq refs/tags/
1070 reference namespace.
1071 The
1072 .Cm got tag
1073 command operates on references in this namespace only.
1074 References in this namespace point at tag objects which contain a pointer
1075 to another object, a tag message, as well as author and timestamp information.
1076 .Pp
1077 Attempt to create a tag with the given
1078 .Ar name ,
1079 and make this tag point at the given
1080 .Ar commit .
1081 If no commit is specified, default to the latest commit on the work tree's
1082 current branch if invoked in a work tree, and to a commit resolved via
1083 the repository's HEAD reference otherwise.
1084 .Pp
1085 The options for
1086 .Cm got tag
1087 are as follows:
1088 .Bl -tag -width Ds
1089 .It Fl c Ar commit
1090 Make the newly created tag reference point at the specified
1091 .Ar commit .
1092 The expected
1093 .Ar commit
1094 argument is a commit ID SHA1 hash or an existing reference or tag name which
1095 will be resolved to a commit ID.
1096 An abbreviated hash argument will be expanded to a full SHA1 hash
1097 automatically, provided the abbreviation is unique.
1098 .It Fl m Ar message
1099 Use the specified tag message when creating the new tag.
1100 Without the
1101 .Fl m
1102 option,
1103 .Cm got tag
1104 opens a temporary file in an editor where a tag message can be written.
1105 .It Fl r Ar repository-path
1106 Use the repository at the specified path.
1107 If not specified, assume the repository is located at or above the current
1108 working directory.
1109 If this directory is a
1110 .Nm
1111 work tree, use the repository path associated with this work tree.
1112 .It Fl l
1113 List all existing tags in the repository instead of creating a new tag.
1114 If this option is used, no other command-line arguments are allowed.
1115 .El
1116 .Pp
1117 By design, the
1118 .Cm got tag
1119 command will not delete tags or change existing tags.
1120 If a tag must be deleted, the
1121 .Cm got ref
1122 command may be used to delete a tag's reference.
1123 This should only be done if the tag has not already been copied to
1124 another repository.
1125 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
1126 Schedule unversioned files in a work tree for addition to the
1127 repository in the next commit.
1128 By default, files which match a
1129 .Cm got status
1130 ignore pattern will not be added.
1131 .Pp
1132 The options for
1133 .Cm got add
1134 are as follows:
1135 .Bl -tag -width Ds
1136 .It Fl R
1137 Permit recursion into directories.
1138 If this option is not specified,
1139 .Cm got add
1140 will refuse to run if a specified
1141 .Ar path
1142 is a directory.
1143 .It Fl I
1144 Add files even if they match a
1145 .Cm got status
1146 ignore pattern.
1147 .El
1148 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Oo Fl s Ar status-codes Oc Ar path ...
1149 Remove versioned files from a work tree and schedule them for deletion
1150 from the repository in the next commit.
1151 .Pp
1152 The options for
1153 .Cm got remove
1154 are as follows:
1155 .Bl -tag -width Ds
1156 .It Fl f
1157 Perform the operation even if a file contains local modifications.
1158 .It Fl k
1159 Keep affected files on disk.
1160 .It Fl R
1161 Permit recursion into directories.
1162 If this option is not specified,
1163 .Cm got remove
1164 will refuse to run if a specified
1165 .Ar path
1166 is a directory.
1167 .It Fl s Ar status-codes
1168 Only delete files with a modification status matching one of the
1169 single-character status codes contained in the
1170 .Ar status-codes
1171 argument.
1172 The following status codes may be specified:
1173 .Bl -column YXZ description
1174 .It M Ta modified file (this implies the
1175 .Fl f
1176 option)
1177 .It ! Ta versioned file expected on disk but missing
1178 .El
1179 .El
1180 .It Cm rm
1181 Short alias for
1182 .Cm remove .
1183 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
1184 Revert any local changes in files at the specified paths in a work tree.
1185 File contents will be overwritten with those contained in the
1186 work tree's base commit.
1187 There is no way to bring discarded changes back after
1188 .Cm got revert !
1189 .Pp
1190 If a file was added with
1191 .Cm got add
1192 it will become an unversioned file again.
1193 If a file was deleted with
1194 .Cm got remove
1195 it will be restored.
1196 .Pp
1197 The options for
1198 .Cm got revert
1199 are as follows:
1200 .Bl -tag -width Ds
1201 .It Fl p
1202 Instead of reverting all changes in files, interactively select or reject
1203 changes to revert based on
1204 .Dq y
1205 (revert change),
1206 .Dq n
1207 (keep change), and
1208 .Dq q
1209 (quit reverting this file) responses.
1210 If a file is in modified status, individual patches derived from the
1211 modified file content can be reverted.
1212 Files in added or deleted status may only be reverted in their entirety.
1213 .It Fl F Ar response-script
1214 With the
1215 .Fl p
1216 option, read
1217 .Dq y ,
1218 .Dq n ,
1219 and
1220 .Dq q
1221 responses line-by-line from the specified
1222 .Ar response-script
1223 file instead of prompting interactively.
1224 .It Fl R
1225 Permit recursion into directories.
1226 If this option is not specified,
1227 .Cm got revert
1228 will refuse to run if a specified
1229 .Ar path
1230 is a directory.
1231 .El
1232 .It Cm rv
1233 Short alias for
1234 .Cm revert .
1235 .It Cm commit Oo Fl F Ar path Oc Oo Fl m Ar message Oc Oo Fl N Oc Oo Fl S Oc Op Ar path ...
1236 Create a new commit in the repository from changes in a work tree
1237 and use this commit as the new base commit for the work tree.
1238 If no
1239 .Ar path
1240 is specified, commit all changes in the work tree.
1241 Otherwise, commit changes at or within the specified paths.
1242 .Pp
1243 If changes have been explicitly staged for commit with
1244 .Cm got stage ,
1245 only commit staged changes and reject any specified paths which
1246 have not been staged.
1247 .Pp
1248 .Cm got commit
1249 opens a temporary file in an editor where a log message can be written
1250 unless the
1251 .Fl m
1252 option is used
1253 or the
1254 .Fl F
1255 and
1256 .Fl N
1257 options are used together.
1258 .Pp
1259 Show the status of each affected file, using the following status codes:
1260 .Bl -column YXZ description
1261 .It M Ta modified file
1262 .It D Ta file was deleted
1263 .It A Ta new file was added
1264 .It m Ta modified file modes (executable bit only)
1265 .El
1266 .Pp
1267 Files which are not part of the new commit will retain their previously
1268 recorded base commit.
1269 Some
1270 .Nm
1271 commands may refuse to run while the work tree contains files from
1272 multiple base commits.
1273 The base commit of such a work tree can be made consistent by running
1274 .Cm got update
1275 across the entire work tree.
1276 .Pp
1277 The
1278 .Cm got commit
1279 command requires the
1280 .Ev GOT_AUTHOR
1281 environment variable to be set,
1282 unless an author has been configured in
1283 .Xr got.conf 5
1284 or Git's
1285 .Dv user.name
1286 and
1287 .Dv user.email
1288 configuration settings can be
1289 obtained from the repository's
1290 .Pa .git/config
1291 file or from Git's global
1292 .Pa ~/.gitconfig
1293 configuration file.
1294 .Pp
1295 The options for
1296 .Cm got commit
1297 are as follows:
1298 .Bl -tag -width Ds
1299 .It Fl F Ar path
1300 Use the prepared log message stored in the file found at
1301 .Ar path
1302 when creating the new commit.
1303 .Cm got commit
1304 opens a temporary file in an editor where the prepared log message can be
1305 reviewed and edited further if needed.
1306 Cannot be used together with the
1307 .Fl m
1308 option.
1309 .It Fl m Ar message
1310 Use the specified log message when creating the new commit.
1311 Cannot be used together with the
1312 .Fl F
1313 option.
1314 .It Fl N
1315 This option prevents
1316 .Cm got commit
1317 from opening the commit message in an editor.
1318 It has no effect unless it is used together with the
1319 .Fl F
1320 option and is intended for non-interactive use such as scripting.
1321 .It Fl S
1322 Allow the addition of symbolic links which point outside of the path space
1323 that is under version control.
1324 By default,
1325 .Cm got commit
1326 will reject such symbolic links due to safety concerns.
1327 As a precaution,
1328 .Nm
1329 may decide to represent such a symbolic link as a regular file which contains
1330 the link's target path, rather than creating an actual symbolic link which
1331 points outside of the work tree.
1332 Use of this option is discouraged because external mechanisms such as
1333 .Dq make obj
1334 are better suited for managing symbolic links to paths not under
1335 version control.
1336 .El
1337 .Pp
1338 .Cm got commit
1339 will refuse to run if certain preconditions are not met.
1340 If the work tree's current branch is not in the
1341 .Dq refs/heads/
1342 reference namespace, new commits may not be created on this branch.
1343 Local changes may only be committed if they are based on file content
1344 found in the most recent commit on the work tree's branch.
1345 If a path is found to be out of date,
1346 .Cm got update
1347 must be used first in order to merge local changes with changes made
1348 in the repository.
1349 .It Cm ci
1350 Short alias for
1351 .Cm commit .
1352 .It Cm cherrypick Ar commit
1353 Merge changes from a single
1354 .Ar commit
1355 into the work tree.
1356 The specified
1357 .Ar commit
1358 must be on a different branch than the work tree's base commit.
1359 The expected argument is a reference or a commit ID SHA1 hash.
1360 An abbreviated hash argument will be expanded to a full SHA1 hash
1361 automatically, provided the abbreviation is unique.
1362 .Pp
1363 Show the status of each affected file, using the following status codes:
1364 .Bl -column YXZ description
1365 .It G Ta file was merged
1366 .It C Ta file was merged and conflicts occurred during merge
1367 .It ! Ta changes destined for a missing file were not merged
1368 .It D Ta file was deleted
1369 .It d Ta file's deletion was obstructed by local modifications
1370 .It A Ta new file was added
1371 .It \(a~ Ta changes destined for a non-regular file were not merged
1372 .It ? Ta changes destined for an unversioned file were not merged
1373 .El
1374 .Pp
1375 The merged changes will appear as local changes in the work tree, which
1376 may be viewed with
1377 .Cm got diff ,
1378 amended manually or with further
1379 .Cm got cherrypick
1380 commands,
1381 committed with
1382 .Cm got commit ,
1383 or discarded again with
1384 .Cm got revert .
1385 .Pp
1386 .Cm got cherrypick
1387 will refuse to run if certain preconditions are not met.
1388 If the work tree contains multiple base commits it must first be updated
1389 to a single base commit with
1390 .Cm got update .
1391 If the work tree already contains files with merge conflicts, these
1392 conflicts must be resolved first.
1393 .It Cm cy
1394 Short alias for
1395 .Cm cherrypick .
1396 .It Cm backout Ar commit
1397 Reverse-merge changes from a single
1398 .Ar commit
1399 into the work tree.
1400 The specified
1401 .Ar commit
1402 must be on the same branch as the work tree's base commit.
1403 The expected argument is a reference or a commit ID SHA1 hash.
1404 An abbreviated hash argument will be expanded to a full SHA1 hash
1405 automatically, provided the abbreviation is unique.
1406 .Pp
1407 Show the status of each affected file, using the following status codes:
1408 .Bl -column YXZ description
1409 .It G Ta file was merged
1410 .It C Ta file was merged and conflicts occurred during merge
1411 .It ! Ta changes destined for a missing file were not merged
1412 .It D Ta file was deleted
1413 .It d Ta file's deletion was obstructed by local modifications
1414 .It A Ta new file was added
1415 .It \(a~ Ta changes destined for a non-regular file were not merged
1416 .It ? Ta changes destined for an unversioned file were not merged
1417 .El
1418 .Pp
1419 The reverse-merged changes will appear as local changes in the work tree,
1420 which may be viewed with
1421 .Cm got diff ,
1422 amended manually or with further
1423 .Cm got backout
1424 commands,
1425 committed with
1426 .Cm got commit ,
1427 or discarded again with
1428 .Cm got revert .
1429 .Pp
1430 .Cm got backout
1431 will refuse to run if certain preconditions are not met.
1432 If the work tree contains multiple base commits it must first be updated
1433 to a single base commit with
1434 .Cm got update .
1435 If the work tree already contains files with merge conflicts, these
1436 conflicts must be resolved first.
1437 .It Cm bo
1438 Short alias for
1439 .Cm backout .
1440 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Oo Fl l Oc Oo Fl X Oc Op Ar branch
1441 Rebase commits on the specified
1442 .Ar branch
1443 onto the tip of the current branch of the work tree.
1444 The
1445 .Ar branch
1446 must share common ancestry with the work tree's current branch.
1447 Rebasing begins with the first descendant commit of the youngest
1448 common ancestor commit shared by the specified
1449 .Ar branch
1450 and the work tree's current branch, and stops once the tip commit
1451 of the specified
1452 .Ar branch
1453 has been rebased.
1454 .Pp
1455 When
1456 .Cm got rebase
1457 is used as intended, the specified
1458 .Ar branch
1459 represents a local commit history and may already contain changes
1460 that are not yet visible in any other repositories.
1461 The work tree's current branch, which must be set with
1462 .Cm got update -b
1463 before starting the
1464 .Cm rebase
1465 operation, represents a branch from a remote repository which shares
1466 a common history with the specified
1467 .Ar branch
1468 but has progressed, and perhaps diverged, due to commits added to the
1469 remote repository.
1470 .Pp
1471 Rebased commits are accumulated on a temporary branch which the work tree
1472 will remain switched to throughout the entire rebase operation.
1473 Commits on this branch represent the same changes with the same log
1474 messages as their counterparts on the original
1475 .Ar branch ,
1476 but with different commit IDs.
1477 Once rebasing has completed successfully, the temporary branch becomes
1478 the new version of the specified
1479 .Ar branch
1480 and the work tree is automatically switched to it.
1481 .Pp
1482 Old commits in their pre-rebase state are automatically backed up in the
1483 .Dq refs/got/backup/rebase
1484 reference namespace.
1485 As long as these references are not removed older versions of rebased
1486 commits will remain in the repository and can be viewed with the
1487 .Cm got rebase -l
1488 command.
1489 Removal of these references makes objects which become unreachable via
1490 any reference subject to removal by Git's garbage collector or
1491 .Cm gotadmin cleanup .
1492 .Pp
1493 While rebasing commits, show the status of each affected file,
1494 using the following status codes:
1495 .Bl -column YXZ description
1496 .It G Ta file was merged
1497 .It C Ta file was merged and conflicts occurred during merge
1498 .It ! Ta changes destined for a missing file were not merged
1499 .It D Ta file was deleted
1500 .It d Ta file's deletion was obstructed by local modifications
1501 .It A Ta new file was added
1502 .It \(a~ Ta changes destined for a non-regular file were not merged
1503 .It ? Ta changes destined for an unversioned file were not merged
1504 .El
1505 .Pp
1506 If merge conflicts occur the rebase operation is interrupted and may
1507 be continued once conflicts have been resolved.
1508 Alternatively, the rebase operation may be aborted which will leave
1509 .Ar branch
1510 unmodified and the work tree switched back to its original branch.
1511 .Pp
1512 If a merge conflict is resolved in a way which renders the merged
1513 change into a no-op change, the corresponding commit will be elided
1514 when the rebase operation continues.
1515 .Pp
1516 .Cm got rebase
1517 will refuse to run if certain preconditions are not met.
1518 If the work tree is not yet fully updated to the tip commit of its
1519 branch then the work tree must first be updated with
1520 .Cm got update .
1521 If changes have been staged with
1522 .Cm got stage ,
1523 these changes must first be committed with
1524 .Cm got commit
1525 or unstaged with
1526 .Cm got unstage .
1527 If the work tree contains local changes, these changes must first be
1528 committed with
1529 .Cm got commit
1530 or reverted with
1531 .Cm got revert .
1532 If the
1533 .Ar branch
1534 contains changes to files outside of the work tree's path prefix,
1535 the work tree cannot be used to rebase this branch.
1536 .Pp
1537 The
1538 .Cm got update
1539 and
1540 .Cm got commit
1541 commands will refuse to run while a rebase operation is in progress.
1542 Other commands which manipulate the work tree may be used for
1543 conflict resolution purposes.
1544 .Pp
1545 The options for
1546 .Cm got rebase
1547 are as follows:
1548 .Bl -tag -width Ds
1549 .It Fl a
1550 Abort an interrupted rebase operation.
1551 If this option is used, no other command-line arguments are allowed.
1552 .It Fl c
1553 Continue an interrupted rebase operation.
1554 If this option is used, no other command-line arguments are allowed.
1555 .It Fl l
1556 Show a list of past rebase operations, represented by references in the
1557 .Dq refs/got/backup/rebase
1558 reference namespace.
1559 .Pp
1560 Display the author, date, and log message of each backed up commit,
1561 the object ID of the corresponding post-rebase commit, and
1562 the object ID of their common ancestor commit.
1563 Given these object IDs,
1564 the
1565 .Cm got log
1566 command with the
1567 .Fl c
1568 and
1569 .Fl x
1570 options can be used to examine the history of either version of the branch,
1571 and the
1572 .Cm got branch
1573 command with the
1574 .Fl c
1575 option can be used to create a new branch from a pre-rebase state if desired.
1576 .Pp
1577 If a
1578 .Ar branch
1579 is specified, only show commits which at some point in time represented this
1580 branch.
1581 Otherwise, list all backed up commits for any branches.
1582 .Pp
1583 If this option is used,
1584 .Cm got rebase
1585 does not require a work tree.
1586 None of the other options can be used together with
1587 .Fl l .
1588 .It Fl X
1589 Delete backups created by past rebase operations, represented by references
1590 in the
1591 .Dq refs/got/backup/rebase
1592 reference namespace.
1593 .Pp
1594 If a
1595 .Ar branch
1596 is specified, only delete backups which at some point in time represented
1597 this branch.
1598 Otherwise, delete all references found within
1599 .Dq refs/got/backup/rebase .
1600 .Pp
1601 Any commit, tree, tag, and blob objects belonging to deleted backups
1602 remain in the repository and may be removed separately with
1603 Git's garbage collector or
1604 .Cm gotadmin cleanup .
1605 .Pp
1606 If this option is used,
1607 .Cm got rebase
1608 does not require a work tree.
1609 None of the other options can be used together with
1610 .Fl X .
1611 .El
1612 .It Cm rb
1613 Short alias for
1614 .Cm rebase .
1615 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl f Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc Oo Fl l Oc Oo Fl X Oc Op Ar branch
1616 Edit commit history between the work tree's current base commit and
1617 the tip commit of the work tree's current branch.
1618 .Pp
1619 Before starting a
1620 .Cm histedit
1621 operation the work tree's current branch must be set with
1622 .Cm got update -b
1623 to the branch which should be edited, unless this branch is already the
1624 current branch of the work tree.
1625 The tip of this branch represents the upper bound (inclusive) of commits
1626 touched by the
1627 .Cm histedit
1628 operation.
1629 .Pp
1630 Furthermore, the work tree's base commit
1631 must be set with
1632 .Cm got update -c
1633 to a point in this branch's commit history where editing should begin.
1634 This commit represents the lower bound (non-inclusive) of commits touched
1635 by the
1636 .Cm histedit
1637 operation.
1638 .Pp
1639 Editing of commit history is controlled via a
1640 .Ar histedit script
1641 which can be written in an editor based on a template, passed on the
1642 command line, or generated with the
1643 .Fl f
1645 .Fl m
1646 options.
1647 .Pp
1648 The format of the histedit script is line-based.
1649 Each line in the script begins with a command name, followed by
1650 whitespace and an argument.
1651 For most commands, the expected argument is a commit ID SHA1 hash.
1652 Any remaining text on the line is ignored.
1653 Lines which begin with the
1654 .Sq #
1655 character are ignored entirely.
1656 .Pp
1657 The available commands are as follows:
1658 .Bl -column YXZ pick-commit
1659 .It pick Ar commit Ta Use the specified commit as it is.
1660 .It edit Ar commit Ta Use the specified commit but once changes have been
1661 merged into the work tree interrupt the histedit operation for amending.
1662 .It fold Ar commit Ta Combine the specified commit with the next commit
1663 listed further below that will be used.
1664 .It drop Ar commit Ta Remove this commit from the edited history.
1665 .It mesg Ar log-message Ta Use the specified single-line log message for
1666 the commit on the previous line.
1667 If the log message argument is left empty, open an editor where a new
1668 log message can be written.
1669 .El
1670 .Pp
1671 Every commit in the history being edited must be mentioned in the script.
1672 Lines may be re-ordered to change the order of commits in the edited history.
1673 No commit may be listed more than once.
1674 .Pp
1675 Edited commits are accumulated on a temporary branch which the work tree
1676 will remain switched to throughout the entire histedit operation.
1677 Once history editing has completed successfully, the temporary branch becomes
1678 the new version of the work tree's branch and the work tree is automatically
1679 switched to it.
1680 .Pp
1681 Old commits in their pre-histedit state are automatically backed up in the
1682 .Dq refs/got/backup/histedit
1683 reference namespace.
1684 As long as these references are not removed older versions of edited
1685 commits will remain in the repository and can be viewed with the
1686 .Cm got histedit -l
1687 command.
1688 Removal of these references makes objects which become unreachable via
1689 any reference subject to removal by Git's garbage collector or
1690 .Cm gotadmin cleanup .
1691 .Pp
1692 While merging commits, show the status of each affected file,
1693 using the following status codes:
1694 .Bl -column YXZ description
1695 .It G Ta file was merged
1696 .It C Ta file was merged and conflicts occurred during merge
1697 .It ! Ta changes destined for a missing file were not merged
1698 .It D Ta file was deleted
1699 .It d Ta file's deletion was obstructed by local modifications
1700 .It A Ta new file was added
1701 .It \(a~ Ta changes destined for a non-regular file were not merged
1702 .It ? Ta changes destined for an unversioned file were not merged
1703 .El
1704 .Pp
1705 If merge conflicts occur the histedit operation is interrupted and may
1706 be continued once conflicts have been resolved.
1707 Alternatively, the histedit operation may be aborted which will leave
1708 the work tree switched back to its original branch.
1709 .Pp
1710 If a merge conflict is resolved in a way which renders the merged
1711 change into a no-op change, the corresponding commit will be elided
1712 when the histedit operation continues.
1713 .Pp
1714 .Cm got histedit
1715 will refuse to run if certain preconditions are not met.
1716 If the work tree's current branch is not in the
1717 .Dq refs/heads/
1718 reference namespace, the history of the branch may not be edited.
1719 If the work tree contains multiple base commits it must first be updated
1720 to a single base commit with
1721 .Cm got update .
1722 If changes have been staged with
1723 .Cm got stage ,
1724 these changes must first be committed with
1725 .Cm got commit
1726 or unstaged with
1727 .Cm got unstage .
1728 If the work tree contains local changes, these changes must first be
1729 committed with
1730 .Cm got commit
1731 or reverted with
1732 .Cm got revert .
1733 If the edited history contains changes to files outside of the work tree's
1734 path prefix, the work tree cannot be used to edit the history of this branch.
1735 .Pp
1736 The
1737 .Cm got update ,
1738 .Cm got rebase ,
1739 and
1740 .Cm got integrate
1741 commands will refuse to run while a histedit operation is in progress.
1742 Other commands which manipulate the work tree may be used, and the
1743 .Cm got commit
1744 command may be used to commit arbitrary changes to the temporary branch
1745 while the histedit operation is interrupted.
1746 .Pp
1747 The options for
1748 .Cm got histedit
1749 are as follows:
1750 .Bl -tag -width Ds
1751 .It Fl a
1752 Abort an interrupted histedit operation.
1753 If this option is used, no other command-line arguments are allowed.
1754 .It Fl c
1755 Continue an interrupted histedit operation.
1756 If this option is used, no other command-line arguments are allowed.
1757 .It Fl f
1758 Fold all commits into a single commit.
1759 This option is a quick equivalent to a histedit script which folds all
1760 commits, combining them all into one commit.
1761 The
1762 .Fl f
1763 option can only be used when starting a new histedit operation.
1764 If this option is used, no other command-line arguments are allowed.
1765 .It Fl F Ar histedit-script
1766 Use the specified
1767 .Ar histedit-script
1768 instead of opening a temporary file in an editor where a histedit script
1769 can be written.
1770 .It Fl m
1771 Edit log messages only.
1772 This option is a quick equivalent to a histedit script which edits
1773 only log messages but otherwise leaves every picked commit as-is.
1774 The
1775 .Fl m
1776 option can only be used when starting a new histedit operation.
1777 If this option is used, no other command-line arguments are allowed.
1778 .It Fl l
1779 Show a list of past histedit operations, represented by references in the
1780 .Dq refs/got/backup/histedit
1781 reference namespace.
1782 .Pp
1783 Display the author, date, and log message of each backed up commit,
1784 the object ID of the corresponding post-histedit commit, and
1785 the object ID of their common ancestor commit.
1786 Given these object IDs,
1787 the
1788 .Cm got log
1789 command with the
1790 .Fl c
1791 and
1792 .Fl x
1793 options can be used to examine the history of either version of the branch,
1794 and the
1795 .Cm got branch
1796 command with the
1797 .Fl c
1798 option can be used to create a new branch from a pre-histedit state if desired.
1799 .Pp
1800 If a
1801 .Ar branch
1802 is specified, only show commits which at some point in time represented this
1803 branch.
1804 Otherwise, list all backed up commits for any branches.
1805 .Pp
1806 If this option is used,
1807 .Cm got histedit
1808 does not require a work tree.
1809 None of the other options can be used together with
1810 .Fl l .
1811 .It Fl X
1812 Delete backups created by past histedit operations, represented by references
1813 in the
1814 .Dq refs/got/backup/histedit
1815 reference namespace.
1816 .Pp
1817 If a
1818 .Ar branch
1819 is specified, only delete backups which at some point in time represented
1820 this branch.
1821 Otherwise, delete all references found within
1822 .Dq refs/got/backup/histedit .
1823 .Pp
1824 Any commit, tree, tag, and blob objects belonging to deleted backups
1825 remain in the repository and may be removed separately with
1826 Git's garbage collector or
1827 .Cm gotadmin cleanup .
1828 .Pp
1829 If this option is used,
1830 .Cm got histedit
1831 does not require a work tree.
1832 None of the other options can be used together with
1833 .Fl X .
1834 .El
1835 .It Cm he
1836 Short alias for
1837 .Cm histedit .
1838 .It Cm integrate Ar branch
1839 Integrate the specified
1840 .Ar branch
1841 into the work tree's current branch.
1842 Files in the work tree are updated to match the contents on the integrated
1843 .Ar branch ,
1844 and the reference of the work tree's branch is changed to point at the
1845 head commit of the integrated
1846 .Ar branch .
1847 .Pp
1848 Both branches can be considered equivalent after integration since they
1849 will be pointing at the same commit.
1850 Both branches remain available for future work, if desired.
1851 In case the integrated
1852 .Ar branch
1853 is no longer needed it may be deleted with
1854 .Cm got branch -d .
1855 .Pp
1856 Show the status of each affected file, using the following status codes:
1857 .Bl -column YXZ description
1858 .It U Ta file was updated
1859 .It D Ta file was deleted
1860 .It A Ta new file was added
1861 .It \(a~ Ta versioned file is obstructed by a non-regular file
1862 .It ! Ta a missing versioned file was restored
1863 .El
1864 .Pp
1865 .Cm got integrate
1866 will refuse to run if certain preconditions are not met.
1867 Most importantly, the
1868 .Ar branch
1869 must have been rebased onto the work tree's current branch with
1870 .Cm got rebase
1871 before it can be integrated, in order to linearize commit history and
1872 resolve merge conflicts.
1873 If the work tree contains multiple base commits it must first be updated
1874 to a single base commit with
1875 .Cm got update .
1876 If changes have been staged with
1877 .Cm got stage ,
1878 these changes must first be committed with
1879 .Cm got commit
1880 or unstaged with
1881 .Cm got unstage .
1882 If the work tree contains local changes, these changes must first be
1883 committed with
1884 .Cm got commit
1885 or reverted with
1886 .Cm got revert .
1887 .It Cm ig
1888 Short alias for
1889 .Cm integrate .
1890 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl S Oc Op Ar path ...
1891 Stage local changes for inclusion in the next commit.
1892 If no
1893 .Ar path
1894 is specified, stage all changes in the work tree.
1895 Otherwise, stage changes at or within the specified paths.
1896 Paths may be staged if they are added, modified, or deleted according to
1897 .Cm got status .
1898 .Pp
1899 Show the status of each affected file, using the following status codes:
1900 .Bl -column YXZ description
1901 .It A Ta file addition has been staged
1902 .It M Ta file modification has been staged
1903 .It D Ta file deletion has been staged
1904 .El
1905 .Pp
1906 Staged file contents are saved in newly created blob objects in the repository.
1907 These blobs will be referred to by tree objects once staged changes have been
1908 committed.
1909 .Pp
1910 Staged changes affect the behaviour of
1911 .Cm got commit ,
1912 .Cm got status ,
1913 and
1914 .Cm got diff .
1915 While paths with staged changes exist, the
1916 .Cm got commit
1917 command will refuse to commit any paths which do not have staged changes.
1918 Local changes created on top of staged changes can only be committed if
1919 the path is staged again, or if the staged changes are committed first.
1920 The
1921 .Cm got status
1922 command will show both local changes and staged changes.
1923 The
1924 .Cm got diff
1925 command is able to display local changes relative to staged changes,
1926 and to display staged changes relative to the repository.
1927 The
1928 .Cm got revert
1929 command cannot revert staged changes but may be used to revert
1930 local changes created on top of staged changes.
1931 .Pp
1932 The options for
1933 .Cm got stage
1934 are as follows:
1935 .Bl -tag -width Ds
1936 .It Fl l
1937 Instead of staging new changes, list paths which are already staged,
1938 along with the IDs of staged blob objects and stage status codes.
1939 If paths were provided in the command line show the staged paths
1940 among the specified paths.
1941 Otherwise, show all staged paths.
1942 .It Fl p
1943 Instead of staging the entire content of a changed file, interactively
1944 select or reject changes for staging based on
1945 .Dq y
1946 (stage change),
1947 .Dq n
1948 (reject change), and
1949 .Dq q
1950 (quit staging this file) responses.
1951 If a file is in modified status, individual patches derived from the
1952 modified file content can be staged.
1953 Files in added or deleted status may only be staged or rejected in
1954 their entirety.
1955 .It Fl F Ar response-script
1956 With the
1957 .Fl p
1958 option, read
1959 .Dq y ,
1960 .Dq n ,
1961 and
1962 .Dq q
1963 responses line-by-line from the specified
1964 .Ar response-script
1965 file instead of prompting interactively.
1966 .It Fl S
1967 Allow staging of symbolic links which point outside of the path space
1968 that is under version control.
1969 By default,
1970 .Cm got stage
1971 will reject such symbolic links due to safety concerns.
1972 As a precaution,
1973 .Nm
1974 may decide to represent such a symbolic link as a regular file which contains
1975 the link's target path, rather than creating an actual symbolic link which
1976 points outside of the work tree.
1977 Use of this option is discouraged because external mechanisms such as
1978 .Dq make obj
1979 are better suited for managing symbolic links to paths not under
1980 version control.
1981 .El
1982 .Pp
1983 .Cm got stage
1984 will refuse to run if certain preconditions are not met.
1985 If a file contains merge conflicts, these conflicts must be resolved first.
1986 If a file is found to be out of date relative to the head commit on the
1987 work tree's current branch, the file must be updated with
1988 .Cm got update
1989 before it can be staged (however, this does not prevent the file from
1990 becoming out-of-date at some point after having been staged).
1991 .Pp
1992 The
1993 .Cm got update ,
1994 .Cm got rebase ,
1995 and
1996 .Cm got histedit
1997 commands will refuse to run while staged changes exist.
1998 If staged changes cannot be committed because a staged path
1999 is out of date, the path must be unstaged with
2000 .Cm got unstage
2001 before it can be updated with
2002 .Cm got update ,
2003 and may then be staged again if necessary.
2004 .It Cm sg
2005 Short alias for
2006 .Cm stage .
2007 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
2008 Merge staged changes back into the work tree and put affected paths
2009 back into non-staged status.
2010 If no
2011 .Ar path
2012 is specified, unstage all staged changes across the entire work tree.
2013 Otherwise, unstage changes at or within the specified paths.
2014 .Pp
2015 Show the status of each affected file, using the following status codes:
2016 .Bl -column YXZ description
2017 .It G Ta file was unstaged
2018 .It C Ta file was unstaged and conflicts occurred during merge
2019 .It ! Ta changes destined for a missing file were not merged
2020 .It D Ta file was staged as deleted and still is deleted
2021 .It d Ta file's deletion was obstructed by local modifications
2022 .It \(a~ Ta changes destined for a non-regular file were not merged
2023 .El
2024 .Pp
2025 The options for
2026 .Cm got unstage
2027 are as follows:
2028 .Bl -tag -width Ds
2029 .It Fl p
2030 Instead of unstaging the entire content of a changed file, interactively
2031 select or reject changes for unstaging based on
2032 .Dq y
2033 (unstage change),
2034 .Dq n
2035 (keep change staged), and
2036 .Dq q
2037 (quit unstaging this file) responses.
2038 If a file is staged in modified status, individual patches derived from the
2039 staged file content can be unstaged.
2040 Files staged in added or deleted status may only be unstaged in their entirety.
2041 .It Fl F Ar response-script
2042 With the
2043 .Fl p
2044 option, read
2045 .Dq y ,
2046 .Dq n ,
2047 and
2048 .Dq q
2049 responses line-by-line from the specified
2050 .Ar response-script
2051 file instead of prompting interactively.
2052 .El
2053 .It Cm ug
2054 Short alias for
2055 .Cm unstage .
2056 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
2057 Parse and print contents of objects to standard output in a line-based
2058 text format.
2059 Content of commit, tree, and tag objects is printed in a way similar
2060 to the actual content stored in such objects.
2061 Blob object contents are printed as they would appear in files on disk.
2062 .Pp
2063 Attempt to interpret each argument as a reference, a tag name, or
2064 an object ID SHA1 hash.
2065 References will be resolved to an object ID.
2066 Tag names will resolved to a tag object.
2067 An abbreviated hash argument will be expanded to a full SHA1 hash
2068 automatically, provided the abbreviation is unique.
2069 .Pp
2070 If none of the above interpretations produce a valid result, or if the
2071 .Fl P
2072 option is used, attempt to interpret the argument as a path which will
2073 be resolved to the ID of an object found at this path in the repository.
2074 .Pp
2075 The options for
2076 .Cm got cat
2077 are as follows:
2078 .Bl -tag -width Ds
2079 .It Fl c Ar commit
2080 Look up paths in the specified
2081 .Ar commit .
2082 If this option is not used, paths are looked up in the commit resolved
2083 via the repository's HEAD reference.
2084 The expected argument is a commit ID SHA1 hash or an existing reference
2085 or tag name which will be resolved to a commit ID.
2086 An abbreviated hash argument will be expanded to a full SHA1 hash
2087 automatically, provided the abbreviation is unique.
2088 .It Fl r Ar repository-path
2089 Use the repository at the specified path.
2090 If not specified, assume the repository is located at or above the current
2091 working directory.
2092 If this directory is a
2093 .Nm
2094 work tree, use the repository path associated with this work tree.
2095 .It Fl P
2096 Interpret all arguments as paths only.
2097 This option can be used to resolve ambiguity in cases where paths
2098 look like tag names, reference names, or object IDs.
2099 .El
2100 .It Cm info Op Ar path ...
2101 Display meta-data stored in a work tree.
2102 See
2103 .Xr got-worktree 5
2104 for details.
2105 .Pp
2106 The work tree to use is resolved implicitly by walking upwards from the
2107 current working directory.
2108 .Pp
2109 If one or more
2110 .Ar path
2111 arguments are specified, show additional per-file information for tracked
2112 files located at or within these paths.
2113 If a
2114 .Ar path
2115 argument corresponds to the work tree's root directory, display information
2116 for all tracked files.
2117 .El
2118 .Sh ENVIRONMENT
2119 .Bl -tag -width GOT_AUTHOR
2120 .It Ev GOT_AUTHOR
2121 The author's name and email address for
2122 .Cm got commit
2123 and
2124 .Cm got import ,
2125 for example:
2126 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
2127 Because
2128 .Xr git 1
2129 may fail to parse commits without an email address in author data,
2130 .Nm
2131 attempts to reject
2132 .Ev GOT_AUTHOR
2133 environment variables with a missing email address.
2134 .Pp
2135 .Ev GOT_AUTHOR will be overriden by configuration settings in
2136 .Xr got.conf 5
2137 or by Git's
2138 .Dv user.name
2139 and
2140 .Dv user.email
2141 configuration settings in the repository's
2142 .Pa .git/config
2143 file.
2144 The
2145 .Dv user.name
2146 and
2147 .Dv user.email
2148 configuration settings contained in Git's global
2149 .Pa ~/.gitconfig
2150 configuration file will only be used if neither
2151 .Xr got.conf 5
2152 nor the
2153 .Ev GOT_AUTHOR
2154 environment variable provide author information.
2155 .It Ev VISUAL , EDITOR
2156 The editor spawned by
2157 .Cm got commit ,
2158 .Cm got histedit ,
2159 .Cm got import ,
2161 .Cm got tag .
2162 If not set, the
2163 .Xr ed 1
2164 text editor will be spawned in order to give
2165 .Xr ed 1
2166 the attention it deserves.
2167 .It Ev GOT_LOG_DEFAULT_LIMIT
2168 The default limit on the number of commits traversed by
2169 .Cm got log .
2170 If set to zero, the limit is unbounded.
2171 This variable will be silently ignored if it is set to a non-numeric value.
2172 .El
2173 .Sh FILES
2174 .Bl -tag -width packed-refs -compact
2175 .It Pa got.conf
2176 Repository-wide configuration settings for
2177 .Nm .
2178 If present, a
2179 .Xr got.conf 5
2180 configuration file located in the root directory of a Git repository
2181 supersedes any relevant settings in Git's
2182 .Pa config
2183 file.
2184 .Pp
2185 .It Pa .got/got.conf
2186 Worktree-specific configuration settings for
2187 .Nm .
2188 If present, a
2189 .Xr got.conf 5
2190 configuration file in the
2191 .Pa .got
2192 meta-data directory of a work tree supersedes any relevant settings in
2193 the repository's
2194 .Xr got.conf 5
2195 configuration file and Git's
2196 .Pa config
2197 file.
2198 .El
2199 .Sh EXIT STATUS
2200 .Ex -std got
2201 .Sh EXAMPLES
2202 Clone an existing Git repository for use with
2203 .Nm .
2204 .Pp
2205 .Dl $ cd /var/git/
2206 .Dl $ got clone ssh://git@github.com/openbsd/src.git
2207 .Pp
2208 Use of HTTP URLs currently requires
2209 .Xr git 1 :
2210 .Pp
2211 .Dl $ cd /var/git/
2212 .Dl $ git clone --bare https://github.com/openbsd/src.git
2213 .Pp
2214 Alternatively, for quick and dirty local testing of
2215 .Nm
2216 a new Git repository could be created and populated with files,
2217 e.g. from a temporary CVS checkout located at
2218 .Pa /tmp/src :
2219 .Pp
2220 .Dl $ got init /var/git/src.git
2221 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
2222 .Pp
2223 Check out a work tree from the Git repository to /usr/src:
2224 .Pp
2225 .Dl $ got checkout /var/git/src.git /usr/src
2226 .Pp
2227 View local changes in a work tree directory:
2228 .Pp
2229 .Dl $ got diff | less
2230 .Pp
2231 In a work tree, display files in a potentially problematic state:
2232 .Pp
2233 .Dl $ got status -s 'C!~?'
2234 .Pp
2235 Interactively revert selected local changes in a work tree directory:
2236 .Pp
2237 .Dl $ got revert -p -R\ .
2238 .Pp
2239 In a work tree or a git repository directory, list all branch references:
2240 .Pp
2241 .Dl $ got branch -l
2242 .Pp
2243 In a work tree or a git repository directory, create a new branch called
2244 .Dq unified-buffer-cache
2245 which is forked off the
2246 .Dq master
2247 branch:
2248 .Pp
2249 .Dl $ got branch -c master unified-buffer-cache
2250 .Pp
2251 Switch an existing work tree to the branch
2252 .Dq unified-buffer-cache .
2253 Local changes in the work tree will be preserved and merged if necessary:
2254 .Pp
2255 .Dl $ got update -b unified-buffer-cache
2256 .Pp
2257 Create a new commit from local changes in a work tree directory.
2258 This new commit will become the head commit of the work tree's current branch:
2259 .Pp
2260 .Dl $ got commit
2261 .Pp
2262 In a work tree or a git repository directory, view changes committed in
2263 the 3 most recent commits to the work tree's branch, or the branch resolved
2264 via the repository's HEAD reference, respectively:
2265 .Pp
2266 .Dl $ got log -p -l 3
2267 .Pp
2268 As above, but display changes in the order in which
2269 .Xr patch 1
2270 could apply them in sequence:
2271 .Pp
2272 .Dl $ got log -p -l 3 -R
2273 .Pp
2274 In a work tree or a git repository directory, log the history of a subdirectory:
2275 .Pp
2276 .Dl $ got log sys/uvm
2277 .Pp
2278 While operating inside a work tree, paths are specified relative to the current
2279 working directory, so this command will log the subdirectory
2280 .Pa sys/uvm :
2281 .Pp
2282 .Dl $ cd sys/uvm && got log\ .
2283 .Pp
2284 And this command has the same effect:
2285 .Pp
2286 .Dl $ cd sys/dev/usb && got log ../../uvm
2287 .Pp
2288 And this command displays work tree meta-data about all tracked files:
2289 .Pp
2290 .Dl $ cd /usr/src
2291 .Dl $ got info\ . | less
2292 .Pp
2293 Add new files and remove obsolete files in a work tree directory:
2294 .Pp
2295 .Dl $ got add sys/uvm/uvm_ubc.c
2296 .Dl $ got remove sys/uvm/uvm_vnode.c
2297 .Pp
2298 Create a new commit from local changes in a work tree directory
2299 with a pre-defined log message.
2300 .Pp
2301 .Dl $ got commit -m 'unify the buffer cache'
2302 .Pp
2303 Alternatively, create a new commit from local changes in a work tree
2304 directory with a log message that has been prepared in the file
2305 .Pa /tmp/msg :
2306 .Pp
2307 .Dl $ got commit -F /tmp/msg
2308 .Pp
2309 Update any work tree checked out from the
2310 .Dq unified-buffer-cache
2311 branch to the latest commit on this branch:
2312 .Pp
2313 .Dl $ got update
2314 .Pp
2315 Roll file content on the unified-buffer-cache branch back by one commit,
2316 and then fetch the rolled-back change into the work tree as a local change
2317 to be amended and perhaps committed again:
2318 .Pp
2319 .Dl $ got backout unified-buffer-cache
2320 .Dl $ got commit -m 'roll back previous'
2321 .Dl $ # now back out the previous backout :-)
2322 .Dl $ got backout unified-buffer-cache
2323 .Pp
2324 Fetch new upstream commits into the local repository's
2325 .Dq origin/master
2326 branch:
2327 .Pp
2328 .Dl $ cd /usr/src
2329 .Dl $ got fetch
2330 .Pp
2331 In a repository created with a HTTP URL and
2332 .Cm git clone --bare
2333 the
2334 .Xr git-fetch 1
2335 command must be used instead:
2336 .Pp
2337 .Dl $ cd /var/git/src.git
2338 .Dl $ git fetch origin master:refs/remotes/origin/master
2339 .Pp
2340 Rebase the local
2341 .Dq master
2342 branch to merge the new changes that are now visible on the
2343 .Dq origin/master
2344 branch:
2345 .Pp
2346 .Dl $ cd /usr/src
2347 .Dl $ got update -b origin/master
2348 .Dl $ got rebase master
2349 .Pp
2350 Rebase the
2351 .Dq unified-buffer-cache
2352 branch on top of the new head commit of the
2353 .Dq master
2354 branch.
2355 .Pp
2356 .Dl $ got update -b master
2357 .Dl $ got rebase unified-buffer-cache
2358 .Pp
2359 Create a patch from all changes on the unified-buffer-cache branch.
2360 The patch can be mailed out for review and applied to
2361 .Ox Ns 's
2362 CVS tree:
2363 .Pp
2364 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
2365 .Pp
2366 Edit the entire commit history of the
2367 .Dq unified-buffer-cache
2368 branch:
2369 .Pp
2370 .Dl $ got update -b unified-buffer-cache
2371 .Dl $ got update -c master
2372 .Dl $ got histedit
2373 .Pp
2374 In order to merge changes committed to the
2375 .Dq unified-buffer-cache
2376 branch back into the
2377 .Dq master
2378 branch, the
2379 .Dq unified-buffer-cache
2380 branch must first be rebased onto the
2381 .Dq master
2382 branch:
2383 .Pp
2384 .Dl $ got update -b master
2385 .Dl $ got rebase unified-buffer-cache
2386 .Pp
2387 Changes on the
2388 .Dq unified-buffer-cache
2389 branch can now be made visible on the
2390 .Dq master
2391 branch with
2392 .Cm got integrate .
2393 Because the rebase operation switched the work tree to the
2394 .Dq unified-buffer-cache
2395 branch, the work tree must be switched back to the
2396 .Dq master
2397 branch before the
2398 .Dq unified-buffer-cache
2399 branch can be integrated into
2400 .Dq master :
2401 .Pp
2402 .Dl $ got update -b master
2403 .Dl $ got integrate unified-buffer-cache
2404 .Pp
2405 Additional steps may be necessary if local changes need to be pushed back
2406 to the remote repository, which currently requires
2407 .Cm git push .
2408 Before working against existing branches in a repository cloned with
2409 .Cm git clone --bare
2410 instead of
2411 .Cm got clone ,
2412 a Git
2413 .Dq refspec
2414 must be configured to map all references in the remote repository
2415 into the
2416 .Dq refs/remotes
2417 namespace of the local repository.
2418 This can be achieved by setting Git's
2419 .Pa remote.origin.fetch
2420 configuration variable to the value
2421 .Dq +refs/heads/*:refs/remotes/origin/*
2422 with the
2423 .Cm git config
2424 command:
2425 .Pp
2426 .Dl $ cd /var/git/repo
2427 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
2428 .Pp
2429 Additionally, the
2430 .Dq mirror
2431 option must be disabled:
2432 .Pp
2433 .Dl $ cd /var/git/repo
2434 .Dl $ git config remote.origin.mirror false
2435 .Pp
2436 Alternatively, the following
2437 .Xr git-fetch 1
2438 configuration item can be added manually to the Git repository's
2439 .Pa config
2440 file:
2441 .Pp
2442 .Dl [remote \&"origin\&"]
2443 .Dl url = ...
2444 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
2445 .Dl mirror = false
2446 .Pp
2447 This configuration leaves the local repository's
2448 .Dq refs/heads
2449 namespace free for use by local branches checked out with
2450 .Cm got checkout
2451 and, if needed, created with
2452 .Cm got branch .
2453 .Pp
2454 Branches in the
2455 .Dq remotes/origin
2456 namespace can now be updated with incoming changes from the remote
2457 repository with
2458 .Cm got fetch
2460 .Xr git-fetch 1
2461 without extra command line arguments:
2462 .Pp
2463 .Dl $ cd /var/git/repo
2464 .Dl $ git fetch
2465 .Pp
2466 To make changes fetched from the remote repository appear on the
2467 .Dq master
2468 branch, the
2469 .Dq master
2470 branch must be rebased onto the
2471 .Dq origin/master
2472 branch.
2473 This will also merge local changes, if any, with the incoming changes:
2474 .Pp
2475 .Dl $ got update -b origin/master
2476 .Dl $ got rebase master
2477 .Pp
2478 On the
2479 .Dq master
2480 branch, log messages for local changes can now be amended with
2481 .Dq OK
2482 by other developers and any other important new information:
2483 .Pp
2484 .Dl $ got update -c origin/master
2485 .Dl $ got histedit -m
2486 .Pp
2487 Local changes on the
2488 .Dq master
2489 branch can then be pushed to the remote
2490 repository with
2491 .Cm git push :
2492 .Pp
2493 .Dl $ cd /var/git/repo
2494 .Dl $ git push origin master
2495 .Sh SEE ALSO
2496 .Xr gotadmin 1 ,
2497 .Xr tog 1 ,
2498 .Xr git-repository 5 ,
2499 .Xr got-worktree 5 ,
2500 .Xr got.conf 5
2501 .Sh AUTHORS
2502 .An Stefan Sperling Aq Mt stsp@openbsd.org
2503 .An Martin Pieuchot Aq Mt mpi@openbsd.org
2504 .An Joshua Stein Aq Mt jcs@openbsd.org
2505 .An Ori Bernstein Aq Mt ori@openbsd.org
2506 .Sh CAVEATS
2507 .Nm
2508 is a work-in-progress and some features remain to be implemented.
2509 .Pp
2510 At present, the user has to fall back on
2511 .Xr git 1
2512 to perform some tasks.
2513 In particular:
2514 .Bl -bullet
2515 .It
2516 Reading from remote repositories over HTTP or HTTPS protocols requires
2517 .Xr git-clone 1
2518 and
2519 .Xr git-fetch 1 .
2520 .It
2521 Writing to remote repositories, over any protocol, requires
2522 .Xr git-push 1 .
2523 .It
2524 The creation of merge commits, i.e. commits with two or more parent commits,
2525 requires
2526 .Xr git-merge 1 .
2527 .It
2528 In situations where files or directories were moved around
2529 .Cm got
2530 will not automatically merge changes to new locations and
2531 .Xr git 1
2532 will usually produce better results.
2533 .El