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 master .
113 Use of this option is required if the
114 .Dq master
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 r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Op Ar name Op Ar commit
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 one or two arguments are passed, attempt to create a branch reference
525 with the given
526 .Ar name ,
527 and make it point at the given
528 .Ar commit .
529 The expected
530 .Ar commit
531 argument is a commit ID SHA1 hash or an existing reference
532 or tag name which will be resolved to a commit ID.
533 If no
534 .Ar commit
535 is specified, default to the latest commit on the work tree's current
536 branch if invoked in a work tree, or to a commit resolved via the
537 repository's HEAD reference.
538 .Pp
539 The options for
540 .Cm got branch
541 are as follows:
542 .Bl -tag -width Ds
543 .It Fl r Ar repository-path
544 Use the repository at the specified path.
545 If not specified, assume the repository is located at or above the current
546 working directory.
547 If this directory is a
548 .Nm
549 work tree, use the repository path associated with this work tree.
550 .It Fl l
551 List all existing branches in the repository.
552 If invoked in a work tree, the work tree's current branch is shown
553 with one the following annotations:
554 .Bl -column YXZ description
555 .It * Ta work tree's base commit matches the branch tip
556 .It \(a~ Ta work tree's base commit is out-of-date
557 .El
558 .It Fl d Ar name
559 Delete the branch with the specified name from the repository.
560 Only the branch reference is deleted.
561 Any commit, tree, and blob objects belonging to the branch
562 remain in the repository and may be removed separately with
563 Git's garbage collector.
564 .El
565 .It Cm br
566 Short alias for
567 .Cm branch .
568 .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
569 Manage tags in a repository.
570 .Pp
571 Tags are managed via references which live in the
572 .Dq refs/tags/
573 reference namespace.
574 The
575 .Cm got tag
576 command operates on references in this namespace only.
577 References in this namespace point at tag objects which contain a pointer
578 to another object, a tag message, as well as author and timestamp information.
579 .Pp
580 Expect one or two arguments and attempt to create a tag with the given
581 .Ar name ,
582 and make this tag point at the given
583 .Ar commit .
584 If no commit is specified, default to the latest commit on the work tree's
585 current branch if invoked in a work tree, and to a commit resolved via
586 the repository's HEAD reference otherwise.
587 Otherwise, the expected argument is a commit ID SHA1 hash or an existing
588 reference or tag name which will be resolved to a commit ID.
589 An abbreviated hash argument will be expanded to a full SHA1 hash
590 automatically, provided the abbreviation is unique.
591 .Pp
592 The options for
593 .Cm got tag
594 are as follows:
595 .Bl -tag -width Ds
596 .It Fl m Ar message
597 Use the specified tag message when creating the new tag
598 Without the
599 .Fl m
600 option,
601 .Cm got import
602 opens a temporary file in an editor where a tag message can be written.
603 .It Fl r Ar repository-path
604 Use the repository at the specified path.
605 If not specified, assume the repository is located at or above the current
606 working directory.
607 If this directory is a
608 .Nm
609 work tree, use the repository path associated with this work tree.
610 .It Fl l
611 List all existing tags in the repository instead of creating a new tag.
612 If this option is used, no other command-line arguments are allowed.
613 .El
614 .Pp
615 By design, the
616 .Cm got tag
617 command will not delete tags or change existing tags.
618 If a tag must be deleted, the
619 .Cm got ref
620 command may be used to delete a tag's reference.
621 This should only be done if the tag has not already been copied to
622 another repository.
623 .It Cm add Ar file-path ...
624 Schedule unversioned files in a work tree for addition to the
625 repository in the next commit.
626 .It Cm remove Ar file-path ...
627 Remove versioned files from a work tree and schedule them for deletion
628 from the repository in the next commit.
629 .Pp
630 The options for
631 .Cm got remove
632 are as follows:
633 .Bl -tag -width Ds
634 .It Fl f
635 Perform the operation even if a file contains uncommitted modifications.
636 .El
637 .It Cm rm
638 Short alias for
639 .Cm remove .
640 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
641 Revert any uncommitted changes in files at the specified paths.
642 File contents will be overwritten with those contained in the
643 work tree's base commit.
644 There is no way to bring discarded changes back after
645 .Cm got revert !
646 .Pp
647 If a file was added with
648 .Cm got add
649 it will become an unversioned file again.
650 If a file was deleted with
651 .Cm got remove
652 it will be restored.
653 .Pp
654 The options for
655 .Cm got revert
656 are as follows:
657 .Bl -tag -width Ds
658 .It Fl p
659 Instead of reverting all changes in files, interactively select or reject
660 changes to revert based on
661 .Dq y
662 (revert change),
663 .Dq n
664 (keep change), and
665 .Dq q
666 (quit reverting this file) responses.
667 If a file is in modified status, individual patches derived from the
668 modified file content can be reverted.
669 Files in added or deleted status may only be reverted in their entirety.
670 .It Fl F Ar response-script
671 With the
672 .Fl p
673 option, read
674 .Dq y ,
675 .Dq n ,
676 and
677 .Dq q
678 responses line-by-line from the specified
679 .Ar response-script
680 file instead of prompting interactively.
681 .It Fl R
682 Permit recursion into directories.
683 If this option is not specified,
684 .Cm got revert
685 will refuse to run if a specified
686 .Ar path
687 is a directory.
688 .El
689 .It Cm rv
690 Short alias for
691 .Cm revert .
692 .It Cm commit Oo Fl m Ar message Oc Op Ar path ...
693 Create a new commit in the repository from changes in a work tree
694 and use this commit as the new base commit for the work tree.
695 If no
696 .Ar path
697 is specified, commit all changes in the work tree.
698 Otherwise, commit changes at or within the specified paths.
699 .Pp
700 If changes have been explicitly staged for commit with
701 .Cm got stage ,
702 only commit staged changes and reject any specified paths which
703 have not been staged.
704 .Pp
705 Show the status of each affected file, using the following status codes:
706 .Bl -column YXZ description
707 .It M Ta modified file
708 .It D Ta file was deleted
709 .It A Ta new file was added
710 .It m Ta modified file modes (executable bit only)
711 .El
712 .Pp
713 Files which are not part of the new commit will retain their previously
714 recorded base commit.
715 Some
716 .Nm
717 commands may refuse to run while the work tree contains files from
718 multiple base commits.
719 The base commit of such a work tree can be made consistent by running
720 .Cm got update
721 across the entire work tree.
722 .Pp
723 The
724 .Cm got commit
725 command requires the
726 .Ev GOT_AUTHOR
727 environment variable to be set,
728 unless Git's
729 .Dv user.name
730 and
731 .Dv user.email
732 configuration settings can be
733 obtained from the repository's
734 .Pa .git/config
735 file or from Git's global
736 .Pa ~/.gitconfig
737 configuration file.
738 .Pp
739 The options for
740 .Cm got commit
741 are as follows:
742 .Bl -tag -width Ds
743 .It Fl m Ar message
744 Use the specified log message when creating the new commit.
745 Without the
746 .Fl m
747 option,
748 .Cm got commit
749 opens a temporary file in an editor where a log message can be written.
750 .El
751 .Pp
752 .Cm got commit
753 will refuse to run if certain preconditions are not met.
754 If the work tree's current branch is not in the
755 .Dq refs/heads/
756 reference namespace, new commits may not be created on this branch.
757 Local changes may only be committed if they are based on file content
758 found in the most recent commit on the work tree's branch.
759 If a path is found to be out of date,
760 .Cm got update
761 must be used first in order to merge local changes with changes made
762 in the repository.
763 .It Cm ci
764 Short alias for
765 .Cm commit .
766 .It Cm cherrypick Ar commit
767 Merge changes from a single
768 .Ar commit
769 into the work tree.
770 The specified
771 .Ar commit
772 must be on a different branch than the work tree's base commit.
773 The expected argument is a reference or a commit ID SHA1 hash.
774 An abbreviated hash argument will be expanded to a full SHA1 hash
775 automatically, provided the abbreviation is unique.
776 .Pp
777 Show the status of each affected file, using the following status codes:
778 .Bl -column YXZ description
779 .It G Ta file was merged
780 .It C Ta file was merged and conflicts occurred during merge
781 .It ! Ta changes destined for a missing file were not merged
782 .It D Ta file was deleted
783 .It d Ta file's deletion was obstructed by local modifications
784 .It A Ta new file was added
785 .It \(a~ Ta changes destined for a non-regular file were not merged
786 .El
787 .Pp
788 The merged changes will appear as local changes in the work tree, which
789 may be viewed with
790 .Cm got diff ,
791 amended manually or with further
792 .Cm got cherrypick
793 commands,
794 committed with
795 .Cm got commit ,
796 or discarded again with
797 .Cm got revert .
798 .Pp
799 .Cm got cherrypick
800 will refuse to run if certain preconditions are not met.
801 If the work tree contains multiple base commits it must first be updated
802 to a single base commit with
803 .Cm got update .
804 If the work tree already contains files with merge conflicts, these
805 conflicts must be resolved first.
806 .It Cm cy
807 Short alias for
808 .Cm cherrypick .
809 .It Cm backout Ar commit
810 Reverse-merge changes from a single
811 .Ar commit
812 into the work tree.
813 The specified
814 .Ar commit
815 must be on the same branch as the work tree's base commit.
816 The expected argument is a reference or a commit ID SHA1 hash.
817 An abbreviated hash argument will be expanded to a full SHA1 hash
818 automatically, provided the abbreviation is unique.
819 .Pp
820 Show the status of each affected file, using the following status codes:
821 .Bl -column YXZ description
822 .It G Ta file was merged
823 .It C Ta file was merged and conflicts occurred during merge
824 .It ! Ta changes destined for a missing file were not merged
825 .It D Ta file was deleted
826 .It d Ta file's deletion was obstructed by local modifications
827 .It A Ta new file was added
828 .It \(a~ Ta changes destined for a non-regular file were not merged
829 .El
830 .Pp
831 The reverse-merged changes will appear as local changes in the work tree,
832 which may be viewed with
833 .Cm got diff ,
834 amended manually or with further
835 .Cm got backout
836 commands,
837 committed with
838 .Cm got commit ,
839 or discarded again with
840 .Cm got revert .
841 .Pp
842 .Cm got backout
843 will refuse to run if certain preconditions are not met.
844 If the work tree contains multiple base commits it must first be updated
845 to a single base commit with
846 .Cm got update .
847 If the work tree already contains files with merge conflicts, these
848 conflicts must be resolved first.
849 .It Cm bo
850 Short alias for
851 .Cm backout .
852 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
853 Rebase commits on the specified
854 .Ar branch
855 onto the tip of the current branch of the work tree.
856 The
857 .Ar branch
858 must share common ancestry with the work tree's current branch.
859 Rebasing begins with the first descendant commit of the youngest
860 common ancestor commit shared by the specified
861 .Ar branch
862 and the work tree's current branch, and stops once the tip commit
863 of the specified
864 .Ar branch
865 has been rebased.
866 .Pp
867 Rebased commits are accumulated on a temporary branch which the work tree
868 will remain switched to throughout the entire rebase operation.
869 Commits on this branch represent the same changes with the same log
870 messages as their counterparts on the original
871 .Ar branch ,
872 but with different commit IDs.
873 Once rebasing has completed successfully, the temporary branch becomes
874 the new version of the specified
875 .Ar branch
876 and the work tree is automatically switched to it.
877 .Pp
878 While rebasing commits, show the status of each affected file,
879 using the following status codes:
880 .Bl -column YXZ description
881 .It G Ta file was merged
882 .It C Ta file was merged and conflicts occurred during merge
883 .It ! Ta changes destined for a missing file were not merged
884 .It D Ta file was deleted
885 .It d Ta file's deletion was obstructed by local modifications
886 .It A Ta new file was added
887 .It \(a~ Ta changes destined for a non-regular file were not merged
888 .El
889 .Pp
890 If merge conflicts occur the rebase operation is interrupted and may
891 be continued once conflicts have been resolved.
892 Alternatively, the rebase operation may be aborted which will leave
893 .Ar branch
894 unmodified and the work tree switched back to its original branch.
895 .Pp
896 If a merge conflict is resolved in a way which renders the merged
897 change into a no-op change, the corresponding commit will be elided
898 when the rebase operation continues.
899 .Pp
900 .Cm got rebase
901 will refuse to run if certain preconditions are not met.
902 If the work tree contains multiple base commits it must first be updated
903 to a single base commit with
904 .Cm got update .
905 If changes have been staged with
906 .Cm got stage ,
907 these changes must first be committed with
908 .Cm got commit
909 or unstaged with
910 .Cm got unstage .
911 If the work tree contains local changes, these changes must first be
912 committed with
913 .Cm got commit
914 or reverted with
915 .Cm got revert .
916 If the
917 .Ar branch
918 contains changes to files outside of the work tree's path prefix,
919 the work tree cannot be used to rebase this branch.
920 .Pp
921 The
922 .Cm got update
923 and
924 .Cm got commit
925 commands will refuse to run while a rebase operation is in progress.
926 Other commands which manipulate the work tree may be used for
927 conflict resolution purposes.
928 .Pp
929 The options for
930 .Cm got rebase
931 are as follows:
932 .Bl -tag -width Ds
933 .It Fl a
934 Abort an interrupted rebase operation.
935 If this option is used, no other command-line arguments are allowed.
936 .It Fl c
937 Continue an interrupted rebase operation.
938 If this option is used, no other command-line arguments are allowed.
939 .El
940 .It Cm rb
941 Short alias for
942 .Cm rebase .
943 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Op Fl F Ar histedit-script
944 Edit commit history between the work tree's current base commit and
945 the tip commit of the work tree's current branch.
946 .Pp
947 Editing of commit history is controlled via a
948 .Ar histedit script
949 which can be edited interactively or passed on the command line.
950 The format of the histedit script is line-based.
951 Each line in the script begins with a command name, followed by
952 whitespace and an argument.
953 For most commands, the expected argument is a commit ID SHA1 hash.
954 Any remaining text on the line is ignored.
955 Lines which begin with the
956 .Sq #
957 character are ignored entirely.
958 .Pp
959 The available commands are as follows:
960 .Bl -column YXZ pick-commit
961 .It pick Ar commit Ta Use the specified commit as it is.
962 .It edit Ar commit Ta Use the specified commit but once changes have been
963 merged into the work tree interrupt the histedit operation for amending.
964 .It fold Ar commit Ta Combine the specified commit with the next commit
965 listed further below that will be used.
966 .It drop Ar commit Ta Remove this commit from the edited history.
967 .It mesg Ar log-message Ta Use the specified single-line log message for
968 the commit on the previous line.
969 If the log message argument is left empty, open an editor where a new
970 log message can be written.
971 .El
972 .Pp
973 Every commit in the history being edited must be mentioned in the script.
974 Lines may be re-ordered to change the order of commits in the edited history.
975 .Pp
976 Edited commits are accumulated on a temporary branch which the work tree
977 will remain switched to throughout the entire histedit operation.
978 Once history editing has completed successfully, the temporary branch becomes
979 the new version of the work tree's branch and the work tree is automatically
980 switched to it.
981 .Pp
982 While merging commits, show the status of each affected file,
983 using the following status codes:
984 .Bl -column YXZ description
985 .It G Ta file was merged
986 .It C Ta file was merged and conflicts occurred during merge
987 .It ! Ta changes destined for a missing file were not merged
988 .It D Ta file was deleted
989 .It d Ta file's deletion was obstructed by local modifications
990 .It A Ta new file was added
991 .It \(a~ Ta changes destined for a non-regular file were not merged
992 .El
993 .Pp
994 If merge conflicts occur the histedit operation is interrupted and may
995 be continued once conflicts have been resolved.
996 Alternatively, the histedit operation may be aborted which will leave
997 the work tree switched back to its original branch.
998 .Pp
999 If a merge conflict is resolved in a way which renders the merged
1000 change into a no-op change, the corresponding commit will be elided
1001 when the histedit operation continues.
1002 .Pp
1003 .Cm got histedit
1004 will refuse to run if certain preconditions are not met.
1005 If the work tree's current branch is not in the
1006 .Dq refs/heads/
1007 reference namespace, the history of the branch may not be edited.
1008 If the work tree contains multiple base commits it must first be updated
1009 to a single base commit with
1010 .Cm got update .
1011 If changes have been staged with
1012 .Cm got stage ,
1013 these changes must first be committed with
1014 .Cm got commit
1015 or unstaged with
1016 .Cm got unstage .
1017 If the work tree contains local changes, these changes must first be
1018 committed with
1019 .Cm got commit
1020 or reverted with
1021 .Cm got revert .
1022 If the edited history contains changes to files outside of the work tree's
1023 path prefix, the work tree cannot be used to edit the history of this branch.
1024 .Pp
1025 The
1026 .Cm got update
1027 command will refuse to run while a histedit operation is in progress.
1028 Other commands which manipulate the work tree may be used, and the
1029 .Cm got commit
1030 command may be used to commit arbitrary changes to the temporary branch
1031 while the histedit operation is interrupted.
1032 .Pp
1033 The options for
1034 .Cm got histedit
1035 are as follows:
1036 .Bl -tag -width Ds
1037 .It Fl a
1038 Abort an interrupted histedit operation.
1039 If this option is used, no other command-line arguments are allowed.
1040 .It Fl c
1041 Continue an interrupted histedit operation.
1042 If this option is used, no other command-line arguments are allowed.
1043 .El
1044 .It Cm he
1045 Short alias for
1046 .Cm histedit .
1047 .It Cm integrate Ar branch
1048 Integrate the specified
1049 .Ar branch
1050 into the work tree's current branch.
1051 Files in the work tree are updated to match the contents on the integrated
1052 .Ar branch ,
1053 and the reference of the work tree's branch is changed to point at the
1054 head commit of the integrated
1055 .Ar branch .
1056 .Pp
1057 Both branches can be considered equivalent after integration since they
1058 will be pointing at the same commit.
1059 Both branches remain available for future work, if desired.
1060 In case the integrated
1061 .Ar branch
1062 is no longer needed it may be deleted with
1063 .Cm got branch -d .
1064 .Pp
1065 Show the status of each affected file, using the following status codes:
1066 .Bl -column YXZ description
1067 .It U Ta file was updated
1068 .It D Ta file was deleted
1069 .It A Ta new file was added
1070 .It \(a~ Ta versioned file is obstructed by a non-regular file
1071 .It ! Ta a missing versioned file was restored
1072 .El
1073 .Pp
1074 .Cm got integrate
1075 will refuse to run if certain preconditions are not met.
1076 Most importantly, the
1077 .Ar branch
1078 must have been rebased onto the work tree's current branch with
1079 .Cm got rebase
1080 before it can be integrated, in order to linearize commit history and
1081 resolve merge conflicts.
1082 If the work tree contains multiple base commits it must first be updated
1083 to a single base commit with
1084 .Cm got update .
1085 If changes have been staged with
1086 .Cm got stage ,
1087 these changes must first be committed with
1088 .Cm got commit
1089 or unstaged with
1090 .Cm got unstage .
1091 If the work tree contains local changes, these changes must first be
1092 committed with
1093 .Cm got commit
1094 or reverted with
1095 .Cm got revert .
1096 .It Cm ig
1097 Short alias for
1098 .Cm integrate .
1099 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1100 Stage local changes for inclusion in the next commit.
1101 If no
1102 .Ar path
1103 is specified, stage all changes in the work tree.
1104 Otherwise, stage changes at or within the specified paths.
1105 Paths may be staged if they are added, modified, or deleted according to
1106 .Cm got status .
1107 .Pp
1108 Show the status of each affected file, using the following status codes:
1109 .Bl -column YXZ description
1110 .It A Ta file addition has been staged
1111 .It M Ta file modification has been staged
1112 .It D Ta file deletion has been staged
1113 .El
1114 .Pp
1115 Staged file contents are saved in newly created blob objects in the repository.
1116 These blobs will be referred to by tree objects once staged changes have been
1117 committed.
1118 .Pp
1119 Staged changes affect the behaviour of
1120 .Cm got commit ,
1121 .Cm got status ,
1122 and
1123 .Cm got diff .
1124 While paths with staged changes exist, the
1125 .Cm got commit
1126 command will refuse to commit any paths which do not have staged changes.
1127 Local changes created on top of staged changes can only be committed if
1128 the path is staged again, or if the staged changes are committed first.
1129 The
1130 .Cm got status
1131 command will show both local changes and staged changes.
1132 The
1133 .Cm got diff
1134 command is able to display local changes relative to staged changes,
1135 and to display staged changes relative to the repository.
1136 The
1137 .Cm got revert
1138 command cannot revert staged changes but may be used to revert
1139 local changes created on top of staged changes.
1140 .Pp
1141 The options for
1142 .Cm got stage
1143 are as follows:
1144 .Bl -tag -width Ds
1145 .It Fl l
1146 Instead of staging new changes, list paths which are already staged,
1147 along with the IDs of staged blob objects and stage status codes.
1148 If paths were provided in the command line show the staged paths
1149 among the specified paths.
1150 Otherwise, show all staged paths.
1151 .It Fl p
1152 Instead of staging the entire content of a changed file, interactively
1153 select or reject changes for staging based on
1154 .Dq y
1155 (stage change),
1156 .Dq n
1157 (reject change), and
1158 .Dq q
1159 (quit staging this file) responses.
1160 If a file is in modified status, individual patches derived from the
1161 modified file content can be staged.
1162 Files in added or deleted status may only be staged or rejected in
1163 their entirety.
1164 .It Fl F Ar response-script
1165 With the
1166 .Fl p
1167 option, read
1168 .Dq y ,
1169 .Dq n ,
1170 and
1171 .Dq q
1172 responses line-by-line from the specified
1173 .Ar response-script
1174 file instead of prompting interactively.
1175 .El
1176 .Pp
1177 .Cm got stage
1178 will refuse to run if certain preconditions are not met.
1179 If a file contains merge conflicts, these conflicts must be resolved first.
1180 If a file is found to be out of date relative to the head commit on the
1181 work tree's current branch, the file must be updated with
1182 .Cm got update
1183 before it can be staged (however, this does not prevent the file from
1184 becoming out-of-date at some point after having been staged).
1185 .Pp
1186 The
1187 .Cm got update ,
1188 .Cm got rebase ,
1189 and
1190 .Cm got histedit
1191 commands will refuse to run while staged changes exist.
1192 If staged changes cannot be committed because a staged path
1193 is out of date, the path must be unstaged with
1194 .Cm got unstage
1195 before it can be updated with
1196 .Cm got update ,
1197 and may then be staged again if necessary.
1198 .It Cm sg
1199 Short alias for
1200 .Cm stage .
1201 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1202 Merge staged changes back into the work tree and put affected paths
1203 back into non-staged status.
1204 If no
1205 .Ar path
1206 is specified, unstage all staged changes across the entire work tree.
1207 Otherwise, unstage changes at or within the specified paths.
1208 .Pp
1209 Show the status of each affected file, using the following status codes:
1210 .Bl -column YXZ description
1211 .It G Ta file was unstaged
1212 .It C Ta file was unstaged and conflicts occurred during merge
1213 .It ! Ta changes destined for a missing file were not merged
1214 .It D Ta file was staged as deleted and still is deleted
1215 .It d Ta file's deletion was obstructed by local modifications
1216 .It \(a~ Ta changes destined for a non-regular file were not merged
1217 .El
1218 .Pp
1219 The options for
1220 .Cm got unstage
1221 are as follows:
1222 .Bl -tag -width Ds
1223 .It Fl p
1224 Instead of unstaging the entire content of a changed file, interactively
1225 select or reject changes for unstaging based on
1226 .Dq y
1227 (unstage change),
1228 .Dq n
1229 (keep change staged), and
1230 .Dq q
1231 (quit unstaging this file) responses.
1232 If a file is staged in modified status, individual patches derived from the
1233 staged file content can be unstaged.
1234 Files staged in added or deleted status may only be unstaged in their entirety.
1235 .It Fl F Ar response-script
1236 With the
1237 .Fl p
1238 option, read
1239 .Dq y ,
1240 .Dq n ,
1241 and
1242 .Dq q
1243 responses line-by-line from the specified
1244 .Ar response-script
1245 file instead of prompting interactively.
1246 .El
1247 .It Cm ug
1248 Short alias for
1249 .Cm unstage .
1250 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1251 Parse and print contents of objects to standard output in a line-based
1252 text format.
1253 Content of commit, tree, and tag objects is printed in a way similar
1254 to the actual content stored in such objects.
1255 Blob object contents are printed as they would appear in files on disk.
1256 .Pp
1257 Attempt to interpret each argument as a reference, a tag name, or
1258 an object ID SHA1 hash.
1259 References will be resolved to an object ID.
1260 Tag names will resolved to a tag object.
1261 An abbreviated hash argument will be expanded to a full SHA1 hash
1262 automatically, provided the abbreviation is unique.
1263 .Pp
1264 If none of the above interpretations produce a valid result, or if the
1265 .Fl P
1266 option is used, attempt to interpret the argument as a path which will
1267 be resolved to the ID of an object found at this path in the repository.
1268 .Pp
1269 The options for
1270 .Cm got cat
1271 are as follows:
1272 .Bl -tag -width Ds
1273 .It Fl c Ar commit
1274 Look up paths in the specified
1275 .Ar commit .
1276 If this option is not used, paths are looked up in the commit resolved
1277 via the repository's HEAD reference.
1278 The expected argument is a commit ID SHA1 hash or an existing reference
1279 or tag name which will be resolved to a commit ID.
1280 An abbreviated hash argument will be expanded to a full SHA1 hash
1281 automatically, provided the abbreviation is unique.
1282 .It Fl r Ar repository-path
1283 Use the repository at the specified path.
1284 If not specified, assume the repository is located at or above the current
1285 working directory.
1286 If this directory is a
1287 .Nm
1288 work tree, use the repository path associated with this work tree.
1289 .It Fl P
1290 Interpret all arguments as paths only.
1291 This option can be used to resolve ambiguity in cases where paths
1292 look like tag names, reference names, or object IDs.
1293 .El
1294 .El
1295 .Sh ENVIRONMENT
1296 .Bl -tag -width GOT_AUTHOR
1297 .It Ev GOT_AUTHOR
1298 The author's name and email address for
1299 .Cm got commit
1300 and
1301 .Cm got import ,
1302 for example:
1303 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1304 Because
1305 .Xr git 1
1306 may fail to parse commits without an email address in author data,
1307 .Nm
1308 attempts to reject
1309 .Ev GOT_AUTHOR
1310 environment variables with a missing email address.
1311 .Pp
1312 If present, Git's
1313 .Dv user.name
1314 and
1315 .Dv user.email
1316 configuration settings in the repository's
1317 .Pa .git/config
1318 file will override the value of
1319 .Ev GOT_AUTHOR .
1320 However, the
1321 .Dv user.name
1322 and
1323 .Dv user.email
1324 configuration settings contained in Git's global
1325 .Pa ~/.gitconfig
1326 configuration file will be used only if the
1327 .Ev GOT_AUTHOR
1328 environment variable is
1329 .Em not
1330 set.
1331 .It Ev VISUAL , EDITOR
1332 The editor spawned by
1333 .Cm got commit ,
1334 .Cm got import ,
1336 .Cm got tag .
1337 .It Ev GOT_LOG_DEFAULT_LIMIT
1338 The default limit on the number of commits traversed by
1339 .Cm got log .
1340 If set to zero, the limit is unbounded.
1341 This variable will be silently ignored if it is set to a non-numeric value.
1342 .El
1343 .Sh EXIT STATUS
1344 .Ex -std got
1345 .Sh EXAMPLES
1346 Clone an existing Git repository for use with
1347 .Nm .
1348 This step currently requires
1349 .Xr git 1 :
1350 .Pp
1351 .Dl $ cd /var/git/
1352 .Dl $ git clone --bare https://github.com/openbsd/src.git
1353 .Pp
1354 Alternatively, for quick and dirty local testing of
1355 .Nm
1356 a new Git repository could be created and populated with files,
1357 e.g. from a temporary CVS checkout located at
1358 .Pa /tmp/src :
1359 .Pp
1360 .Dl $ got init /var/git/src.git
1361 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1362 .Pp
1363 Check out a work tree from the Git repository to /usr/src:
1364 .Pp
1365 .Dl $ got checkout /var/git/src.git /usr/src
1366 .Pp
1367 View local changes in a work tree directory:
1368 .Pp
1369 .Dl $ got status
1370 .Dl $ got diff | less
1371 .Pp
1372 Interactively revert selected local changes in a work tree directory:
1373 .Pp
1374 .Dl $ got revert -p -R\ .
1375 .Pp
1376 In a work tree or a git repository directory, list all branch references:
1377 .Pp
1378 .Dl $ got branch -l
1379 .Pp
1380 In a work tree or a git repository directory, create a new branch called
1381 .Dq unified-buffer-cache
1382 which is forked off the
1383 .Dq master
1384 branch:
1385 .Pp
1386 .Dl $ got branch unified-buffer-cache master
1387 .Pp
1388 Switch an existing work tree to the branch
1389 .Dq unified-buffer-cache .
1390 Local changes in the work tree will be preserved and merged if necessary:
1391 .Pp
1392 .Dl $ got update -b unified-buffer-cache
1393 .Pp
1394 Create a new commit from local changes in a work tree directory.
1395 This new commit will become the head commit of the work tree's current branch:
1396 .Pp
1397 .Dl $ got commit
1398 .Pp
1399 In a work tree or a git repository directory, view changes committed in
1400 the 3 most recent commits to the work tree's branch, or the branch resolved
1401 via the repository's HEAD reference, respectively:
1402 .Pp
1403 .Dl $ got log -p -l 3 -f
1404 .Pp
1405 Add new files and remove obsolete files in a work tree directory:
1406 .Pp
1407 .Dl $ got add sys/uvm/uvm_ubc.c
1408 .Dl $ got remove sys/uvm/uvm_vnode.c
1409 .Pp
1410 Create a new commit from local changes in a work tree directory
1411 with a pre-defined log message.
1412 .Pp
1413 .Dl $ got commit -m 'unify the buffer cache'
1414 .Pp
1415 Update any work tree checked out from the
1416 .Dq unified-buffer-cache
1417 branch to the latest commit on this branch:
1418 .Pp
1419 .Dl $ got update
1420 .Pp
1421 Roll file content on the unified-buffer-cache branch back by one commit,
1422 and then fetch the rolled-back change into the work tree as a local change
1423 to be amended and perhaps committed again:
1424 .Pp
1425 .Dl $ got backout unified-buffer-cache
1426 .Dl $ got commit -m 'roll back previous'
1427 .Dl $ # now back out the previous backout :-)
1428 .Dl $ got backout unified-buffer-cache
1429 .Pp
1430 Fetch new upstream commits into the local repository's master branch.
1431 This step currently requires
1432 .Xr git 1 :
1433 .Pp
1434 .Dl $ cd /var/git/src.git
1435 .Dl $ git fetch origin master:master
1436 .Pp
1437 Rebase the
1438 .Dq unified-buffer-cache
1439 branch on top of the new head commit of the
1440 .Dq master
1441 branch.
1442 .Pp
1443 .Dl $ got update -b master
1444 .Dl $ got rebase unified-buffer-cache
1445 .Pp
1446 Create a patch from all changes on the unified-buffer-cache branch.
1447 The patch can be mailed out for review and applied to
1448 .Ox Ns 's
1449 CVS tree:
1450 .Pp
1451 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
1452 .Pp
1453 Edit the entire commit history of the
1454 .Dq unified-buffer-cache
1455 branch:
1456 .Pp
1457 .Dl $ got update -b unified-buffer-cache
1458 .Dl $ got update -c master
1459 .Dl $ got histedit
1460 .Pp
1461 Additional steps are necessary if local changes need to be pushed back
1462 to the remote repository, which currently requires
1463 .Cm git fetch
1464 and
1465 .Cm git push .
1466 Before working against existing branches in a repository cloned with
1467 .Dq git clone --bare ,
1468 a Git
1469 .Dq refspec
1470 must be configured to map all references in the remote repository
1471 into the
1472 .Dq refs/remotes
1473 namespace of the local repository.
1474 This can achieved by setting Git's
1475 .Pa remote.origin.fetch
1476 configuration variable to the value
1477 .Dq +refs/heads/*:refs/remotes/origin/*
1478 with the
1479 .Cm git config
1480 command:
1481 .Pp
1482 .Dl $ cd /var/git/repo
1483 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
1484 .Pp
1485 Alternatively, the following
1486 .Pa fetch
1487 configuration item can be added manually to the Git repository's
1488 .Pa config
1489 file:
1490 .Pp
1491 .Dl [remote "origin"]
1492 .Dl url = ...
1493 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
1494 .Pp
1495 This configuration leaves the local repository's
1496 .Dq refs/heads
1497 namespace free for use by local branches checked out with
1498 .Cm got checkout
1499 and, if needed, created with
1500 .Cm got branch .
1501 .Pp
1502 Branches in the
1503 .Dq remotes/origin
1504 namespace can be updated with incoming changes from the remote
1505 repository with
1506 .Cm git fetch :
1507 .Pp
1508 .Dl $ cd /var/git/repo
1509 .Dl $ git fetch
1510 .Pp
1511 Before outgoing changes on the local
1512 .Dq master
1513 branch can be pushed to the remote repository, the local
1514 .Dq master
1515 branch must be rebased onto the
1516 .Dq origin/master
1517 branch:
1518 .Pp
1519 .Dl $ got update -b origin/master
1520 .Dl $ got rebase master
1521 .Pp
1522 Changes on the local
1523 .Dq master
1524 branch can then be pushed to the remote
1525 repository with
1526 .Cm git push :
1527 .Pp
1528 .Dl $ cd /var/git/repo
1529 .Dl $ git push origin master
1530 .Pp
1531 In order to merge changes committed to the
1532 .Dq unified-buffer-cache
1533 branch back into the
1534 .Dq master
1535 branch, the
1536 .Dq unified-buffer-cache
1537 branch must first be rebased onto the
1538 .Dq master
1539 branch:
1540 .Pp
1541 .Dl $ got update -b master
1542 .Dl $ got rebase unified-buffer-cache
1543 .Pp
1544 Changes on the
1545 .Dq unified-buffer-cache
1546 branch can now be made visible on the
1547 .Dq master
1548 branch with
1549 .Cm got integrate .
1550 Because the rebase operation switched the work tree to the
1551 .Dq unified-buffer-cache
1552 branch, the work tree must be switched back to the
1553 .Dq master
1554 branch before the
1555 .Dq unified-buffer-cache
1556 branch can be integrated into
1557 .Dq master :
1558 .Pp
1559 .Dl $ got update -b master
1560 .Dl $ got integrate unified-buffer-cache
1561 .Pp
1562 .Sh SEE ALSO
1563 .Xr tog 1 ,
1564 .Xr git-repository 5 ,
1565 .Xr got-worktree 5
1566 .Sh AUTHORS
1567 .An Stefan Sperling Aq Mt stsp@openbsd.org
1568 .An Martin Pieuchot Aq Mt mpi@openbsd.org
1569 .An Joshua Stein Aq Mt jcs@openbsd.org
1570 .Sh CAVEATS
1571 .Nm
1572 is a work-in-progress and many commands remain to be implemented.
1573 At present, the user has to fall back on
1574 .Xr git 1
1575 to perform many tasks, in particular tasks related to repository
1576 administration and tasks which require a network connection.