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