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