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 ] [ file-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 .Pp
479 Show the status of each affected file, using the following status codes:
480 .Bl -column YXZ description
481 .It M Ta modified file
482 .It D Ta file was deleted
483 .It A Ta new file was added
484 .El
485 .Pp
486 Files without local changes will retain their previously recorded base
487 commit.
488 Some
489 .Nm
490 commands may refuse to run while the work tree contains files from
491 multiple base commits.
492 The base commit of such a work tree can be made consistent by running
493 .Cm got update
494 across the entire work tree.
495 .Pp
496 The
497 .Cm got commit
498 command requires the
499 .Ev GOT_AUTHOR
500 environment variable to be set.
501 .Pp
502 The options for
503 .Cm got commit
504 are as follows:
505 .Bl -tag -width Ds
506 .It Fl m Ar message
507 Use the specified log message when creating the new commit.
508 Without the
509 .Fl m
510 option,
511 .Cm got commit
512 opens a temporary file in an editor where a log message can be written.
513 .El
514 .It Cm ci
515 Short alias for
516 .Cm commit .
517 .It Cm cherrypick Ar commit
518 Merge changes from a single
519 .Ar commit
520 into the work tree.
521 The specified
522 .Ar commit
523 must be on a different branch than the work tree's base commit.
524 The expected argument is a reference or a commit ID SHA1 hash.
525 An abbreviated hash argument will be expanded to a full SHA1 hash
526 automatically, provided the abbreviation is unique.
527 .Pp
528 Show the status of each affected file, using the following status codes:
529 .Bl -column YXZ description
530 .It G Ta file was merged
531 .It C Ta file was merged and conflicts occurred during merge
532 .It ! Ta changes destined for a missing file were not merged
533 .It D Ta file was deleted
534 .It d Ta file's deletion was obstructed by local modifications
535 .It A Ta new file was added
536 .It ~ Ta changes destined for a non-regular file were not merged
537 .El
538 .Pp
539 The merged changes will appear as local changes in the work tree, which
540 may be viewed with
541 .Cm got diff ,
542 amended manually or with further
543 .Cm got cherrypick
544 comands,
545 committed with
546 .Cm got commit ,
547 or discarded again with
548 .Cm got revert .
549 .Pp
550 .Cm got cherrypick
551 will refuse to run if certain preconditions are not met.
552 If the work tree contains multiple base commits it must first be updated
553 to a single base commit with
554 .Cm got update .
555 If the work tree already contains files with merge conflicts, these
556 conflicts must be resolved first.
557 .It Cm cy
558 Short alias for
559 .Cm cherrypick .
560 .It Cm backout Ar commit
561 Reverse-merge changes from a single
562 .Ar commit
563 into the work tree.
564 The specified
565 .Ar commit
566 must be on the same branch as the work tree's base commit.
567 The expected argument is a reference or a commit ID SHA1 hash.
568 An abbreviated hash argument will be expanded to a full SHA1 hash
569 automatically, provided the abbreviation is unique.
570 .Pp
571 Show the status of each affected file, using the following status codes:
572 .Bl -column YXZ description
573 .It G Ta file was merged
574 .It C Ta file was merged and conflicts occurred during merge
575 .It ! Ta changes destined for a missing file were not merged
576 .It D Ta file was deleted
577 .It d Ta file's deletion was obstructed by local modifications
578 .It A Ta new file was added
579 .It ~ Ta changes destined for a non-regular file were not merged
580 .El
581 .Pp
582 The reverse-merged changes will appear as local changes in the work tree,
583 which may be viewed with
584 .Cm got diff ,
585 amended manually or with further
586 .Cm got backout
587 comands,
588 committed with
589 .Cm got commit ,
590 or discarded again with
591 .Cm got revert .
592 .Pp
593 .Cm got backout
594 will refuse to run if certain preconditions are not met.
595 If the work tree contains multiple base commits it must first be updated
596 to a single base commit with
597 .Cm got update .
598 If the work tree already contains files with merge conflicts, these
599 conflicts must be resolved first.
600 .It Cm bo
601 Short alias for
602 .Cm backout .
603 .It Cm rebase [ Fl a ] [ Fl c] [ Ar branch ]
604 Rebase commits on the specified
605 .Ar branch
606 onto the tip of the current branch of the work tree.
607 The
608 .Ar branch
609 must share common ancestry with the work tree's current branch.
610 Rebasing begins with the first descendent commit of the youngest
611 common ancestor commit shared by the specified
612 .Ar branch
613 and the work tree's current branch, and stops once the tip commit
614 of the specified
615 .Ar branch
616 has been rebased.
617 .Pp
618 Rebased commits are accumulated on a temporary branch and represent
619 the same changes with the same log messages as their counterparts
620 on the original
621 .Ar branch ,
622 but with different commit IDs.
623 Once rebasing has completed successfully, the temporary branch becomes
624 the new version of the specified
625 .Ar branch
626 and the work tree is automatically switched to it.
627 .Pp
628 While rebasing commits, show the status of each affected file,
629 using the following status codes:
630 .Bl -column YXZ description
631 .It G Ta file was merged
632 .It C Ta file was merged and conflicts occurred during merge
633 .It ! Ta changes destined for a missing file were not merged
634 .It D Ta file was deleted
635 .It d Ta file's deletion was obstructed by local modifications
636 .It A Ta new file was added
637 .It ~ Ta changes destined for a non-regular file were not merged
638 .El
639 .Pp
640 If merge conflicts occur the rebase operation is interrupted and may
641 be continued once conflicts have been resolved.
642 Alternatively, the rebase operation may be aborted which will leave
643 .Ar branch
644 unmodified and the work tree switched back to its original branch.
645 .Pp
646 If a merge conflict is resolved in a way which renders the merged
647 change into a no-op change, the corresponding commit will be elided
648 when the rebase operation continues.
649 .Pp
650 .Cm got rebase
651 will refuse to run if certain preconditions are not met.
652 If the work tree contains multiple base commits it must first be updated
653 to a single base commit with
654 .Cm got update .
655 If the work tree contains local changes, these changes must first be
656 committed with
657 .Cm got commit
658 or reverted with
659 .Cm got revert .
660 If the
661 .Ar branch
662 contains changes to files outside of the work tree's path prefix,
663 the work tree cannot be used to rebase this branch.
664 .Pp
665 The
666 .Cm got update
667 and
668 .Cm got commit
669 commands will refuse to run while a rebase operation is in progress.
670 Other commands which manipulate the work tree may be used for
671 conflict resolution purposes.
672 .Pp
673 The options for
674 .Cm got rebase
675 are as follows:
676 .Bl -tag -width Ds
677 .It Fl a
678 Abort an interrupted rebase operation.
679 If this option is used, no further command-line arguments are allowed.
680 .It Fl c
681 Continue an interrupted rebase operation.
682 If this option is used, no further command-line arguments are allowed.
683 .El
684 .It Cm rb
685 Short alias for
686 .Cm rebase .
687 .It Cm histedit [ Fl a ] [ Fl c] [ Fl F Ar histedit-script ]
688 Edit commit history between the work tree's current base commit and
689 the tip commit of the work tree's current branch.
690 .Pp
691 Editing of commit history is controlled via a
692 .Ar histedit script
693 which can be edited interactively or passed on the command line.
694 The format of the histedit script is line-based.
695 Each line in the script begins with a command name, followed by
696 whitespace and an argument.
697 For most commands, the expected argument is a commit ID SHA1 hash.
698 Any remaining text on the line is ignored.
699 Lines which begin with the
700 .Sq #
701 character are ignored entirely.
702 .Pp
703 The available commands are as follows:
704 .Bl -column YXZ pick-commit
705 .It pick Ar commit Ta Use the specified commit as it is.
706 .It edit Ar commit Ta Use the specified commit but once changes have been
707 merged into the work tree interrupt the histedit operation for amending.
708 .It fold Ar commit Ta Combine the specified commit with the next commit
709 listed further below that will be used.
710 .It drop Ar commit Ta Remove this commit from the edited history.
711 .It mesg Ar log-message Ta Use the specified single-line log message for
712 the commit on the previous line.
713 If the log message argument is left empty, open an editor where a new
714 log message can be written.
715 .El
716 .Pp
717 Every commit in the history being edited must be mentioned in the script.
718 Lines may be re-ordered to change the order of commits in the edited history.
719 .Pp
720 Edited commits are accumulated on a temporary branch.
721 Once history editing has completed successfully, the temporary branch becomes
722 the new version of the work tree's base branch and the work tree is
723 automatically switched to it.
724 .Pp
725 While merging commits, show the status of each affected file,
726 using the following status codes:
727 .Bl -column YXZ description
728 .It G Ta file was merged
729 .It C Ta file was merged and conflicts occurred during merge
730 .It ! Ta changes destined for a missing file were not merged
731 .It D Ta file was deleted
732 .It d Ta file's deletion was obstructed by local modifications
733 .It A Ta new file was added
734 .It ~ Ta changes destined for a non-regular file were not merged
735 .El
736 .Pp
737 If merge conflicts occur the histedit operation is interrupted and may
738 be continued once conflicts have been resolved.
739 Alternatively, the histedit operation may be aborted which will leave
740 the work tree switched back to its original branch.
741 .Pp
742 If a merge conflict is resolved in a way which renders the merged
743 change into a no-op change, the corresponding commit will be elided
744 when the histedit operation continues.
745 .Pp
746 .Cm got histedit
747 will refuse to run if certain preconditions are not met.
748 If the work tree contains multiple base commits it must first be updated
749 to a single base commit with
750 .Cm got update .
751 If the work tree contains local changes, these changes must first be
752 committed with
753 .Cm got commit
754 or reverted with
755 .Cm got revert .
756 If the edited history contains changes to files outside of the work tree's
757 path prefix, the work tree cannot be used to edit the history of this branch.
758 .Pp
759 The
760 .Cm got update
761 command will refuse to run while a histedit operation is in progress.
762 Other commands which manipulate the work tree may be used, and the
763 .Cm got commit
764 command may be used to commit arbitrary changes to the temporary branch
765 while the histedit operation is interrupted.
766 .Pp
767 The options for
768 .Cm got histedit
769 are as follows:
770 .Bl -tag -width Ds
771 .It Fl a
772 Abort an interrupted histedit operation.
773 If this option is used, no further command-line arguments are allowed.
774 .It Fl c
775 Continue an interrupted histedit operation.
776 If this option is used, no further command-line arguments are allowed.
777 .El
778 .It Cm he
779 Short alias for
780 .Cm histedit .
781 .El
782 .Sh ENVIRONMENT
783 .Bl -tag -width GOT_AUTHOR
784 .It Ev GOT_AUTHOR
785 The author's name and email address for
786 .Cm got commit
787 and
788 .Cm got import ,
789 for example:
790 .An Stefan Sperling Aq Mt stsp@openbsd.org
791 .It Ev VISUAL, Ev EDITOR
792 The editor spawned by
793 .Cm got commit .
794 .El
795 .Sh EXIT STATUS
796 .Ex -std got
797 .Sh EXAMPLES
798 Clone an existing Git repository for use with
799 .Nm .
800 This step currently requires
801 .Xr git 1 :
802 .Pp
803 .Dl $ cd /var/git/
804 .Dl $ git clone --bare https://github.com/openbsd/src.git
805 .Pp
806 Alternatively, for quick and dirty local testing of
807 .Nm
808 a new Git repository could be created and populated with files,
809 e.g. from a temporary CVS checkout located at
810 .Pa /tmp/src :
811 .Pp
812 .Dl $ got init /var/git/src.git
813 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
814 .Pp
815 Check out a work tree from the Git repository to /usr/src:
816 .Pp
817 .Dl $ got checkout /var/git/src.git /usr/src
818 .Pp
819 View local changes in a work tree directory:
820 .Pp
821 .Dl $ got status
822 .Dl $ got diff | less
823 .Pp
824 In a work tree or a git repository directory, list all branch references:
825 .Pp
826 .Dl $ got branch -l
827 .Pp
828 In a work tree or a git repository directory, create a new branch called
829 .Dq unified-buffer-cache
830 which is forked off the
831 .Dq master
832 branch:
833 .Pp
834 .Dl $ got branch unified-buffer-cache master
835 .Pp
836 Switch an existing work tree to the branch
837 .Dq unified-buffer-cache .
838 Local changes in the work tree will be preserved and merged if necessary:
839 .Pp
840 .Dl $ got update -b unified-buffer-cache
841 .Pp
842 Create a new commit from local changes in a work tree directory.
843 This new commit will become the head commit of the work tree's current branch:
844 .Pp
845 .Dl $ got commit
846 .Pp
847 In a work tree or a git repository directory, view changes committed in
848 the 3 most recent commits to the work tree's branch, or the branch resolved
849 via the repository's HEAD reference, respectively:
850 .Pp
851 .Dl $ got log -p -l 3 -f
852 .Pp
853 Add new files and remove obsolete files in a work tree directory:
854 .Pp
855 .Dl $ got add sys/uvm/uvm_ubc.c
856 .Dl $ got remove sys/uvm/uvm_vnode.c
857 .Pp
858 Create a new commit from local changes in a work tree directory
859 with a pre-defined log message.
860 .Pp
861 .Dl $ got commit -m 'unify the buffer cache'
862 .Pp
863 Update any work tree checked out from the
864 .Dq unified-buffer-cache
865 branch to the latest commit on this branch:
866 .Pp
867 .Dl $ got update
868 .Pp
869 Roll file content on the unified-buffer-cache branch back by one commit,
870 and then fetch the rolled-back change into the work tree as a local change
871 to be amended and perhaps committed again:
872 .Pp
873 .Dl $ got backout unified-buffer-cache
874 .Dl $ got commit -m 'roll back previous'
875 .Dl $ # now back out the previous backout :-)
876 .Dl $ got backout unified-buffer-cache
877 .Pp
878 Fetch new upstream commits into the local repository's master branch.
879 This step currently requires
880 .Xr git 1 :
881 .Pp
882 .Dl $ cd /var/git/src.git
883 .Dl $ git fetch origin master:master
884 .Pp
885 Rebase the
886 .Dq unified-buffer-cache
887 branch on top of the new head commit of the
888 .Dq master
889 branch.
890 .Pp
891 .Dl $ got update -b master
892 .Dl $ got rebase unified-buffer-cache
893 .Pp
894 Create a patch from all changes on the unified-buffer-cache branch.
895 The patch can be mailed out for review and applied to OpenBSD's CVS tree:
896 .Pp
897 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
898 .Pp
899 Edit the entire commit history of the
900 .Dq unified-buffer-cache
901 branch:
902 .Pp
903 .Dl $ got update -b unified-buffer-cache
904 .Dl $ got update -c master
905 .Dl $ got histedit
906 .Pp
907 .Sh SEE ALSO
908 .Xr tog 1 ,
909 .Xr git-repository 5 ,
910 .Xr got-worktree 5
911 .Sh AUTHORS
912 .An Stefan Sperling Aq Mt stsp@openbsd.org
913 .An Martin Pieuchot Aq Mt mpi@openbsd.org
914 .An joshua stein Aq Mt jcs@openbsd.org
915 .Sh CAVEATS
916 .Nm
917 is a work-in-progress and many commands remain to be implemented.
918 At present, the user has to fall back on
919 .Xr git 1
920 to perform tasks related to repository administration and tasks
921 which require a network connection.
922 .Pp
923 When working against a repository created with
924 .Dq git clone --bare ,
925 local commits to the
926 .Dq master
927 branch are discouraged, for now, if changes committed to the upstream
928 repository need to be tracked.
929 See the EXAMPLES section.
930 Future built-in
931 .Cm clone
932 and
933 .Cm fetch
934 commands should alleviate this problem.