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