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