Blob


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