Blob


1 .\"
2 .\" Copyright (c) 2017 Martin Pieuchot
3 .\" Copyright (c) 2018, 2019 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 preceed the command name, and are as follows:
54 .Bl -tag -width tenletters
55 .It Fl h
56 Display usage information.
57 .El
58 .Pp
59 The commands for
60 .Nm
61 are as follows:
62 .Bl -tag -width checkout
63 .It Cm init Ar path
64 Create a new empty repository at the specified
65 .Ar path .
66 .Pp
67 After
68 .Cm got init ,
69 the
70 .Cm got import
71 command must be used to populate the empty repository before
72 .Cm got checkout
73 can be used.
74 .Pp
75 .It Cm import [ Fl b Ar branch ] [ Fl m Ar message ] [ Fl r Ar repository-path ] [ Fl I Ar pattern ] directory
76 Create an initial commit in a repository from the file hierarchy
77 within the specified
78 .Ar directory .
79 The created commit will not have any parent commits, i.e. it will be a
80 root commit.
81 Also create a new reference which provides a branch name for the newly
82 created commit.
83 Show the path of each imported file to indicate progress.
84 .Pp
85 The
86 .Cm got import
87 command requires the
88 .Ev GOT_AUTHOR
89 environment variable to be set.
90 .Pp
91 The options for
92 .Cm got import
93 are as follows:
94 .Bl -tag -width Ds
95 .It Fl b Ar branch
96 Create the specified
97 .Ar branch
98 instead of creating the default branch
99 .Dq master .
100 Use of this option is required if the
101 .Dq master
102 branch already exists.
103 .It Fl m Ar message
104 Use the specified log message when creating the new commit.
105 Without the
106 .Fl m
107 option,
108 .Cm got import
109 opens a temporary file in an editor where a log message can be written.
110 .It Fl r Ar repository-path
111 Use the repository at the specified path.
112 If not specified, assume the repository is located at or above the current
113 working directory.
114 .It Fl I Ar pattern
115 Ignore files or directories with a name which matches the specified
116 .Ar pattern .
117 This option may be specified multiple times to build a list of ignore patterns.
118 The
119 .Ar pattern
120 follows the globbing rules documented in
121 .Xr glob 7 .
122 .El
123 .It Cm checkout [ Fl b Ar branch ] [ Fl c Ar commit ] [ Fl p Ar path-prefix ] repository-path [ work-tree-path ]
124 Copy files from a repository into a new work tree.
125 If the
126 .Ar work tree path
127 is not specified, either use the last component of
128 .Ar repository path ,
129 or if a
130 .Ar path prefix
131 was specified use the last component of
132 .Ar path prefix .
133 .Pp
134 The options for
135 .Cm got checkout
136 are as follows:
137 .Bl -tag -width Ds
138 .It Fl b Ar branch
139 Check out files from the specified
140 .Ar branch .
141 If this option is not specified, a branch resolved via the repository's HEAD
142 reference will be used.
143 .It Fl c Ar commit
144 Check out files from the specified
145 .Ar commit .
146 The expected argument is a commit ID SHA1 hash.
147 An abbreviated hash argument will be expanded to a full SHA1 hash
148 automatically, provided the abbreviation is unique.
149 If this option is not specified, the most recent commit on the selected
150 branch will be used.
151 .It Fl p Ar path-prefix
152 Restrict the work tree to a subset of the repository's tree hierarchy.
153 Only files beneath the specified
154 .Ar path-prefix
155 will be checked out.
156 .El
157 .It Cm co
158 Short alias for
159 .Cm checkout .
160 .It Cm update [ Fl b Ar branch ] [ Fl c Ar commit ] [ Ar path ]
161 Update an existing work tree to a different commit.
162 Show the status of each affected file, using the following status codes:
163 .Bl -column YXZ description
164 .It U Ta file was updated and contained no local changes
165 .It G Ta file was updated and local changes were merged cleanly
166 .It C Ta file was updated and conflicts occurred during merge
167 .It D Ta file was deleted
168 .It A Ta new file was added
169 .It ~ Ta versioned file is obstructed by a non-regular file
170 .It ! Ta a missing versioned file was restored
171 .El
172 .Pp
173 If a
174 .Ar path
175 is specified, restrict the update operation to files at or within this path.
176 The path is required to exist in the update operation's target commit.
177 Files in the work tree outside this path will remain unchanged and will
178 retain their previously recorded base commit.
179 Some
180 .Nm
181 commands may refuse to run while the work tree contains files from
182 multiple base commits.
183 The base commit of such a work tree can be made consistent by running
184 .Cm got update
185 across the entire work tree.
186 Specifying a
187 .Ar path
188 is incompatible with the
189 .Fl b
190 option.
191 .Pp
192 The options for
193 .Cm got update
194 are as follows:
195 .Bl -tag -width Ds
196 .It Fl b Ar branch
197 Switch the work tree's branch reference to the specified
198 .Ar branch
199 before updating the work tree.
200 This option requires that all paths in the work tree are updated.
201 .It Fl c Ar commit
202 Update the work tree to the specified
203 .Ar commit .
204 The expected argument is a commit ID SHA1 hash.
205 An abbreviated hash argument will be expanded to a full SHA1 hash
206 automatically, provided the abbreviation is unique.
207 If this option is not specified, the most recent commit on the work tree's
208 branch will be used.
209 .El
210 .It Cm up
211 Short alias for
212 .Cm update .
213 .It Cm status [ Ar path ]
214 Show the current modification status of files in a work tree,
215 using the following status codes:
216 .Bl -column YXZ description
217 .It M Ta modified file
218 .It A Ta file scheduled for addition in next commit
219 .It D Ta file scheduled for deletion in next commit
220 .It C Ta modified or added file which contains merge conflicts
221 .It ! Ta versioned file was expected on disk but is missing
222 .It ~ Ta versioned file is obstructed by a non-regular file
223 .It ? Ta unversioned item not tracked by
224 .Nm
225 .El
226 .Pp
227 If a
228 .Ar path
229 is specified, only show modifications within this path.
230 .It Cm st
231 Short alias for
232 .Cm status .
233 .It Cm log [ Fl c Ar commit ] [ Fl C Ar number ] [ Fl f ] [ Fl l Ar N ] [ Fl p ] [ Fl r Ar repository-path ] [ path ]
234 Display history of a repository.
235 If a
236 .Ar path
237 is specified, show only commits which modified this path.
238 .Pp
239 The options for
240 .Cm got log
241 are as follows:
242 .Bl -tag -width Ds
243 .It Fl c Ar commit
244 Start traversing history at the specified
245 .Ar commit .
246 The expected argument is the name of a branch or a commit ID SHA1 hash.
247 An abbreviated hash argument will be expanded to a full SHA1 hash
248 automatically, provided the abbreviation is unique.
249 If this option is not specified, default to the work tree's current branch
250 if invoked in a work tree, or to the repository's HEAD reference.
251 .It Fl C Ar number
252 Set the number of context lines shown in diffs with
253 .Fl p .
254 By default, 3 lines of context are shown.
255 .It Fl f
256 Restrict history traversal to the first parent of each commit.
257 This shows the linear history of the current branch only.
258 Merge commits which affected the current branch will be shown but
259 individual commits which originated on other branches will be omitted.
260 .It Fl l Ar N
261 Limit history traversal to a given number of commits.
262 .It Fl p
263 Display the patch of modifications made in each commit.
264 .It Fl r Ar repository-path
265 Use the repository at the specified path.
266 If not specified, assume the repository is located at or above the current
267 working directory.
268 If this directory is a
269 .Nm
270 work tree, use the repository path associated with this work tree.
271 .El
272 .It Cm diff [ Fl C Ar number ] [ Fl r Ar repository-path ] [ Ar object1 Ar object2 | Ar path ]
273 When invoked within a work tree with less than two arguments, display
274 uncommitted changes in the work tree.
275 If a
276 .Ar path
277 is specified, only show changes within this path.
278 .Pp
279 If two arguments are provided, treat each argument as a reference,
280 or an object ID SHA1 hash, and display differences between these objects.
281 Both objects must be of the same type (blobs, trees, or commits).
282 An abbreviated hash argument will be expanded to a full SHA1 hash
283 automatically, provided the abbreviation is unique.
284 .Pp
285 The options for
286 .Cm got diff
287 are as follows:
288 .Bl -tag -width Ds
289 .It Fl C Ar number
290 Set the number of context lines shown in the diff.
291 By default, 3 lines of context are shown.
292 .It Fl r Ar repository-path
293 Use the repository at the specified path.
294 If not specified, assume the repository is located at or above the current
295 working directory.
296 If this directory is a
297 .Nm
298 work tree, use the repository path associated with this work tree.
299 .El
300 .It Cm blame [ Fl c Ar commit ] [ Fl r Ar repository-path ] Ar path
301 Display line-by-line history of a file at the specified path.
302 .Pp
303 The options for
304 .Cm got blame
305 are as follows:
306 .Bl -tag -width Ds
307 .It Fl c Ar commit
308 Start traversing history at the specified
309 .Ar commit .
310 The expected argument is the name of a branch or a commit ID SHA1 hash.
311 An abbreviated hash argument will be expanded to a full SHA1 hash
312 automatically, provided the abbreviation is unique.
313 .It Fl r Ar repository-path
314 Use the repository at the specified path.
315 If not specified, assume the repository is located at or above the current
316 working directory.
317 If this directory is a
318 .Nm
319 work tree, use the repository path associated with this work tree.
320 .El
321 .It Cm tree [ Fl c Ar commit ] [ Fl r Ar repository-path ] [ Fl i ] [ Fl R] [ Ar path ]
322 Display a listing of files and directories at the specified
323 directory path in the repository.
324 Entries shown in this listing may carry one of the following trailing
325 annotations:
326 .Bl -column YXZ description
327 .It / Ta entry is a directory
328 .It * Ta entry is an executable file
329 .El
330 .Pp
331 If no
332 .Ar path
333 is specified, list the repository path corresponding to the current
334 directory of the work tree, or the root directory of the repository
335 if there is no work tree.
336 .Pp
337 The options for
338 .Cm got tree
339 are as follows:
340 .Bl -tag -width Ds
341 .It Fl c Ar commit
342 List files and directories as they appear in the specified
343 .Ar commit .
344 The expected argument is the name of a branch or a commit ID SHA1 hash.
345 An abbreviated hash argument will be expanded to a full SHA1 hash
346 automatically, provided the abbreviation is unique.
347 .It Fl r Ar repository-path
348 Use the repository at the specified path.
349 If not specified, assume the repository is located at or above the current
350 working directory.
351 If this directory is a
352 .Nm
353 work tree, use the repository path associated with this work tree.
354 .It Fl i
355 Show object IDs of files (blob objects) and directories (tree objects).
356 .It Fl R
357 Recurse into sub-directories in the repository.
358 .El
359 .It Cm ref [ Fl r Ar repository-path ] [ Fl l ] [ Fl d Ar name ] [ Ar name Ar target ]
360 Manage references in a repository.
361 .Pp
362 If no options are passed, expect two arguments and attempt to create,
363 or update, the reference with the given
364 .Ar name ,
365 and make it point at the given
366 .Ar target .
367 The target may be an object ID SHA1 hash or an existing reference which
368 will be resolved to an object ID.
369 An abbreviated hash argument will be expanded to a full SHA1 hash
370 automatically, provided the abbreviation is unique.
371 .Pp
372 The options for
373 .Cm got ref
374 are as follows:
375 .Bl -tag -width Ds
376 .It Fl r Ar repository-path
377 Use the repository at the specified path.
378 If not specified, assume the repository is located at or above the current
379 working directory.
380 If this directory is a
381 .Nm
382 work tree, use the repository path associated with this work tree.
383 .It Fl l
384 List all existing references in the repository.
385 .It Fl d Ar name
386 Delete the reference with the specified name from the repository.
387 .El
388 .It Cm branch [ Fl r Ar repository-path ] [ Fl l ] [ Fl d Ar name ] [ Ar name [ Ar base-branch ] ]
389 Manage branches in a repository.
390 .Pp
391 Branches are managed via references which live in the
392 .Dq refs/heads/
393 reference namespace.
394 The
395 .Cm got branch
396 command operates on references in this namespace only.
397 .Pp
398 If no options are passed, expect one or two arguments and attempt to create
399 a branch with the given
400 .Ar name ,
401 and make it point at the given
402 .Ar base-branch .
403 If no
404 .Ar base-branch
405 is specified, default to the work tree's current branch if invoked in a
406 work tree, or to the repository's HEAD reference.
407 .Pp
408 The options for
409 .Cm got branch
410 are as follows:
411 .Bl -tag -width Ds
412 .It Fl r Ar repository-path
413 Use the repository at the specified path.
414 If not specified, assume the repository is located at or above the current
415 working directory.
416 If this directory is a
417 .Nm
418 work tree, use the repository path associated with this work tree.
419 .It Fl l
420 List all existing branches in the repository.
421 .Pp
422 If invoked in a work tree, the work tree's current branch is shown
423 with one the following annotations:
424 .Bl -column YXZ description
425 .It * Ta work tree's base commit matches the branch tip
426 .It ~ Ta work tree's base commit is out-of-date
427 .El
428 .It Fl d Ar name
429 Delete the branch with the specified name from the repository.
430 Only the branch reference is deleted.
431 Any commit, tree, and blob objects belonging to the branch
432 remain in the repository and may be removed separately with
433 Git's garbage collector.
434 .El
435 .It Cm br
436 Short alias for
437 .Cm branch .
438 .It Cm add Ar file-path ...
439 Schedule unversioned files in a work tree for addition to the
440 repository in the next commit.
441 .It Cm remove Ar file-path ...
442 Remove versioned files from a work tree and schedule them for deletion
443 from the repository in the next commit.
444 .Pp
445 The options for
446 .Cm got remove
447 are as follows:
448 .Bl -tag -width Ds
449 .It Fl f
450 Perform the operation even if a file contains uncommitted modifications.
451 .El
452 .It Cm rm
453 Short alias for
454 .Cm remove .
455 .It Cm revert Ar file-path ...
456 Revert any uncommited changes in files at the specified paths.
457 File contents will be overwritten with those contained in the
458 work tree's base commit. There is no way to bring discarded
459 changes back after
460 .Cm got revert !
461 .Pp
462 If a file was added with
463 .Cm got add
464 it will become an unversioned file again.
465 If a file was deleted with
466 .Cm got remove
467 it will be restored.
468 .It Cm rv
469 Short alias for
470 .Cm revert .
471 .It Cm commit [ Fl m Ar message ] [ file-path ]
472 Create a new commit in the repository from local changes in a work tree
473 and use this commit as the new base commit for the work tree.
474 .Pp
475 Show the status of each affected file, using the following status codes:
476 .Bl -column YXZ description
477 .It M Ta modified file
478 .It D Ta file was deleted
479 .It A Ta new file was added
480 .El
481 .Pp
482 Files without local changes will retain their previously recorded base
483 commit.
484 Some
485 .Nm
486 commands may refuse to run while the work tree contains files from
487 multiple base commits.
488 The base commit of such a work tree can be made consistent by running
489 .Cm got update
490 across the entire work tree.
491 .Pp
492 The
493 .Cm got commit
494 command requires the
495 .Ev GOT_AUTHOR
496 environment variable to be set.
497 .Pp
498 The options for
499 .Cm got commit
500 are as follows:
501 .Bl -tag -width Ds
502 .It Fl m Ar message
503 Use the specified log message when creating the new commit.
504 Without the
505 .Fl m
506 option,
507 .Cm got commit
508 opens a temporary file in an editor where a log message can be written.
509 .El
510 .It Cm ci
511 Short alias for
512 .Cm commit .
513 .It Cm cherrypick Ar commit
514 Merge changes from a single
515 .Ar commit
516 into the work tree.
517 The specified
518 .Ar commit
519 must be on a different branch than the work tree's base commit.
520 The expected argument is a reference or a commit ID SHA1 hash.
521 An abbreviated hash argument will be expanded to a full SHA1 hash
522 automatically, provided the abbreviation is unique.
523 .Pp
524 Show the status of each affected file, using the following status codes:
525 .Bl -column YXZ description
526 .It G Ta file was merged
527 .It C Ta file was merged and conflicts occurred during merge
528 .It ! Ta changes destined for a missing file were not merged
529 .It D Ta file was deleted
530 .It d Ta file's deletion was obstructed by local modifications
531 .It A Ta new file was added
532 .It ~ Ta changes destined for a non-regular file were not merged
533 .El
534 .Pp
535 The merged changes will appear as local changes in the work tree, which
536 may be viewed with
537 .Cm got diff ,
538 amended manually or with further
539 .Cm got cherrypick
540 comands,
541 committed with
542 .Cm got commit ,
543 or discarded again with
544 .Cm got revert .
545 .Pp
546 .Cm got cherrypick
547 will refuse to run if certain preconditions are not met.
548 If the work tree contains multiple base commits it must first be updated
549 to a single base commit with
550 .Cm got update .
551 If the work tree already contains files with merge conflicts, these
552 conflicts must be resolved first.
553 .It Cm cy
554 Short alias for
555 .Cm cherrypick .
556 .It Cm backout Ar commit
557 Reverse-merge changes from a single
558 .Ar commit
559 into the work tree.
560 The specified
561 .Ar commit
562 must be on the same branch as the work tree's base commit.
563 The expected argument is a reference or a commit ID SHA1 hash.
564 An abbreviated hash argument will be expanded to a full SHA1 hash
565 automatically, provided the abbreviation is unique.
566 .Pp
567 Show the status of each affected file, using the following status codes:
568 .Bl -column YXZ description
569 .It G Ta file was merged
570 .It C Ta file was merged and conflicts occurred during merge
571 .It ! Ta changes destined for a missing file were not merged
572 .It D Ta file was deleted
573 .It d Ta file's deletion was obstructed by local modifications
574 .It A Ta new file was added
575 .It ~ Ta changes destined for a non-regular file were not merged
576 .El
577 .Pp
578 The reverse-merged changes will appear as local changes in the work tree,
579 which may be viewed with
580 .Cm got diff ,
581 amended manually or with further
582 .Cm got backout
583 comands,
584 committed with
585 .Cm got commit ,
586 or discarded again with
587 .Cm got revert .
588 .Pp
589 .Cm got backout
590 will refuse to run if certain preconditions are not met.
591 If the work tree contains multiple base commits it must first be updated
592 to a single base commit with
593 .Cm got update .
594 If the work tree already contains files with merge conflicts, these
595 conflicts must be resolved first.
596 .It Cm bo
597 Short alias for
598 .Cm backout .
599 .It Cm rebase [ Fl a ] [ Fl c] [ Ar branch ]
600 Rebase commits on the specified
601 .Ar branch
602 onto the tip of the current branch of the work tree.
603 The
604 .Ar branch
605 must share common ancestry with the work tree's current branch.
606 Rebasing begins with the first descendent commit of the youngest
607 common ancestor commit shared by the specified
608 .Ar branch
609 and the work tree's current branch, and stops once the tip commit
610 of the specified
611 .Ar branch
612 has been rebased.
613 .Pp
614 Rebased commits are accumulated on a temporary branch and represent
615 the same changes with the same log messages as their counterparts
616 on the original
617 .Ar branch ,
618 but with different commit IDs.
619 Once rebasing has completed successfully, the temporary branch becomes
620 the new version of the specified
621 .Ar branch
622 and the work tree is automatically switched to it.
623 .Pp
624 While rebasing commits, show the status of each affected file,
625 using the following status codes:
626 .Bl -column YXZ description
627 .It G Ta file was merged
628 .It C Ta file was merged and conflicts occurred during merge
629 .It ! Ta changes destined for a missing file were not merged
630 .It D Ta file was deleted
631 .It d Ta file's deletion was obstructed by local modifications
632 .It A Ta new file was added
633 .It ~ Ta changes destined for a non-regular file were not merged
634 .El
635 .Pp
636 If merge conflicts occur the rebase operation is interrupted and may
637 be continued once conflicts have been resolved.
638 Alternatively, the rebase operation may be aborted which will leave
639 .Ar branch
640 unmodified and the work tree switched back to its original branch.
641 .Pp
642 If a merge conflict is resolved in a way which renders the merged
643 change into a no-op change, the corresponding commit will be elided
644 when the rebase operation continues.
645 .Pp
646 .Cm got rebase
647 will refuse to run if certain preconditions are not met.
648 If the work tree contains multiple base commits it must first be updated
649 to a single base commit with
650 .Cm got update .
651 If the work tree contains local changes, these changes must first be
652 committed with
653 .Cm got commit
654 or reverted with
655 .Cm got revert .
656 If the
657 .Ar branch
658 contains changes to files outside of the work tree's path prefix,
659 the work tree cannot be used to rebase this branch.
660 .Pp
661 The
662 .Cm got update
663 and
664 .Cm got commit
665 commands will refuse to run while a rebase operation is in progress.
666 Other commands which manipulate the work tree may be used for
667 conflict resolution purposes.
668 .Pp
669 The options for
670 .Cm got rebase
671 are as follows:
672 .Bl -tag -width Ds
673 .It Fl a
674 Abort an interrupted rebase operation.
675 If this option is used, no further command-line arguments are allowed.
676 .It Fl c
677 Continue an interrupted rebase operation.
678 If this option is used, no further command-line arguments are allowed.
679 .El
680 .It Cm rb
681 Short alias for
682 .Cm rebase .
683 .El
684 .Sh ENVIRONMENT
685 .Bl -tag -width GOT_AUTHOR
686 .It Ev GOT_AUTHOR
687 The author's name and email address for
688 .Cm got commit
689 and
690 .Cm got import ,
691 for example:
692 .An Stefan Sperling Aq Mt stsp@openbsd.org
693 .It Ev VISUAL, Ev EDITOR
694 The editor spawned by
695 .Cm got commit .
696 .El
697 .Sh EXIT STATUS
698 .Ex -std got
699 .Sh EXAMPLES
700 Clone an existing Git repository for use with
701 .Nm .
702 This step currently requires
703 .Xr git 1 :
704 .Pp
705 .Dl $ cd /var/git/
706 .Dl $ git clone --bare https://github.com/openbsd/src.git
707 .Pp
708 Alternatively, for quick and dirty local testing of
709 .Nm
710 a new Git repository could be created and populated with files,
711 e.g. from a temporary CVS checkout located at
712 .Pa /tmp/src :
713 .Pp
714 .Dl $ got init /var/git/src.git
715 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
716 .Pp
717 Check out a work tree from the Git repository to /usr/src:
718 .Pp
719 .Dl $ got checkout /var/git/src.git /usr/src
720 .Pp
721 View local changes in a work tree directory:
722 .Pp
723 .Dl $ got status
724 .Dl $ got diff | less
725 .Pp
726 In a work tree or a git repository directory, list all branch references:
727 .Pp
728 .Dl $ got branch -l
729 .Pp
730 In a work tree or a git repository directory, create a new branch called
731 .Dq unified-buffer-cache
732 which is forked off the
733 .Dq master
734 branch:
735 .Pp
736 .Dl $ got branch unified-buffer-cache master
737 .Pp
738 Switch an existing work tree to the branch
739 .Dq unified-buffer-cache .
740 Local changes in the work tree will be preserved and merged if necessary:
741 .Pp
742 .Dl $ got update -b unified-buffer-cache
743 .Pp
744 Create a new commit from local changes in a work tree directory.
745 This new commit will become the head commit of the work tree's current branch:
746 .Pp
747 .Dl $ got commit
748 .Pp
749 In a work tree or a git repository directory, view changes committed in
750 the 3 most recent commits to the work tree's branch, or the branch resolved
751 via the repository's HEAD reference, respectively:
752 .Pp
753 .Dl $ got log -p -l 3 -f
754 .Pp
755 Add new files and remove obsolete files in a work tree directory:
756 .Pp
757 .Dl $ got add sys/uvm/uvm_ubc.c
758 .Dl $ got remove sys/uvm/uvm_vnode.c
759 .Pp
760 Create a new commit from local changes in a work tree directory
761 with a pre-defined log message.
762 .Pp
763 .Dl $ got commit -m 'unify the buffer cache'
764 .Pp
765 Update any work tree checked out from the
766 .Dq unified-buffer-cache
767 branch to the latest commit on this branch:
768 .Pp
769 .Dl $ got update
770 .Pp
771 Fetch new upstream commits into the local repository's master branch.
772 This step currently requires
773 .Xr git 1 :
774 .Pp
775 .Dl $ cd /var/git/src.git
776 .Dl $ git fetch origin master:master
777 .Pp
778 Rebase the
779 .Dq unified-buffer-cache
780 branch on top of the new head commit of the
781 .Dq master
782 branch.
783 .Pp
784 .Dl $ got update -b master
785 .Dl $ got rebase unified-buffer-cache
786 .Pp
787 Create a patch from all changes on the unified-buffer-cache branch.
788 The patch can be mailed out for review and applied to OpenBSD's CVS tree:
789 .Pp
790 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
791 .Pp
792 .Sh SEE ALSO
793 .Xr git-repository 5
794 .Xr got-worktree 5
795 .Sh AUTHORS
796 .An Stefan Sperling Aq Mt stsp@openbsd.org
797 .An Martin Pieuchot Aq Mt mpi@openbsd.org
798 .An joshua stein Aq Mt jcs@openbsd.org
799 .Sh CAVEATS
800 .Nm
801 is a work-in-progress and many commands remain to be implemented.
802 At present, the user has to fall back on
803 .Xr git 1
804 to perform tasks related to repository administration and tasks
805 which require a network connection.
806 .Pp
807 When working against a repository created with
808 .Dq git clone --bare ,
809 local commits to the
810 .Dq master
811 branch are discouraged, for now, if changes committed to the upstream
812 repository need to be tracked.
813 See the EXAMPLES section.
814 Future built-in
815 .Cm clone
816 and
817 .Cm fetch
818 commands should alleviate this problem.