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 precede the command name, and are as follows:
54 .Bl -tag -width tenletters
55 .It Fl h
56 Display usage information and exit immediately.
57 .It Fl V
58 Display program version and exit immediately.
59 .El
60 .Pp
61 The commands for
62 .Nm
63 are as follows:
64 .Bl -tag -width checkout
65 .It Cm init Ar repository-path
66 Create a new empty repository at the specified
67 .Ar repository-path .
68 .Pp
69 After
70 .Cm got init ,
71 the
72 .Cm got import
73 command must be used to populate the empty repository before
74 .Cm got checkout
75 can be used.
76 .It Cm in
77 Short alias for
78 .Cm init .
79 .It Cm import Oo Fl b Ar branch Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl I Ar pattern Oc Ar directory
80 Create an initial commit in a repository from the file hierarchy
81 within the specified
82 .Ar directory .
83 The created commit will not have any parent commits, i.e. it will be a
84 root commit.
85 Also create a new reference which provides a branch name for the newly
86 created commit.
87 Show the path of each imported file to indicate progress.
88 .Pp
89 The
90 .Cm got import
91 command requires the
92 .Ev GOT_AUTHOR
93 environment variable to be set,
94 unless Git's
95 .Dv user.name
96 and
97 .Dv user.email
98 configuration settings can be obtained from the repository's
99 .Pa .git/config
100 file or from Git's global
101 .Pa ~/.gitconfig
102 configuration file.
103 .Pp
104 The options for
105 .Cm got import
106 are as follows:
107 .Bl -tag -width Ds
108 .It Fl b Ar branch
109 Create the specified
110 .Ar branch
111 instead of creating the default branch
112 .Dq main .
113 Use of this option is required if the
114 .Dq main
115 branch already exists.
116 .It Fl m Ar message
117 Use the specified log message when creating the new commit.
118 Without the
119 .Fl m
120 option,
121 .Cm got import
122 opens a temporary file in an editor where a log message can be written.
123 .It Fl r Ar repository-path
124 Use the repository at the specified path.
125 If not specified, assume the repository is located at or above the current
126 working directory.
127 .It Fl I Ar pattern
128 Ignore files or directories with a name which matches the specified
129 .Ar pattern .
130 This option may be specified multiple times to build a list of ignore patterns.
131 The
132 .Ar pattern
133 follows the globbing rules documented in
134 .Xr glob 7 .
135 .El
136 .It Cm im
137 Short alias for
138 .Cm import .
139 .It Cm checkout Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Oo Fl p Ar path-prefix Oc Ar repository-path Op Ar work-tree-path
140 Copy files from a repository into a new work tree.
141 If the
142 .Ar work tree path
143 is not specified, either use the last component of
144 .Ar repository path ,
145 or if a
146 .Ar path prefix
147 was specified use the last component of
148 .Ar path prefix .
149 .Pp
150 The options for
151 .Cm got checkout
152 are as follows:
153 .Bl -tag -width Ds
154 .It Fl b Ar branch
155 Check out files from a commit on the specified
156 .Ar branch .
157 If this option is not specified, a branch resolved via the repository's HEAD
158 reference will be used.
159 .It Fl c Ar commit
160 Check out files from the specified
161 .Ar commit
162 on the selected branch.
163 The expected argument is a commit ID SHA1 hash or an existing reference
164 or tag name which will be resolved to a commit ID.
165 An abbreviated hash argument will be expanded to a full SHA1 hash
166 automatically, provided the abbreviation is unique.
167 If this option is not specified, the most recent commit on the selected
168 branch will be used.
169 .It Fl p Ar path-prefix
170 Restrict the work tree to a subset of the repository's tree hierarchy.
171 Only files beneath the specified
172 .Ar path-prefix
173 will be checked out.
174 .El
175 .It Cm co
176 Short alias for
177 .Cm checkout .
178 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
179 Update an existing work tree to a different commit.
180 Show the status of each affected file, using the following status codes:
181 .Bl -column YXZ description
182 .It U Ta file was updated and contained no local changes
183 .It G Ta file was updated and local changes were merged cleanly
184 .It C Ta file was updated and conflicts occurred during merge
185 .It D Ta file was deleted
186 .It A Ta new file was added
187 .It \(a~ Ta versioned file is obstructed by a non-regular file
188 .It ! Ta a missing versioned file was restored
189 .El
190 .Pp
191 If no
192 .Ar path
193 is specified, update the entire work tree.
194 Otherwise, restrict the update operation to files at or within the
195 specified paths.
196 Each path is required to exist in the update operation's target commit.
197 Files in the work tree outside specified paths will remain unchanged and
198 will retain their previously recorded base commit.
199 Some
200 .Nm
201 commands may refuse to run while the work tree contains files from
202 multiple base commits.
203 The base commit of such a work tree can be made consistent by running
204 .Cm got update
205 across the entire work tree.
206 Specifying a
207 .Ar path
208 is incompatible with the
209 .Fl b
210 option.
211 .Pp
212 .Cm got update
213 cannot update paths with staged changes.
214 If changes have been staged with
215 .Cm got stage ,
216 these changes must first be committed with
217 .Cm got commit
218 or unstaged with
219 .Cm got unstage .
220 .Pp
221 The options for
222 .Cm got update
223 are as follows:
224 .Bl -tag -width Ds
225 .It Fl b Ar branch
226 Switch the work tree's branch reference to the specified
227 .Ar branch
228 before updating the work tree.
229 This option requires that all paths in the work tree are updated.
230 .It Fl c Ar commit
231 Update the work tree to the specified
232 .Ar commit .
233 The expected argument is a commit ID SHA1 hash or an existing reference
234 or tag name which will be resolved to a commit ID.
235 An abbreviated hash argument will be expanded to a full SHA1 hash
236 automatically, provided the abbreviation is unique.
237 If this option is not specified, the most recent commit on the work tree's
238 branch will be used.
239 .El
240 .It Cm up
241 Short alias for
242 .Cm update .
243 .It Cm status Op Ar path ...
244 Show the current modification status of files in a work tree,
245 using the following status codes:
246 .Bl -column YXZ description
247 .It M Ta modified file
248 .It A Ta file scheduled for addition in next commit
249 .It D Ta file scheduled for deletion in next commit
250 .It C Ta modified or added file which contains merge conflicts
251 .It ! Ta versioned file was expected on disk but is missing
252 .It \(a~ Ta versioned file is obstructed by a non-regular file
253 .It ? Ta unversioned item not tracked by
254 .Nm
255 .It m Ta modified file modes (executable bit only)
256 .It N Ta non-existent
257 .Ar path
258 specified on the command line
259 .El
260 .Pp
261 If no
262 .Ar path
263 is specified, show modifications in the entire work tree.
264 Otherwise, show modifications at or within the specified paths.
265 .Pp
266 If changes have been staged with
267 .Cm got stage ,
268 staged changes are shown in the second output column, using the following
269 status codes:
270 .Bl -column YXZ description
271 .It M Ta file modification is staged
272 .It A Ta file addition is staged
273 .It D Ta file deletion is staged
274 .El
275 .Pp
276 Changes created on top of staged changes are indicated in the first column:
277 .Bl -column YXZ description
278 .It MM Ta file was modified after earlier changes have been staged
279 .It MA Ta file was modified after having been staged for addition
280 .El
281 .Pp
282 For compatibility with
283 .Xr cvs 1
284 and
285 .Xr git 1 ,
286 .Cm got status
287 reads
288 .Xr glob 7
289 patterns from
290 .Pa .cvsignore
291 and
292 .Pa .gitignore
293 files in each traversed directory and will not display unversioned files
294 which match these patterns.
295 As an extension to
296 .Xr glob 7
297 matching rules,
298 .Cm got status
299 supports consecutive asterisks,
300 .Dq ** ,
301 which will match an arbitrary amount of directories.
302 Unlike
303 .Xr cvs 1 ,
304 .Cm got status
305 only supports a single ignore pattern per line.
306 Unlike
307 .Xr git 1 ,
308 .Cm got status
309 does not support negated ignore patterns prefixed with
310 .Dq \&! ,
311 and gives no special significance to the location of path component separators,
312 .Dq / ,
313 in a pattern.
314 .It Cm st
315 Short alias for
316 .Cm status .
317 .It Cm log Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl f Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl r Ar repository-path Oc Op Ar path
318 Display history of a repository.
319 If a
320 .Ar path
321 is specified, show only commits which modified this path.
322 .Pp
323 The options for
324 .Cm got log
325 are as follows:
326 .Bl -tag -width Ds
327 .It Fl c Ar commit
328 Start traversing history at the specified
329 .Ar commit .
330 The expected argument is a commit ID SHA1 hash or an existing reference
331 or tag name which will be resolved to a commit ID.
332 An abbreviated hash argument will be expanded to a full SHA1 hash
333 automatically, provided the abbreviation is unique.
334 If this option is not specified, default to the work tree's current branch
335 if invoked in a work tree, or to the repository's HEAD reference.
336 .It Fl C Ar number
337 Set the number of context lines shown in diffs with
338 .Fl p .
339 By default, 3 lines of context are shown.
340 .It Fl f
341 Restrict history traversal to the first parent of each commit.
342 This shows the linear history of the current branch only.
343 Merge commits which affected the current branch will be shown but
344 individual commits which originated on other branches will be omitted.
345 .It Fl l Ar N
346 Limit history traversal to a given number of commits.
347 If this option is not specified, a default limit value of zero is used,
348 which is treated as an unbounded limit.
349 The
350 .Ev GOT_LOG_DEFAULT_LIMIT
351 environment variable may be set to change this default value.
352 .It Fl p
353 Display the patch of modifications made in each commit.
354 If a
355 .Ar path
356 is specified, only show the patch of modifications at or within this path.
357 .It Fl r Ar repository-path
358 Use the repository at the specified path.
359 If not specified, assume the repository is located at or above the current
360 working directory.
361 If this directory is a
362 .Nm
363 work tree, use the repository path associated with this work tree.
364 .El
365 .It Cm diff Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path
366 When invoked within a work tree with less than two arguments, display
367 uncommitted changes in the work tree.
368 If a
369 .Ar path
370 is specified, only show changes within this path.
371 .Pp
372 If two arguments are provided, treat each argument as a reference, a tag
373 name, or an object ID SHA1 hash, and display differences between the
374 corresponding objects.
375 Both objects must be of the same type (blobs, trees, or commits).
376 An abbreviated hash argument will be expanded to a full SHA1 hash
377 automatically, provided the abbreviation is unique.
378 .Pp
379 The options for
380 .Cm got diff
381 are as follows:
382 .Bl -tag -width Ds
383 .It Fl C Ar number
384 Set the number of context lines shown in the diff.
385 By default, 3 lines of context are shown.
386 .It Fl r Ar repository-path
387 Use the repository at the specified path.
388 If not specified, assume the repository is located at or above the current
389 working directory.
390 If this directory is a
391 .Nm
392 work tree, use the repository path associated with this work tree.
393 .It Fl s
394 Show changes staged with
395 .Cm got stage
396 instead of showing local changes.
397 This option is only valid when
398 .Cm got diff
399 is invoked in a work tree.
400 .It Fl w
401 Ignore whitespace-only changes.
402 .El
403 .It Cm di
404 Short alias for
405 .Cm diff .
406 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
407 Display line-by-line history of a file at the specified path.
408 .Pp
409 The options for
410 .Cm got blame
411 are as follows:
412 .Bl -tag -width Ds
413 .It Fl c Ar commit
414 Start traversing history at the specified
415 .Ar commit .
416 The expected argument is a commit ID SHA1 hash or an existing reference
417 or tag name which will be resolved to a commit ID.
418 An abbreviated hash argument will be expanded to a full SHA1 hash
419 automatically, provided the abbreviation is unique.
420 .It Fl r Ar repository-path
421 Use the repository at the specified path.
422 If not specified, assume the repository is located at or above the current
423 working directory.
424 If this directory is a
425 .Nm
426 work tree, use the repository path associated with this work tree.
427 .El
428 .It Cm bl
429 Short alias for
430 .Cm blame .
431 .It Cm tree Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl i Oc Oo Fl R Oc Op Ar path
432 Display a listing of files and directories at the specified
433 directory path in the repository.
434 Entries shown in this listing may carry one of the following trailing
435 annotations:
436 .Bl -column YXZ description
437 .It @ Ta entry is a symbolic link
438 .It / Ta entry is a directory
439 .It * Ta entry is an executable file
440 .It $ Ta entry is a Git submodule
441 .El
442 .Pp
443 If no
444 .Ar path
445 is specified, list the repository path corresponding to the current
446 directory of the work tree, or the root directory of the repository
447 if there is no work tree.
448 .Pp
449 The options for
450 .Cm got tree
451 are as follows:
452 .Bl -tag -width Ds
453 .It Fl c Ar commit
454 List files and directories as they appear in the specified
455 .Ar commit .
456 The expected argument is a commit ID SHA1 hash or an existing reference
457 or tag name which will be resolved to a commit ID.
458 An abbreviated hash argument will be expanded to a full SHA1 hash
459 automatically, provided the abbreviation is unique.
460 .It Fl r Ar repository-path
461 Use the repository at the specified path.
462 If not specified, assume the repository is located at or above the current
463 working directory.
464 If this directory is a
465 .Nm
466 work tree, use the repository path associated with this work tree.
467 .It Fl i
468 Show object IDs of files (blob objects) and directories (tree objects).
469 .It Fl R
470 Recurse into sub-directories in the repository.
471 .El
472 .It Cm tr
473 Short alias for
474 .Cm tree .
475 .It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Oo Fl s Oc Op Ar name Ar target
476 Manage references in a repository.
477 .Pp
478 If no options are passed, expect two arguments and attempt to create,
479 or update, the reference with the given
480 .Ar name ,
481 and make it point at the given
482 .Ar target .
483 The name must be an absolute reference name, i.e. it must begin with
484 .Dq refs/ .
485 The target may be an object ID SHA1 hash or an existing reference which
486 will be resolved to an object ID.
487 An abbreviated hash argument will be expanded to a full SHA1 hash
488 automatically, provided the abbreviation is unique.
489 .Pp
490 The options for
491 .Cm got ref
492 are as follows:
493 .Bl -tag -width Ds
494 .It Fl r Ar repository-path
495 Use the repository at the specified path.
496 If not specified, assume the repository is located at or above the current
497 working directory.
498 If this directory is a
499 .Nm
500 work tree, use the repository path associated with this work tree.
501 .It Fl l
502 List all existing references in the repository.
503 .It Fl d Ar name
504 Delete the reference with the specified name from the repository.
505 .It Fl s
506 Create a symbolic reference pointing at the specified
507 .Ar target ,
508 which must be an existing reference.
509 Care should be taken not to create loops between references when
510 this option is used.
511 .El
512 .It Cm branch Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Op Ar name
513 Manage branches in a repository.
514 .Pp
515 Branches are managed via references which live in the
516 .Dq refs/heads/
517 reference namespace.
518 The
519 .Cm got branch
520 command operates on references in this namespace only.
521 .Pp
522 If invoked in a work tree without any arguments, print the name of the
523 work tree's current branch.
524 If a
525 .Ar name
526 argument is passed, attempt to create a branch reference with the given name.
527 By default the new branch reference will point at the latest commit on the
528 work tree's current branch if invoked in a work tree, and otherwise to a commit
529 resolved via the repository's HEAD reference.
530 .Pp
531 The options for
532 .Cm got branch
533 are as follows:
534 .Bl -tag -width Ds
535 .It Fl c Ar commit
536 Make a newly created branch reference point at the specified
537 .Ar commit .
538 The expected
539 .Ar commit
540 argument is a commit ID SHA1 hash or an existing reference
541 or tag name which will be resolved to a commit ID.
542 .It Fl r Ar repository-path
543 Use the repository at the specified path.
544 If not specified, assume the repository is located at or above the current
545 working directory.
546 If this directory is a
547 .Nm
548 work tree, use the repository path associated with this work tree.
549 .It Fl l
550 List all existing branches in the repository.
551 If invoked in a work tree, the work tree's current branch is shown
552 with one the following annotations:
553 .Bl -column YXZ description
554 .It * Ta work tree's base commit matches the branch tip
555 .It \(a~ Ta work tree's base commit is out-of-date
556 .El
557 .It Fl d Ar name
558 Delete the branch with the specified name from the repository.
559 Only the branch reference is deleted.
560 Any commit, tree, and blob objects belonging to the branch
561 remain in the repository and may be removed separately with
562 Git's garbage collector.
563 .El
564 .It Cm br
565 Short alias for
566 .Cm branch .
567 .It Cm tag Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Ar name Op Ar commit Oc
568 Manage tags in a repository.
569 .Pp
570 Tags are managed via references which live in the
571 .Dq refs/tags/
572 reference namespace.
573 The
574 .Cm got tag
575 command operates on references in this namespace only.
576 References in this namespace point at tag objects which contain a pointer
577 to another object, a tag message, as well as author and timestamp information.
578 .Pp
579 Expect one or two arguments and attempt to create a tag with the given
580 .Ar name ,
581 and make this tag point at the given
582 .Ar commit .
583 If no commit is specified, default to the latest commit on the work tree's
584 current branch if invoked in a work tree, and to a commit resolved via
585 the repository's HEAD reference otherwise.
586 Otherwise, the expected argument is a commit ID SHA1 hash or an existing
587 reference or tag name which will be resolved to a commit ID.
588 An abbreviated hash argument will be expanded to a full SHA1 hash
589 automatically, provided the abbreviation is unique.
590 .Pp
591 The options for
592 .Cm got tag
593 are as follows:
594 .Bl -tag -width Ds
595 .It Fl m Ar message
596 Use the specified tag message when creating the new tag
597 Without the
598 .Fl m
599 option,
600 .Cm got tag
601 opens a temporary file in an editor where a tag message can be written.
602 .It Fl r Ar repository-path
603 Use the repository at the specified path.
604 If not specified, assume the repository is located at or above the current
605 working directory.
606 If this directory is a
607 .Nm
608 work tree, use the repository path associated with this work tree.
609 .It Fl l
610 List all existing tags in the repository instead of creating a new tag.
611 If this option is used, no other command-line arguments are allowed.
612 .El
613 .Pp
614 By design, the
615 .Cm got tag
616 command will not delete tags or change existing tags.
617 If a tag must be deleted, the
618 .Cm got ref
619 command may be used to delete a tag's reference.
620 This should only be done if the tag has not already been copied to
621 another repository.
622 .It Cm add Oo Fl R Oc Ar path ...
623 Schedule unversioned files in a work tree for addition to the
624 repository in the next commit.
625 .Pp
626 The options for
627 .Cm got add
628 are as follows:
629 .Bl -tag -width Ds
630 .It Fl R
631 Permit recursion into directories.
632 If this option is not specified,
633 .Cm got add
634 will refuse to run if a specified
635 .Ar path
636 is a directory.
637 .El
638 .It Cm remove Ar file-path ...
639 Remove versioned files from a work tree and schedule them for deletion
640 from the repository in the next commit.
641 .Pp
642 The options for
643 .Cm got remove
644 are as follows:
645 .Bl -tag -width Ds
646 .It Fl f
647 Perform the operation even if a file contains uncommitted modifications.
648 .El
649 .It Cm rm
650 Short alias for
651 .Cm remove .
652 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
653 Revert any uncommitted changes in files at the specified paths.
654 File contents will be overwritten with those contained in the
655 work tree's base commit.
656 There is no way to bring discarded changes back after
657 .Cm got revert !
658 .Pp
659 If a file was added with
660 .Cm got add
661 it will become an unversioned file again.
662 If a file was deleted with
663 .Cm got remove
664 it will be restored.
665 .Pp
666 The options for
667 .Cm got revert
668 are as follows:
669 .Bl -tag -width Ds
670 .It Fl p
671 Instead of reverting all changes in files, interactively select or reject
672 changes to revert based on
673 .Dq y
674 (revert change),
675 .Dq n
676 (keep change), and
677 .Dq q
678 (quit reverting this file) responses.
679 If a file is in modified status, individual patches derived from the
680 modified file content can be reverted.
681 Files in added or deleted status may only be reverted in their entirety.
682 .It Fl F Ar response-script
683 With the
684 .Fl p
685 option, read
686 .Dq y ,
687 .Dq n ,
688 and
689 .Dq q
690 responses line-by-line from the specified
691 .Ar response-script
692 file instead of prompting interactively.
693 .It Fl R
694 Permit recursion into directories.
695 If this option is not specified,
696 .Cm got revert
697 will refuse to run if a specified
698 .Ar path
699 is a directory.
700 .El
701 .It Cm rv
702 Short alias for
703 .Cm revert .
704 .It Cm commit Oo Fl m Ar message Oc Op Ar path ...
705 Create a new commit in the repository from changes in a work tree
706 and use this commit as the new base commit for the work tree.
707 If no
708 .Ar path
709 is specified, commit all changes in the work tree.
710 Otherwise, commit changes at or within the specified paths.
711 .Pp
712 If changes have been explicitly staged for commit with
713 .Cm got stage ,
714 only commit staged changes and reject any specified paths which
715 have not been staged.
716 .Pp
717 Show the status of each affected file, using the following status codes:
718 .Bl -column YXZ description
719 .It M Ta modified file
720 .It D Ta file was deleted
721 .It A Ta new file was added
722 .It m Ta modified file modes (executable bit only)
723 .El
724 .Pp
725 Files which are not part of the new commit will retain their previously
726 recorded base commit.
727 Some
728 .Nm
729 commands may refuse to run while the work tree contains files from
730 multiple base commits.
731 The base commit of such a work tree can be made consistent by running
732 .Cm got update
733 across the entire work tree.
734 .Pp
735 The
736 .Cm got commit
737 command requires the
738 .Ev GOT_AUTHOR
739 environment variable to be set,
740 unless Git's
741 .Dv user.name
742 and
743 .Dv user.email
744 configuration settings can be
745 obtained from the repository's
746 .Pa .git/config
747 file or from Git's global
748 .Pa ~/.gitconfig
749 configuration file.
750 .Pp
751 The options for
752 .Cm got commit
753 are as follows:
754 .Bl -tag -width Ds
755 .It Fl m Ar message
756 Use the specified log message when creating the new commit.
757 Without the
758 .Fl m
759 option,
760 .Cm got commit
761 opens a temporary file in an editor where a log message can be written.
762 .El
763 .Pp
764 .Cm got commit
765 will refuse to run if certain preconditions are not met.
766 If the work tree's current branch is not in the
767 .Dq refs/heads/
768 reference namespace, new commits may not be created on this branch.
769 Local changes may only be committed if they are based on file content
770 found in the most recent commit on the work tree's branch.
771 If a path is found to be out of date,
772 .Cm got update
773 must be used first in order to merge local changes with changes made
774 in the repository.
775 .It Cm ci
776 Short alias for
777 .Cm commit .
778 .It Cm cherrypick Ar commit
779 Merge changes from a single
780 .Ar commit
781 into the work tree.
782 The specified
783 .Ar commit
784 must be on a different branch than the work tree's base commit.
785 The expected argument is a reference or a commit ID SHA1 hash.
786 An abbreviated hash argument will be expanded to a full SHA1 hash
787 automatically, provided the abbreviation is unique.
788 .Pp
789 Show the status of each affected file, using the following status codes:
790 .Bl -column YXZ description
791 .It G Ta file was merged
792 .It C Ta file was merged and conflicts occurred during merge
793 .It ! Ta changes destined for a missing file were not merged
794 .It D Ta file was deleted
795 .It d Ta file's deletion was obstructed by local modifications
796 .It A Ta new file was added
797 .It \(a~ Ta changes destined for a non-regular file were not merged
798 .El
799 .Pp
800 The merged changes will appear as local changes in the work tree, which
801 may be viewed with
802 .Cm got diff ,
803 amended manually or with further
804 .Cm got cherrypick
805 commands,
806 committed with
807 .Cm got commit ,
808 or discarded again with
809 .Cm got revert .
810 .Pp
811 .Cm got cherrypick
812 will refuse to run if certain preconditions are not met.
813 If the work tree contains multiple base commits it must first be updated
814 to a single base commit with
815 .Cm got update .
816 If the work tree already contains files with merge conflicts, these
817 conflicts must be resolved first.
818 .It Cm cy
819 Short alias for
820 .Cm cherrypick .
821 .It Cm backout Ar commit
822 Reverse-merge changes from a single
823 .Ar commit
824 into the work tree.
825 The specified
826 .Ar commit
827 must be on the same branch as the work tree's base commit.
828 The expected argument is a reference or a commit ID SHA1 hash.
829 An abbreviated hash argument will be expanded to a full SHA1 hash
830 automatically, provided the abbreviation is unique.
831 .Pp
832 Show the status of each affected file, using the following status codes:
833 .Bl -column YXZ description
834 .It G Ta file was merged
835 .It C Ta file was merged and conflicts occurred during merge
836 .It ! Ta changes destined for a missing file were not merged
837 .It D Ta file was deleted
838 .It d Ta file's deletion was obstructed by local modifications
839 .It A Ta new file was added
840 .It \(a~ Ta changes destined for a non-regular file were not merged
841 .El
842 .Pp
843 The reverse-merged changes will appear as local changes in the work tree,
844 which may be viewed with
845 .Cm got diff ,
846 amended manually or with further
847 .Cm got backout
848 commands,
849 committed with
850 .Cm got commit ,
851 or discarded again with
852 .Cm got revert .
853 .Pp
854 .Cm got backout
855 will refuse to run if certain preconditions are not met.
856 If the work tree contains multiple base commits it must first be updated
857 to a single base commit with
858 .Cm got update .
859 If the work tree already contains files with merge conflicts, these
860 conflicts must be resolved first.
861 .It Cm bo
862 Short alias for
863 .Cm backout .
864 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
865 Rebase commits on the specified
866 .Ar branch
867 onto the tip of the current branch of the work tree.
868 The
869 .Ar branch
870 must share common ancestry with the work tree's current branch.
871 Rebasing begins with the first descendant commit of the youngest
872 common ancestor commit shared by the specified
873 .Ar branch
874 and the work tree's current branch, and stops once the tip commit
875 of the specified
876 .Ar branch
877 has been rebased.
878 .Pp
879 Rebased commits are accumulated on a temporary branch which the work tree
880 will remain switched to throughout the entire rebase operation.
881 Commits on this branch represent the same changes with the same log
882 messages as their counterparts on the original
883 .Ar branch ,
884 but with different commit IDs.
885 Once rebasing has completed successfully, the temporary branch becomes
886 the new version of the specified
887 .Ar branch
888 and the work tree is automatically switched to it.
889 .Pp
890 While rebasing commits, show the status of each affected file,
891 using the following status codes:
892 .Bl -column YXZ description
893 .It G Ta file was merged
894 .It C Ta file was merged and conflicts occurred during merge
895 .It ! Ta changes destined for a missing file were not merged
896 .It D Ta file was deleted
897 .It d Ta file's deletion was obstructed by local modifications
898 .It A Ta new file was added
899 .It \(a~ Ta changes destined for a non-regular file were not merged
900 .El
901 .Pp
902 If merge conflicts occur the rebase operation is interrupted and may
903 be continued once conflicts have been resolved.
904 Alternatively, the rebase operation may be aborted which will leave
905 .Ar branch
906 unmodified and the work tree switched back to its original branch.
907 .Pp
908 If a merge conflict is resolved in a way which renders the merged
909 change into a no-op change, the corresponding commit will be elided
910 when the rebase operation continues.
911 .Pp
912 .Cm got rebase
913 will refuse to run if certain preconditions are not met.
914 If the work tree contains multiple base commits it must first be updated
915 to a single base commit with
916 .Cm got update .
917 If changes have been staged with
918 .Cm got stage ,
919 these changes must first be committed with
920 .Cm got commit
921 or unstaged with
922 .Cm got unstage .
923 If the work tree contains local changes, these changes must first be
924 committed with
925 .Cm got commit
926 or reverted with
927 .Cm got revert .
928 If the
929 .Ar branch
930 contains changes to files outside of the work tree's path prefix,
931 the work tree cannot be used to rebase this branch.
932 .Pp
933 The
934 .Cm got update
935 and
936 .Cm got commit
937 commands will refuse to run while a rebase operation is in progress.
938 Other commands which manipulate the work tree may be used for
939 conflict resolution purposes.
940 .Pp
941 The options for
942 .Cm got rebase
943 are as follows:
944 .Bl -tag -width Ds
945 .It Fl a
946 Abort an interrupted rebase operation.
947 If this option is used, no other command-line arguments are allowed.
948 .It Fl c
949 Continue an interrupted rebase operation.
950 If this option is used, no other command-line arguments are allowed.
951 .El
952 .It Cm rb
953 Short alias for
954 .Cm rebase .
955 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Op Fl F Ar histedit-script
956 Edit commit history between the work tree's current base commit and
957 the tip commit of the work tree's current branch.
958 .Pp
959 Editing of commit history is controlled via a
960 .Ar histedit script
961 which can be edited interactively or passed on the command line.
962 The format of the histedit script is line-based.
963 Each line in the script begins with a command name, followed by
964 whitespace and an argument.
965 For most commands, the expected argument is a commit ID SHA1 hash.
966 Any remaining text on the line is ignored.
967 Lines which begin with the
968 .Sq #
969 character are ignored entirely.
970 .Pp
971 The available commands are as follows:
972 .Bl -column YXZ pick-commit
973 .It pick Ar commit Ta Use the specified commit as it is.
974 .It edit Ar commit Ta Use the specified commit but once changes have been
975 merged into the work tree interrupt the histedit operation for amending.
976 .It fold Ar commit Ta Combine the specified commit with the next commit
977 listed further below that will be used.
978 .It drop Ar commit Ta Remove this commit from the edited history.
979 .It mesg Ar log-message Ta Use the specified single-line log message for
980 the commit on the previous line.
981 If the log message argument is left empty, open an editor where a new
982 log message can be written.
983 .El
984 .Pp
985 Every commit in the history being edited must be mentioned in the script.
986 Lines may be re-ordered to change the order of commits in the edited history.
987 .Pp
988 Edited commits are accumulated on a temporary branch which the work tree
989 will remain switched to throughout the entire histedit operation.
990 Once history editing has completed successfully, the temporary branch becomes
991 the new version of the work tree's branch and the work tree is automatically
992 switched to it.
993 .Pp
994 While merging commits, show the status of each affected file,
995 using the following status codes:
996 .Bl -column YXZ description
997 .It G Ta file was merged
998 .It C Ta file was merged and conflicts occurred during merge
999 .It ! Ta changes destined for a missing file were not merged
1000 .It D Ta file was deleted
1001 .It d Ta file's deletion was obstructed by local modifications
1002 .It A Ta new file was added
1003 .It \(a~ Ta changes destined for a non-regular file were not merged
1004 .El
1005 .Pp
1006 If merge conflicts occur the histedit operation is interrupted and may
1007 be continued once conflicts have been resolved.
1008 Alternatively, the histedit operation may be aborted which will leave
1009 the work tree switched back to its original branch.
1010 .Pp
1011 If a merge conflict is resolved in a way which renders the merged
1012 change into a no-op change, the corresponding commit will be elided
1013 when the histedit operation continues.
1014 .Pp
1015 .Cm got histedit
1016 will refuse to run if certain preconditions are not met.
1017 If the work tree's current branch is not in the
1018 .Dq refs/heads/
1019 reference namespace, the history of the branch may not be edited.
1020 If the work tree contains multiple base commits it must first be updated
1021 to a single base commit with
1022 .Cm got update .
1023 If changes have been staged with
1024 .Cm got stage ,
1025 these changes must first be committed with
1026 .Cm got commit
1027 or unstaged with
1028 .Cm got unstage .
1029 If the work tree contains local changes, these changes must first be
1030 committed with
1031 .Cm got commit
1032 or reverted with
1033 .Cm got revert .
1034 If the edited history contains changes to files outside of the work tree's
1035 path prefix, the work tree cannot be used to edit the history of this branch.
1036 .Pp
1037 The
1038 .Cm got update
1039 command will refuse to run while a histedit operation is in progress.
1040 Other commands which manipulate the work tree may be used, and the
1041 .Cm got commit
1042 command may be used to commit arbitrary changes to the temporary branch
1043 while the histedit operation is interrupted.
1044 .Pp
1045 The options for
1046 .Cm got histedit
1047 are as follows:
1048 .Bl -tag -width Ds
1049 .It Fl a
1050 Abort an interrupted histedit operation.
1051 If this option is used, no other command-line arguments are allowed.
1052 .It Fl c
1053 Continue an interrupted histedit operation.
1054 If this option is used, no other command-line arguments are allowed.
1055 .El
1056 .It Cm he
1057 Short alias for
1058 .Cm histedit .
1059 .It Cm integrate Ar branch
1060 Integrate the specified
1061 .Ar branch
1062 into the work tree's current branch.
1063 Files in the work tree are updated to match the contents on the integrated
1064 .Ar branch ,
1065 and the reference of the work tree's branch is changed to point at the
1066 head commit of the integrated
1067 .Ar branch .
1068 .Pp
1069 Both branches can be considered equivalent after integration since they
1070 will be pointing at the same commit.
1071 Both branches remain available for future work, if desired.
1072 In case the integrated
1073 .Ar branch
1074 is no longer needed it may be deleted with
1075 .Cm got branch -d .
1076 .Pp
1077 Show the status of each affected file, using the following status codes:
1078 .Bl -column YXZ description
1079 .It U Ta file was updated
1080 .It D Ta file was deleted
1081 .It A Ta new file was added
1082 .It \(a~ Ta versioned file is obstructed by a non-regular file
1083 .It ! Ta a missing versioned file was restored
1084 .El
1085 .Pp
1086 .Cm got integrate
1087 will refuse to run if certain preconditions are not met.
1088 Most importantly, the
1089 .Ar branch
1090 must have been rebased onto the work tree's current branch with
1091 .Cm got rebase
1092 before it can be integrated, in order to linearize commit history and
1093 resolve merge conflicts.
1094 If the work tree contains multiple base commits it must first be updated
1095 to a single base commit with
1096 .Cm got update .
1097 If changes have been staged with
1098 .Cm got stage ,
1099 these changes must first be committed with
1100 .Cm got commit
1101 or unstaged with
1102 .Cm got unstage .
1103 If the work tree contains local changes, these changes must first be
1104 committed with
1105 .Cm got commit
1106 or reverted with
1107 .Cm got revert .
1108 .It Cm ig
1109 Short alias for
1110 .Cm integrate .
1111 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1112 Stage local changes for inclusion in the next commit.
1113 If no
1114 .Ar path
1115 is specified, stage all changes in the work tree.
1116 Otherwise, stage changes at or within the specified paths.
1117 Paths may be staged if they are added, modified, or deleted according to
1118 .Cm got status .
1119 .Pp
1120 Show the status of each affected file, using the following status codes:
1121 .Bl -column YXZ description
1122 .It A Ta file addition has been staged
1123 .It M Ta file modification has been staged
1124 .It D Ta file deletion has been staged
1125 .El
1126 .Pp
1127 Staged file contents are saved in newly created blob objects in the repository.
1128 These blobs will be referred to by tree objects once staged changes have been
1129 committed.
1130 .Pp
1131 Staged changes affect the behaviour of
1132 .Cm got commit ,
1133 .Cm got status ,
1134 and
1135 .Cm got diff .
1136 While paths with staged changes exist, the
1137 .Cm got commit
1138 command will refuse to commit any paths which do not have staged changes.
1139 Local changes created on top of staged changes can only be committed if
1140 the path is staged again, or if the staged changes are committed first.
1141 The
1142 .Cm got status
1143 command will show both local changes and staged changes.
1144 The
1145 .Cm got diff
1146 command is able to display local changes relative to staged changes,
1147 and to display staged changes relative to the repository.
1148 The
1149 .Cm got revert
1150 command cannot revert staged changes but may be used to revert
1151 local changes created on top of staged changes.
1152 .Pp
1153 The options for
1154 .Cm got stage
1155 are as follows:
1156 .Bl -tag -width Ds
1157 .It Fl l
1158 Instead of staging new changes, list paths which are already staged,
1159 along with the IDs of staged blob objects and stage status codes.
1160 If paths were provided in the command line show the staged paths
1161 among the specified paths.
1162 Otherwise, show all staged paths.
1163 .It Fl p
1164 Instead of staging the entire content of a changed file, interactively
1165 select or reject changes for staging based on
1166 .Dq y
1167 (stage change),
1168 .Dq n
1169 (reject change), and
1170 .Dq q
1171 (quit staging this file) responses.
1172 If a file is in modified status, individual patches derived from the
1173 modified file content can be staged.
1174 Files in added or deleted status may only be staged or rejected in
1175 their entirety.
1176 .It Fl F Ar response-script
1177 With the
1178 .Fl p
1179 option, read
1180 .Dq y ,
1181 .Dq n ,
1182 and
1183 .Dq q
1184 responses line-by-line from the specified
1185 .Ar response-script
1186 file instead of prompting interactively.
1187 .El
1188 .Pp
1189 .Cm got stage
1190 will refuse to run if certain preconditions are not met.
1191 If a file contains merge conflicts, these conflicts must be resolved first.
1192 If a file is found to be out of date relative to the head commit on the
1193 work tree's current branch, the file must be updated with
1194 .Cm got update
1195 before it can be staged (however, this does not prevent the file from
1196 becoming out-of-date at some point after having been staged).
1197 .Pp
1198 The
1199 .Cm got update ,
1200 .Cm got rebase ,
1201 and
1202 .Cm got histedit
1203 commands will refuse to run while staged changes exist.
1204 If staged changes cannot be committed because a staged path
1205 is out of date, the path must be unstaged with
1206 .Cm got unstage
1207 before it can be updated with
1208 .Cm got update ,
1209 and may then be staged again if necessary.
1210 .It Cm sg
1211 Short alias for
1212 .Cm stage .
1213 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1214 Merge staged changes back into the work tree and put affected paths
1215 back into non-staged status.
1216 If no
1217 .Ar path
1218 is specified, unstage all staged changes across the entire work tree.
1219 Otherwise, unstage changes at or within the specified paths.
1220 .Pp
1221 Show the status of each affected file, using the following status codes:
1222 .Bl -column YXZ description
1223 .It G Ta file was unstaged
1224 .It C Ta file was unstaged and conflicts occurred during merge
1225 .It ! Ta changes destined for a missing file were not merged
1226 .It D Ta file was staged as deleted and still is deleted
1227 .It d Ta file's deletion was obstructed by local modifications
1228 .It \(a~ Ta changes destined for a non-regular file were not merged
1229 .El
1230 .Pp
1231 The options for
1232 .Cm got unstage
1233 are as follows:
1234 .Bl -tag -width Ds
1235 .It Fl p
1236 Instead of unstaging the entire content of a changed file, interactively
1237 select or reject changes for unstaging based on
1238 .Dq y
1239 (unstage change),
1240 .Dq n
1241 (keep change staged), and
1242 .Dq q
1243 (quit unstaging this file) responses.
1244 If a file is staged in modified status, individual patches derived from the
1245 staged file content can be unstaged.
1246 Files staged in added or deleted status may only be unstaged in their entirety.
1247 .It Fl F Ar response-script
1248 With the
1249 .Fl p
1250 option, read
1251 .Dq y ,
1252 .Dq n ,
1253 and
1254 .Dq q
1255 responses line-by-line from the specified
1256 .Ar response-script
1257 file instead of prompting interactively.
1258 .El
1259 .It Cm ug
1260 Short alias for
1261 .Cm unstage .
1262 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1263 Parse and print contents of objects to standard output in a line-based
1264 text format.
1265 Content of commit, tree, and tag objects is printed in a way similar
1266 to the actual content stored in such objects.
1267 Blob object contents are printed as they would appear in files on disk.
1268 .Pp
1269 Attempt to interpret each argument as a reference, a tag name, or
1270 an object ID SHA1 hash.
1271 References will be resolved to an object ID.
1272 Tag names will resolved to a tag object.
1273 An abbreviated hash argument will be expanded to a full SHA1 hash
1274 automatically, provided the abbreviation is unique.
1275 .Pp
1276 If none of the above interpretations produce a valid result, or if the
1277 .Fl P
1278 option is used, attempt to interpret the argument as a path which will
1279 be resolved to the ID of an object found at this path in the repository.
1280 .Pp
1281 The options for
1282 .Cm got cat
1283 are as follows:
1284 .Bl -tag -width Ds
1285 .It Fl c Ar commit
1286 Look up paths in the specified
1287 .Ar commit .
1288 If this option is not used, paths are looked up in the commit resolved
1289 via the repository's HEAD reference.
1290 The expected argument is a commit ID SHA1 hash or an existing reference
1291 or tag name which will be resolved to a commit ID.
1292 An abbreviated hash argument will be expanded to a full SHA1 hash
1293 automatically, provided the abbreviation is unique.
1294 .It Fl r Ar repository-path
1295 Use the repository at the specified path.
1296 If not specified, assume the repository is located at or above the current
1297 working directory.
1298 If this directory is a
1299 .Nm
1300 work tree, use the repository path associated with this work tree.
1301 .It Fl P
1302 Interpret all arguments as paths only.
1303 This option can be used to resolve ambiguity in cases where paths
1304 look like tag names, reference names, or object IDs.
1305 .El
1306 .El
1307 .Sh ENVIRONMENT
1308 .Bl -tag -width GOT_AUTHOR
1309 .It Ev GOT_AUTHOR
1310 The author's name and email address for
1311 .Cm got commit
1312 and
1313 .Cm got import ,
1314 for example:
1315 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1316 Because
1317 .Xr git 1
1318 may fail to parse commits without an email address in author data,
1319 .Nm
1320 attempts to reject
1321 .Ev GOT_AUTHOR
1322 environment variables with a missing email address.
1323 .Pp
1324 If present, Git's
1325 .Dv user.name
1326 and
1327 .Dv user.email
1328 configuration settings in the repository's
1329 .Pa .git/config
1330 file will override the value of
1331 .Ev GOT_AUTHOR .
1332 However, the
1333 .Dv user.name
1334 and
1335 .Dv user.email
1336 configuration settings contained in Git's global
1337 .Pa ~/.gitconfig
1338 configuration file will be used only if the
1339 .Ev GOT_AUTHOR
1340 environment variable is
1341 .Em not
1342 set.
1343 .It Ev VISUAL , EDITOR
1344 The editor spawned by
1345 .Cm got commit ,
1346 .Cm got import ,
1348 .Cm got tag .
1349 .It Ev GOT_LOG_DEFAULT_LIMIT
1350 The default limit on the number of commits traversed by
1351 .Cm got log .
1352 If set to zero, the limit is unbounded.
1353 This variable will be silently ignored if it is set to a non-numeric value.
1354 .El
1355 .Sh EXIT STATUS
1356 .Ex -std got
1357 .Sh EXAMPLES
1358 Clone an existing Git repository for use with
1359 .Nm .
1360 This step currently requires
1361 .Xr git 1 :
1362 .Pp
1363 .Dl $ cd /var/git/
1364 .Dl $ git clone --bare https://github.com/openbsd/src.git
1365 .Pp
1366 Alternatively, for quick and dirty local testing of
1367 .Nm
1368 a new Git repository could be created and populated with files,
1369 e.g. from a temporary CVS checkout located at
1370 .Pa /tmp/src :
1371 .Pp
1372 .Dl $ got init /var/git/src.git
1373 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1374 .Pp
1375 Check out a work tree from the Git repository to /usr/src:
1376 .Pp
1377 .Dl $ got checkout /var/git/src.git /usr/src
1378 .Pp
1379 View local changes in a work tree directory:
1380 .Pp
1381 .Dl $ got status
1382 .Dl $ got diff | less
1383 .Pp
1384 Interactively revert selected local changes in a work tree directory:
1385 .Pp
1386 .Dl $ got revert -p -R\ .
1387 .Pp
1388 In a work tree or a git repository directory, list all branch references:
1389 .Pp
1390 .Dl $ got branch -l
1391 .Pp
1392 In a work tree or a git repository directory, create a new branch called
1393 .Dq unified-buffer-cache
1394 which is forked off the
1395 .Dq master
1396 branch:
1397 .Pp
1398 .Dl $ got branch unified-buffer-cache master
1399 .Pp
1400 Switch an existing work tree to the branch
1401 .Dq unified-buffer-cache .
1402 Local changes in the work tree will be preserved and merged if necessary:
1403 .Pp
1404 .Dl $ got update -b unified-buffer-cache
1405 .Pp
1406 Create a new commit from local changes in a work tree directory.
1407 This new commit will become the head commit of the work tree's current branch:
1408 .Pp
1409 .Dl $ got commit
1410 .Pp
1411 In a work tree or a git repository directory, view changes committed in
1412 the 3 most recent commits to the work tree's branch, or the branch resolved
1413 via the repository's HEAD reference, respectively:
1414 .Pp
1415 .Dl $ got log -p -l 3 -f
1416 .Pp
1417 Add new files and remove obsolete files in a work tree directory:
1418 .Pp
1419 .Dl $ got add sys/uvm/uvm_ubc.c
1420 .Dl $ got remove sys/uvm/uvm_vnode.c
1421 .Pp
1422 Create a new commit from local changes in a work tree directory
1423 with a pre-defined log message.
1424 .Pp
1425 .Dl $ got commit -m 'unify the buffer cache'
1426 .Pp
1427 Update any work tree checked out from the
1428 .Dq unified-buffer-cache
1429 branch to the latest commit on this branch:
1430 .Pp
1431 .Dl $ got update
1432 .Pp
1433 Roll file content on the unified-buffer-cache branch back by one commit,
1434 and then fetch the rolled-back change into the work tree as a local change
1435 to be amended and perhaps committed again:
1436 .Pp
1437 .Dl $ got backout unified-buffer-cache
1438 .Dl $ got commit -m 'roll back previous'
1439 .Dl $ # now back out the previous backout :-)
1440 .Dl $ got backout unified-buffer-cache
1441 .Pp
1442 Fetch new upstream commits into the local repository's master branch.
1443 This step currently requires
1444 .Xr git 1 :
1445 .Pp
1446 .Dl $ cd /var/git/src.git
1447 .Dl $ git fetch origin master:master
1448 .Pp
1449 Rebase the
1450 .Dq unified-buffer-cache
1451 branch on top of the new head commit of the
1452 .Dq master
1453 branch.
1454 .Pp
1455 .Dl $ got update -b master
1456 .Dl $ got rebase unified-buffer-cache
1457 .Pp
1458 Create a patch from all changes on the unified-buffer-cache branch.
1459 The patch can be mailed out for review and applied to
1460 .Ox Ns 's
1461 CVS tree:
1462 .Pp
1463 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
1464 .Pp
1465 Edit the entire commit history of the
1466 .Dq unified-buffer-cache
1467 branch:
1468 .Pp
1469 .Dl $ got update -b unified-buffer-cache
1470 .Dl $ got update -c master
1471 .Dl $ got histedit
1472 .Pp
1473 Additional steps are necessary if local changes need to be pushed back
1474 to the remote repository, which currently requires
1475 .Cm git fetch
1476 and
1477 .Cm git push .
1478 Before working against existing branches in a repository cloned with
1479 .Dq git clone --bare ,
1480 a Git
1481 .Dq refspec
1482 must be configured to map all references in the remote repository
1483 into the
1484 .Dq refs/remotes
1485 namespace of the local repository.
1486 This can achieved by setting Git's
1487 .Pa remote.origin.fetch
1488 configuration variable to the value
1489 .Dq +refs/heads/*:refs/remotes/origin/*
1490 with the
1491 .Cm git config
1492 command:
1493 .Pp
1494 .Dl $ cd /var/git/repo
1495 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
1496 .Pp
1497 Alternatively, the following
1498 .Pa fetch
1499 configuration item can be added manually to the Git repository's
1500 .Pa config
1501 file:
1502 .Pp
1503 .Dl [remote "origin"]
1504 .Dl url = ...
1505 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
1506 .Pp
1507 This configuration leaves the local repository's
1508 .Dq refs/heads
1509 namespace free for use by local branches checked out with
1510 .Cm got checkout
1511 and, if needed, created with
1512 .Cm got branch .
1513 .Pp
1514 Branches in the
1515 .Dq remotes/origin
1516 namespace can be updated with incoming changes from the remote
1517 repository with
1518 .Cm git fetch :
1519 .Pp
1520 .Dl $ cd /var/git/repo
1521 .Dl $ git fetch
1522 .Pp
1523 Before outgoing changes on the local
1524 .Dq master
1525 branch can be pushed to the remote repository, the local
1526 .Dq master
1527 branch must be rebased onto the
1528 .Dq origin/master
1529 branch:
1530 .Pp
1531 .Dl $ got update -b origin/master
1532 .Dl $ got rebase master
1533 .Pp
1534 Changes on the local
1535 .Dq master
1536 branch can then be pushed to the remote
1537 repository with
1538 .Cm git push :
1539 .Pp
1540 .Dl $ cd /var/git/repo
1541 .Dl $ git push origin master
1542 .Pp
1543 In order to merge changes committed to the
1544 .Dq unified-buffer-cache
1545 branch back into the
1546 .Dq master
1547 branch, the
1548 .Dq unified-buffer-cache
1549 branch must first be rebased onto the
1550 .Dq master
1551 branch:
1552 .Pp
1553 .Dl $ got update -b master
1554 .Dl $ got rebase unified-buffer-cache
1555 .Pp
1556 Changes on the
1557 .Dq unified-buffer-cache
1558 branch can now be made visible on the
1559 .Dq master
1560 branch with
1561 .Cm got integrate .
1562 Because the rebase operation switched the work tree to the
1563 .Dq unified-buffer-cache
1564 branch, the work tree must be switched back to the
1565 .Dq master
1566 branch before the
1567 .Dq unified-buffer-cache
1568 branch can be integrated into
1569 .Dq master :
1570 .Pp
1571 .Dl $ got update -b master
1572 .Dl $ got integrate unified-buffer-cache
1573 .Pp
1574 .Sh SEE ALSO
1575 .Xr tog 1 ,
1576 .Xr git-repository 5 ,
1577 .Xr got-worktree 5
1578 .Sh AUTHORS
1579 .An Stefan Sperling Aq Mt stsp@openbsd.org
1580 .An Martin Pieuchot Aq Mt mpi@openbsd.org
1581 .An Joshua Stein Aq Mt jcs@openbsd.org
1582 .Sh CAVEATS
1583 .Nm
1584 is a work-in-progress and many commands remain to be implemented.
1585 At present, the user has to fall back on
1586 .Xr git 1
1587 to perform many tasks, in particular tasks related to repository
1588 administration and tasks which require a network connection.