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