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