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