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