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