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