Blob


1 .\"
2 .\" Copyright (c) 2017 Martin Pieuchot
3 .\" Copyright (c) 2018, 2019, 2020 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, -version
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 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
77 Create an initial commit in a repository from the file hierarchy
78 within the specified
79 .Ar directory .
80 The created commit will not have any parent commits, i.e. it will be a
81 root commit.
82 Also create a new reference which provides a branch name for the newly
83 created commit.
84 Show the path of each imported file to indicate progress.
85 .Pp
86 The
87 .Cm got import
88 command requires the
89 .Ev GOT_AUTHOR
90 environment variable to be set,
91 unless Git's
92 .Dv user.name
93 and
94 .Dv user.email
95 configuration settings can be obtained from the repository's
96 .Pa .git/config
97 file or from Git's global
98 .Pa ~/.gitconfig
99 configuration file.
100 .Pp
101 The options for
102 .Cm got import
103 are as follows:
104 .Bl -tag -width Ds
105 .It Fl b Ar branch
106 Create the specified
107 .Ar branch
108 instead of creating the default branch
109 .Dq main .
110 Use of this option is required if the
111 .Dq main
112 branch already exists.
113 .It Fl m Ar message
114 Use the specified log message when creating the new commit.
115 Without the
116 .Fl m
117 option,
118 .Cm got import
119 opens a temporary file in an editor where a log message can be written.
120 .It Fl r Ar repository-path
121 Use the repository at the specified path.
122 If not specified, assume the repository is located at or above the current
123 working directory.
124 .It Fl I Ar pattern
125 Ignore files or directories with a name which matches the specified
126 .Ar pattern .
127 This option may be specified multiple times to build a list of ignore patterns.
128 The
129 .Ar pattern
130 follows the globbing rules documented in
131 .Xr glob 7 .
132 .El
133 .It Cm im
134 Short alias for
135 .Cm import .
136 .It Cm clone Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl l Oc Oo Fl m Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Ar repository-URL Op Ar directory
137 Clone a Git repository at the specified
138 .Ar repository-URL
139 into the specified
140 .Ar directory .
141 If no
142 .Ar directory
143 is specified the directory name will be derived from the name of the
144 cloned repository.
145 .Cm got clone
146 will refuse to run if the
147 .Ar directory
148 already exists.
149 .Pp
150 The
151 .Ar repository-URL
152 specifies a protocol scheme, a server hostname, an optional port number
153 separated from the hostname by a colon, and a path to the repository on
154 the server:
155 .Lk scheme://hostname:port/path/to/repository
156 .Pp
157 The following protocol schemes are supported:
158 .Bl -tag -width git+ssh
159 .It git
160 The Git protocol as implemented by the
161 .Xr git-daemon 1
162 server.
163 Use of this protocol is discouraged since it supports neither authentication
164 nor encryption.
165 .It git+ssh
166 The Git protocol wrapped in an authenticated and encrypted
167 .Xr ssh 1
168 tunnel.
169 With this protocol the hostname may contain an embedded username for
170 .Xr ssh 1
171 to use:
172 .Mt user@hostname
173 .It ssh
174 Short alias for git+ssh.
175 .El
176 .Pp
177 Objects in the cloned repository are stored in a pack file which is downloaded
178 from the server.
179 This pack file will then be indexed to facilitate access to the objects stored
180 within.
181 If any objects in the pack file are stored in deltified form, all deltas will
182 be fully resolved in order to compute the ID of such objects.
183 This can take some time.
184 More details about the pack file format are documented in
185 .Xr git-repository 5 .
186 .Pp
187 .Cm got clone
188 creates a remote repository entry in the
189 .Pa config
190 file of the cloned repository to store the
191 .Ar repository-url
192 for future use by
193 .Cm got fetch
194 or
195 .Xr git-fetch 1 .
196 .Pp
197 The options for
198 .Cm got clone
199 are as follows:
200 .Bl -tag -width Ds
201 .It Fl a
202 Fetch all branches from the remote repository's
203 .Dq refs/heads/
204 reference namespace.
205 If this option is not specified, a branch resolved via the remote
206 repository's HEAD reference will be fetched.
207 Cannot be used together with the
208 .Fl b
209 option.
210 .It Fl b Ar branch
211 Fetch the specified
212 .Ar branch
213 from the remote repository's
214 .Dq refs/heads/
215 reference namespace.
216 This option may be specified multiple times to build a list of branches
217 to fetch.
218 If the branch corresponding to the remote repository's HEAD reference is not
219 in this list, the cloned repository's HEAD reference will be set to the first
220 branch which was fetched.
221 If this option is not specified, a branch resolved via the remote
222 repository's HEAD reference will be fetched.
223 Cannot be used together with the
224 .Fl a
225 option.
226 .It Fl l
227 List branches and tags available for fetching from the remote repository
228 and exit immediately.
229 Cannot be used together with any of the other options except
230 .Fl v .
231 .It Fl m
232 Create the cloned repository as a mirror of the original repository.
233 This is useful if the cloned repository will not be used to store
234 locally created commits.
235 .Pp
236 The repository's
237 .Pa config
238 file will be set up with the
239 .Dq mirror
240 option enabled, such that
241 .Cm got fetch
242 or
243 .Xr git-fetch 1
244 will write incoming changes directly to branches in the
245 .Dq refs/heads/
246 reference namespace, rather than to branches in the
247 .Dq refs/remotes/
248 namespace.
249 This avoids the usual requirement of having to run
250 .Cm got rebase
251 after
252 .Cm got fetch
253 in order to make incoming changes appear on branches in the
254 .Dq refs/heads/
255 namespace.
256 But maintaining custom changes in the cloned repository becomes difficult
257 since such changes will be at risk of being discarded whenever incoming
258 changes are fetched.
259 .It Fl q
260 Suppress progress reporting output.
261 The same option will be passed to
262 .Xr ssh 1
263 if applicable.
264 .It Fl v
265 Verbose mode.
266 Causes
267 .Cm got clone
268 to print debugging messages to standard error output.
269 This option will be passed to
270 .Xr ssh 1
271 if applicable.
272 Multiple -v options increase the verbosity.
273 The maximum is 3.
274 .It Fl R Ar reference
275 In addition to the branches and tags that will be fetched, fetch an arbitrary
276 .Ar reference
277 from the remote repository's
278 .Dq refs/
279 namespace.
280 This option may be specified multiple times to build a list of additional
281 references to fetch.
282 The specified
283 .Ar reference
284 may either be a path to a specific reference, or a reference namespace
285 which will cause all references in this namespace to be fetched.
286 .Pp
287 Each reference will be mapped into the cloned repository's
288 .Dq refs/remotes/
289 namespace, unless the
290 .Fl m
291 option is used to mirror references directly into the cloned repository's
292 .Dq refs/
293 namespace.
294 .Pp
295 .Cm got clone
296 will refuse to fetch references from the remote repository's
297 .Dq refs/remotes/
298 or
299 .Dq refs/got/
300 namespace.
301 .El
302 .It Cm cl
303 Short alias for
304 .Cm clone .
305 .It Cm fetch Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl d Oc Oo Fl l Oc Oo Fl r Ar repository-path Oc Oo Fl t Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Op Ar remote-repository
306 Fetch new changes from a remote repository.
307 If no
308 .Ar remote-repository
309 is specified,
310 .Dq origin
311 will be used.
312 The remote repository's URL is obtained from the corresponding entry in the
313 .Pa config
314 file of the local repository, as created by
315 .Cm got clone .
316 .Pp
317 New changes will be stored in a separate pack file downloaded from the server.
318 Optionally, separate pack files stored in the repository can be combined with
319 .Xr git-repack 1 .
320 .Pp
321 By default, branch references in the
322 .Dq refs/remotes/
323 reference namespace will be updated to point at the newly fetched commits.
324 The
325 .Cm got rebase
326 command can then be used to make new changes visible on branches in the
327 .Dq refs/heads/
328 namespace, merging incoming changes with the changes on those branches
329 as necessary.
330 .Pp
331 If the repository was created as a mirror with
332 .Cm got clone -m
333 then all branches in the
334 .Dq refs/heads/
335 namespace will be updated directly to match the corresponding branches in
336 the remote repository.
337 If those branches contained local commits, these commits will no longer be
338 reachable via a reference and will therefore be at risk of being discarded
339 by Git's garbage collector.
340 Maintaining custom changes in a mirror repository is therefore discouraged.
341 .Pp
342 In any case, references in the
343 .Dq refs/tags/
344 namespace will always be fetched and mapped directly to local references
345 in the same namespace.
346 .Pp
347 The options for
348 .Cm got fetch
349 are as follows:
350 .Bl -tag -width Ds
351 .It Fl a
352 Fetch all branches from the remote repository's
353 .Dq refs/heads/
354 reference namespace.
355 If this option is not specified, a branch resolved via the remote
356 repository's HEAD reference will be fetched.
357 Cannot be used together with the
358 .Fl b
359 option.
360 .It Fl b Ar branch
361 Fetch the specified
362 .Ar branch
363 from the remote repository's
364 .Dq refs/heads/
365 reference namespace.
366 This option may be specified multiple times to build a list of branches
367 to fetch.
368 If this option is not specified, a branch resolved via the remote
369 repository's HEAD reference will be fetched.
370 Cannot be used together with the
371 .Fl a
372 option.
373 .It Fl d
374 Delete branches and tags from the local repository which are no longer
375 present in the remote repository.
376 Only references are deleted.
377 Any commit, tree, tag, and blob objects belonging to deleted branches or
378 tags remain in the repository and may be removed separately with
379 Git's garbage collector.
380 .It Fl l
381 List branches and tags available for fetching from the remote repository
382 and exit immediately.
383 Cannot be used together with any of the other options except
384 .Fl v
385 and
386 .Fl r .
387 .It Fl t
388 Allow existing references in the
389 .Dq refs/tags
390 namespace to be updated if they have changed on the server.
391 If not specified, only new tag references will be created.
392 .It Fl r Ar repository-path
393 Use the repository at the specified path.
394 If not specified, assume the repository is located at or above the current
395 working directory.
396 If this directory is a
397 .Nm
398 work tree, use the repository path associated with this work tree.
399 .It Fl q
400 Suppress progress reporting output.
401 The same option will be passed to
402 .Xr ssh 1
403 if applicable.
404 .It Fl v
405 Verbose mode.
406 Causes
407 .Cm got fetch
408 to print debugging messages to standard error output.
409 The same option will be passed to
410 .Xr ssh 1
411 if applicable.
412 Multiple -v options increase the verbosity.
413 The maximum is 3.
414 .It Fl R Ar reference
415 In addition to the branches and tags that will be fetched, fetch an arbitrary
416 .Ar reference
417 from the remote repository's
418 .Dq refs/
419 namespace.
420 This option may be specified multiple times to build a list of additional
421 references to fetch.
422 The specified
423 .Ar reference
424 may either be a path to a specific reference, or a reference namespace
425 which will cause all references in this namespace to be fetched.
426 .Pp
427 Each reference will be mapped into the local repository's
428 .Dq refs/remotes/
429 namespace, unless the local repository was created as a mirror with
430 .Cm got clone -m
431 in which case references will be mapped directly into the local repository's
432 .Dq refs/
433 namespace.
434 .Pp
435 Once a reference has been fetched, a branch based on it can be created with
436 .Cm got branch
437 if needed.
438 .Pp
439 .Cm got fetch
440 will refuse to fetch references from the remote repository's
441 .Dq refs/remotes/
442 or
443 .Dq refs/got/
444 namespace.
445 .El
446 .It Cm fe
447 Short alias for
448 .Cm fetch .
449 .It Cm checkout Oo Fl E Oc 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
450 Copy files from a repository into a new work tree.
451 Show the status of each affected file, using the following status codes:
452 .Bl -column YXZ description
453 .It A Ta new file was added
454 .It E Ta file already exists in work tree's meta-data
455 .El
456 .Pp
457 If the
458 .Ar work tree path
459 is not specified, either use the last component of
460 .Ar repository path ,
461 or if a
462 .Ar path prefix
463 was specified use the last component of
464 .Ar path prefix .
465 .Pp
466 The options for
467 .Cm got checkout
468 are as follows:
469 .Bl -tag -width Ds
470 .It Fl E
471 Proceed with the checkout operation even if the directory at
472 .Ar work-tree-path
473 is not empty.
474 Existing files will be left intact.
475 .It Fl b Ar branch
476 Check out files from a commit on the specified
477 .Ar branch .
478 If this option is not specified, a branch resolved via the repository's HEAD
479 reference will be used.
480 .It Fl c Ar commit
481 Check out files from the specified
482 .Ar commit
483 on the selected branch.
484 The expected argument is a commit ID SHA1 hash or an existing reference
485 or tag name which will be resolved to a commit ID.
486 An abbreviated hash argument will be expanded to a full SHA1 hash
487 automatically, provided the abbreviation is unique.
488 If this option is not specified, the most recent commit on the selected
489 branch will be used.
490 .Pp
491 If the specified
492 .Ar commit
493 is not contained in the selected branch, a different branch which contains
494 this commit must be specified with the
495 .Fl b
496 option.
497 If no such branch is known a new branch must be created for this
498 commit with
499 .Cm got branch
500 before
501 .Cm got checkout
502 can be used.
503 Checking out work trees with an unknown branch is intentionally not supported.
504 .It Fl p Ar path-prefix
505 Restrict the work tree to a subset of the repository's tree hierarchy.
506 Only files beneath the specified
507 .Ar path-prefix
508 will be checked out.
509 .El
510 .It Cm co
511 Short alias for
512 .Cm checkout .
513 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
514 Update an existing work tree to a different
515 .Ar commit .
516 Change existing files in the work tree as necessary to match file contents
517 of this commit.
518 Preserve any local changes in the work tree and merge them with the
519 incoming changes.
520 .Pp
521 Files which already contain merge conflicts will not be updated to avoid
522 further complications.
523 Such files will be updated when
524 .Cm got update
525 is run again after merge conflicts have been resolved.
526 If the conflicting changes are no longer needed affected files can be
527 reverted with
528 .Cm got revert
529 before running
530 .Cm got update
531 again.
532 .Pp
533 Show the status of each affected file, using the following status codes:
534 .Bl -column YXZ description
535 .It U Ta file was updated and contained no local changes
536 .It G Ta file was updated and local changes were merged cleanly
537 .It C Ta file was updated and conflicts occurred during merge
538 .It D Ta file was deleted
539 .It A Ta new file was added
540 .It \(a~ Ta versioned file is obstructed by a non-regular file
541 .It ! Ta a missing versioned file was restored
542 .It # Ta file was not updated because it contains merge conflicts
543 .It ? Ta changes destined for an unversioned file were not merged
544 .El
545 .Pp
546 If no
547 .Ar path
548 is specified, update the entire work tree.
549 Otherwise, restrict the update operation to files at or within the
550 specified paths.
551 Each path is required to exist in the update operation's target commit.
552 Files in the work tree outside specified paths will remain unchanged and
553 will retain their previously recorded base commit.
554 Some
555 .Nm
556 commands may refuse to run while the work tree contains files from
557 multiple base commits.
558 The base commit of such a work tree can be made consistent by running
559 .Cm got update
560 across the entire work tree.
561 Specifying a
562 .Ar path
563 is incompatible with the
564 .Fl b
565 option.
566 .Pp
567 .Cm got update
568 cannot update paths with staged changes.
569 If changes have been staged with
570 .Cm got stage ,
571 these changes must first be committed with
572 .Cm got commit
573 or unstaged with
574 .Cm got unstage .
575 .Pp
576 The options for
577 .Cm got update
578 are as follows:
579 .Bl -tag -width Ds
580 .It Fl b Ar branch
581 Switch the work tree's branch reference to the specified
582 .Ar branch
583 before updating the work tree.
584 This option requires that all paths in the work tree are updated.
585 .Pp
586 As usual, any local changes in the work tree will be preserved.
587 This can be useful when switching to a newly created branch in order
588 to commit existing local changes to this branch.
589 .Pp
590 Any local changes must be dealt with separately in order to obtain a
591 work tree with pristine file contents corresponding exactly to the specified
592 .Ar branch .
593 Such changes could first be committed to a different branch with
594 .Cm got commit ,
595 or could be discarded with
596 .Cm got revert .
597 .It Fl c Ar commit
598 Update the work tree to the specified
599 .Ar commit .
600 The expected argument is a commit ID SHA1 hash or an existing reference
601 or tag name which will be resolved to a commit ID.
602 An abbreviated hash argument will be expanded to a full SHA1 hash
603 automatically, provided the abbreviation is unique.
604 If this option is not specified, the most recent commit on the work tree's
605 branch will be used.
606 .El
607 .It Cm up
608 Short alias for
609 .Cm update .
610 .It Cm status Oo Fl s Ar status-codes Oc Op Ar path ...
611 Show the current modification status of files in a work tree,
612 using the following status codes:
613 .Bl -column YXZ description
614 .It M Ta modified file
615 .It A Ta file scheduled for addition in next commit
616 .It D Ta file scheduled for deletion in next commit
617 .It C Ta modified or added file which contains merge conflicts
618 .It ! Ta versioned file was expected on disk but is missing
619 .It \(a~ Ta versioned file is obstructed by a non-regular file
620 .It ? Ta unversioned item not tracked by
621 .Nm
622 .It m Ta modified file modes (executable bit only)
623 .It N Ta non-existent
624 .Ar path
625 specified on the command line
626 .El
627 .Pp
628 If no
629 .Ar path
630 is specified, show modifications in the entire work tree.
631 Otherwise, show modifications at or within the specified paths.
632 .Pp
633 If changes have been staged with
634 .Cm got stage ,
635 staged changes are shown in the second output column, using the following
636 status codes:
637 .Bl -column YXZ description
638 .It M Ta file modification is staged
639 .It A Ta file addition is staged
640 .It D Ta file deletion is staged
641 .El
642 .Pp
643 Changes created on top of staged changes are indicated in the first column:
644 .Bl -column YXZ description
645 .It MM Ta file was modified after earlier changes have been staged
646 .It MA Ta file was modified after having been staged for addition
647 .El
648 .Pp
649 The options for
650 .Cm got status
651 are as follows:
652 .Bl -tag -width Ds
653 .It Fl s Ar status-codes
654 Only show files with a modification status matching any of the
655 single-character status codes contained in the
656 .Ar status-codes
657 argument.
658 Any combination of codes from the above list of possible status codes
659 may be specified.
660 For staged files, status codes displayed in either column will be matched.
661 .El
662 .Pp
663 For compatibility with
664 .Xr cvs 1
665 and
666 .Xr git 1 ,
667 .Cm got status
668 reads
669 .Xr glob 7
670 patterns from
671 .Pa .cvsignore
672 and
673 .Pa .gitignore
674 files in each traversed directory and will not display unversioned files
675 which match these patterns.
676 As an extension to
677 .Xr glob 7
678 matching rules,
679 .Cm got status
680 supports consecutive asterisks,
681 .Dq ** ,
682 which will match an arbitrary amount of directories.
683 Unlike
684 .Xr cvs 1 ,
685 .Cm got status
686 only supports a single ignore pattern per line.
687 Unlike
688 .Xr git 1 ,
689 .Cm got status
690 does not support negated ignore patterns prefixed with
691 .Dq \&! ,
692 and gives no special significance to the location of path component separators,
693 .Dq / ,
694 in a pattern.
695 .It Cm st
696 Short alias for
697 .Cm status .
698 .It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl P Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Oo Fl R Oc Oo Fl x Ar commit Oc Op Ar path
699 Display history of a repository.
700 If a
701 .Ar path
702 is specified, show only commits which modified this path.
703 If invoked in a work tree, the
704 .Ar path
705 is interpreted relative to the current working directory,
706 and the work tree's path prefix is implicitly prepended.
707 Otherwise, the path is interpreted relative to the repository root.
708 .Pp
709 The options for
710 .Cm got log
711 are as follows:
712 .Bl -tag -width Ds
713 .It Fl b
714 Display individual commits which were merged into the current branch
715 from other branches.
716 By default,
717 .Cm got log
718 shows the linear history of the current branch only.
719 .It Fl c Ar commit
720 Start traversing history at the specified
721 .Ar commit .
722 The expected argument is a commit ID SHA1 hash or an existing reference
723 or tag name which will be resolved to a commit ID.
724 An abbreviated hash argument will be expanded to a full SHA1 hash
725 automatically, provided the abbreviation is unique.
726 If this option is not specified, default to the work tree's current branch
727 if invoked in a work tree, or to the repository's HEAD reference.
728 .It Fl C Ar number
729 Set the number of context lines shown in diffs with
730 .Fl p .
731 By default, 3 lines of context are shown.
732 .It Fl l Ar N
733 Limit history traversal to a given number of commits.
734 If this option is not specified, a default limit value of zero is used,
735 which is treated as an unbounded limit.
736 The
737 .Ev GOT_LOG_DEFAULT_LIMIT
738 environment variable may be set to change this default value.
739 .It Fl p
740 Display the patch of modifications made in each commit.
741 If a
742 .Ar path
743 is specified, only show the patch of modifications at or within this path.
744 .It Fl P
745 Display the list of file paths changed in each commit, using the following
746 status codes:
747 .Bl -column YXZ description
748 .It M Ta modified file
749 .It D Ta file was deleted
750 .It A Ta new file was added
751 .It m Ta modified file modes (executable bit only)
752 .El
753 .It Fl s Ar search-pattern
754 If specified, show only commits with a log message matched by the extended
755 regular expression
756 .Ar search-pattern .
757 When used together with
758 .Fl P
759 then the file paths changed by a commit can be matched as well.
760 Regular expression syntax is documented in
761 .Xr re_format 7 .
762 .It Fl r Ar repository-path
763 Use the repository at the specified path.
764 If not specified, assume the repository is located at or above the current
765 working directory.
766 If this directory is a
767 .Nm
768 work tree, use the repository path associated with this work tree.
769 .It Fl R
770 Determine a set of commits to display as usual, but display these commits
771 in reverse order.
772 .It Fl x Ar commit
773 Stop traversing commit history as soon as the specified
774 .Ar commit
775 has been traversed.
776 This option has no effect if the specified
777 .Ar commit
778 is never traversed.
779 .El
780 .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
781 When invoked within a work tree with less than two arguments, display
782 local changes in the work tree.
783 If a
784 .Ar path
785 is specified, only show changes within this path.
786 .Pp
787 If two arguments are provided, treat each argument as a reference, a tag
788 name, or an object ID SHA1 hash, and display differences between the
789 corresponding objects.
790 Both objects must be of the same type (blobs, trees, or commits).
791 An abbreviated hash argument will be expanded to a full SHA1 hash
792 automatically, provided the abbreviation is unique.
793 .Pp
794 The options for
795 .Cm got diff
796 are as follows:
797 .Bl -tag -width Ds
798 .It Fl C Ar number
799 Set the number of context lines shown in the diff.
800 By default, 3 lines of context are shown.
801 .It Fl r Ar repository-path
802 Use the repository at the specified path.
803 If not specified, assume the repository is located at or above the current
804 working directory.
805 If this directory is a
806 .Nm
807 work tree, use the repository path associated with this work tree.
808 .It Fl s
809 Show changes staged with
810 .Cm got stage
811 instead of showing local changes in the work tree.
812 This option is only valid when
813 .Cm got diff
814 is invoked in a work tree.
815 .It Fl w
816 Ignore whitespace-only changes.
817 .El
818 .It Cm di
819 Short alias for
820 .Cm diff .
821 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
822 Display line-by-line history of a file at the specified path.
823 .Pp
824 The options for
825 .Cm got blame
826 are as follows:
827 .Bl -tag -width Ds
828 .It Fl c Ar commit
829 Start traversing history at the specified
830 .Ar commit .
831 The expected argument is a commit ID SHA1 hash or an existing reference
832 or tag name which will be resolved to a commit ID.
833 An abbreviated hash argument will be expanded to a full SHA1 hash
834 automatically, provided the abbreviation is unique.
835 .It Fl r Ar repository-path
836 Use the repository at the specified path.
837 If not specified, assume the repository is located at or above the current
838 working directory.
839 If this directory is a
840 .Nm
841 work tree, use the repository path associated with this work tree.
842 .El
843 .It Cm bl
844 Short alias for
845 .Cm blame .
846 .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
847 Display a listing of files and directories at the specified
848 directory path in the repository.
849 Entries shown in this listing may carry one of the following trailing
850 annotations:
851 .Bl -column YXZ description
852 .It @ Ta entry is a symbolic link
853 .It / Ta entry is a directory
854 .It * Ta entry is an executable file
855 .It $ Ta entry is a Git submodule
856 .El
857 .Pp
858 Symbolic link entries are also annotated with the target path of the link.
859 .Pp
860 If no
861 .Ar path
862 is specified, list the repository path corresponding to the current
863 directory of the work tree, or the root directory of the repository
864 if there is no work tree.
865 .Pp
866 The options for
867 .Cm got tree
868 are as follows:
869 .Bl -tag -width Ds
870 .It Fl c Ar commit
871 List files and directories as they appear in the specified
872 .Ar commit .
873 The expected argument is a commit ID SHA1 hash or an existing reference
874 or tag name which will be resolved to a commit ID.
875 An abbreviated hash argument will be expanded to a full SHA1 hash
876 automatically, provided the abbreviation is unique.
877 .It Fl r Ar repository-path
878 Use the repository at the specified path.
879 If not specified, assume the repository is located at or above the current
880 working directory.
881 If this directory is a
882 .Nm
883 work tree, use the repository path associated with this work tree.
884 .It Fl i
885 Show object IDs of files (blob objects) and directories (tree objects).
886 .It Fl R
887 Recurse into sub-directories in the repository.
888 .El
889 .It Cm tr
890 Short alias for
891 .Cm tree .
892 .It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl c Ar object Oc Oo Fl s Ar reference Oc Oo Fl d Oc Op Ar name
893 Manage references in a repository.
894 .Pp
895 References may be listed, created, deleted, and changed.
896 When creating, deleting, or changing a reference the specified
897 .Ar name
898 must be an absolute reference name, i.e. it must begin with
899 .Dq refs/ .
900 .Pp
901 The options for
902 .Cm got ref
903 are as follows:
904 .Bl -tag -width Ds
905 .It Fl r Ar repository-path
906 Use the repository at the specified path.
907 If not specified, assume the repository is located at or above the current
908 working directory.
909 If this directory is a
910 .Nm
911 work tree, use the repository path associated with this work tree.
912 .It Fl l
913 List references in the repository.
914 If no
915 .Ar name
916 is specified, list all existing references in the repository.
917 If
918 .Ar name
919 is a reference namespace, list all references in this namespace.
920 Otherwise, show only the reference with the given
921 .Ar name .
922 Cannot be used together with any other options except
923 .Fl r .
924 .It Fl c Ar object
925 Create a reference or change an existing reference.
926 The reference with the specified
927 .Ar name
928 will point at the specified
929 .Ar object.
930 The expected
931 .Ar object
932 argument is a ID SHA1 hash or an existing reference or tag name which will
933 be resolved to the ID of a corresponding commit, tree, tag, or blob object.
934 Cannot be used together with any other options except
935 .Fl r .
936 .It Fl s Ar reference
937 Create a symbolic reference, or change an existing symbolic reference.
938 The symbolic reference with the specified
939 .Ar name
940 will point at the specified
941 .Ar reference
942 which must already exist in the repository.
943 Care should be taken not to create loops between references when
944 this option is used.
945 Cannot be used together with any other options except
946 .Fl r .
947 .It Fl d
948 Delete the reference with the specified
949 .Ar name
950 from the repository.
951 Cannot be used together with any other options except
952 .Fl r .
953 .El
954 .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 Oo Fl n Oc Op Ar name
955 Create, list, or delete branches.
956 .Pp
957 Branches are managed via references which live in the
958 .Dq refs/heads/
959 reference namespace.
960 The
961 .Cm got branch
962 command operates on references in this namespace only.
963 .Pp
964 If invoked in a work tree without any arguments, print the name of the
965 work tree's current branch.
966 .Pp
967 If a
968 .Ar name
969 argument is passed, attempt to create a branch reference with the given name.
970 By default the new branch reference will point at the latest commit on the
971 work tree's current branch if invoked in a work tree, and otherwise to a commit
972 resolved via the repository's HEAD reference.
973 .Pp
974 If invoked in a work tree, once the branch was created successfully
975 switch the work tree's head reference to the newly created branch and
976 update files across the entire work tree, just like
977 .Cm got update -b Ar name
978 would do.
979 Show the status of each affected file, using the following status codes:
980 .Bl -column YXZ description
981 .It U Ta file was updated and contained no local changes
982 .It G Ta file was updated and local changes were merged cleanly
983 .It C Ta file was updated and conflicts occurred during merge
984 .It D Ta file was deleted
985 .It A Ta new file was added
986 .It \(a~ Ta versioned file is obstructed by a non-regular file
987 .It ! Ta a missing versioned file was restored
988 .El
989 .Pp
990 The options for
991 .Cm got branch
992 are as follows:
993 .Bl -tag -width Ds
994 .It Fl c Ar commit
995 Make a newly created branch reference point at the specified
996 .Ar commit .
997 The expected
998 .Ar commit
999 argument is a commit ID SHA1 hash or an existing reference
1000 or tag name which will be resolved to a commit ID.
1001 .It Fl r Ar repository-path
1002 Use the repository at the specified path.
1003 If not specified, assume the repository is located at or above the current
1004 working directory.
1005 If this directory is a
1006 .Nm
1007 work tree, use the repository path associated with this work tree.
1008 .It Fl l
1009 List all existing branches in the repository.
1010 If invoked in a work tree, the work tree's current branch is shown
1011 with one the following annotations:
1012 .Bl -column YXZ description
1013 .It * Ta work tree's base commit matches the branch tip
1014 .It \(a~ Ta work tree's base commit is out-of-date
1015 .El
1016 .It Fl d Ar name
1017 Delete the branch with the specified name from the repository.
1018 Only the branch reference is deleted.
1019 Any commit, tree, and blob objects belonging to the branch
1020 remain in the repository and may be removed separately with
1021 Git's garbage collector.
1022 .It Fl n
1023 Do not switch and update the work tree after creating a new branch.
1024 .El
1025 .It Cm br
1026 Short alias for
1027 .Cm branch .
1028 .It Cm tag Oo Fl c Ar commit Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Ar name
1029 Manage tags in a repository.
1030 .Pp
1031 Tags are managed via references which live in the
1032 .Dq refs/tags/
1033 reference namespace.
1034 The
1035 .Cm got tag
1036 command operates on references in this namespace only.
1037 References in this namespace point at tag objects which contain a pointer
1038 to another object, a tag message, as well as author and timestamp information.
1039 .Pp
1040 Attempt to create a tag with the given
1041 .Ar name ,
1042 and make this tag point at the given
1043 .Ar commit .
1044 If no commit is specified, default to the latest commit on the work tree's
1045 current branch if invoked in a work tree, and to a commit resolved via
1046 the repository's HEAD reference otherwise.
1047 .Pp
1048 The options for
1049 .Cm got tag
1050 are as follows:
1051 .Bl -tag -width Ds
1052 .It Fl c Ar commit
1053 Make the newly created tag reference point at the specified
1054 .Ar commit .
1055 The expected
1056 .Ar commit
1057 argument is a commit ID SHA1 hash or an existing reference or tag name which
1058 will be resolved to a commit ID.
1059 An abbreviated hash argument will be expanded to a full SHA1 hash
1060 automatically, provided the abbreviation is unique.
1061 .It Fl m Ar message
1062 Use the specified tag message when creating the new tag.
1063 Without the
1064 .Fl m
1065 option,
1066 .Cm got tag
1067 opens a temporary file in an editor where a tag message can be written.
1068 .It Fl r Ar repository-path
1069 Use the repository at the specified path.
1070 If not specified, assume the repository is located at or above the current
1071 working directory.
1072 If this directory is a
1073 .Nm
1074 work tree, use the repository path associated with this work tree.
1075 .It Fl l
1076 List all existing tags in the repository instead of creating a new tag.
1077 If this option is used, no other command-line arguments are allowed.
1078 .El
1079 .Pp
1080 By design, the
1081 .Cm got tag
1082 command will not delete tags or change existing tags.
1083 If a tag must be deleted, the
1084 .Cm got ref
1085 command may be used to delete a tag's reference.
1086 This should only be done if the tag has not already been copied to
1087 another repository.
1088 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
1089 Schedule unversioned files in a work tree for addition to the
1090 repository in the next commit.
1091 .Pp
1092 The options for
1093 .Cm got add
1094 are as follows:
1095 .Bl -tag -width Ds
1096 .It Fl R
1097 Permit recursion into directories.
1098 If this option is not specified,
1099 .Cm got add
1100 will refuse to run if a specified
1101 .Ar path
1102 is a directory.
1103 .It Fl I
1104 With -R, add files even if they match a
1105 .Cm got status
1106 ignore pattern.
1107 .El
1108 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Oo Fl s Ar status-codes Oc Ar path ...
1109 Remove versioned files from a work tree and schedule them for deletion
1110 from the repository in the next commit.
1111 .Pp
1112 The options for
1113 .Cm got remove
1114 are as follows:
1115 .Bl -tag -width Ds
1116 .It Fl f
1117 Perform the operation even if a file contains local modifications.
1118 .It Fl k
1119 Keep affected files on disk.
1120 .It Fl R
1121 Permit recursion into directories.
1122 If this option is not specified,
1123 .Cm got remove
1124 will refuse to run if a specified
1125 .Ar path
1126 is a directory.
1127 .It Fl s Ar status-codes
1128 Only delete files with a modification status matching one of the
1129 single-character status codes contained in the
1130 .Ar status-codes
1131 argument.
1132 The following status codes may be specified:
1133 .Bl -column YXZ description
1134 .It M Ta modified file (this implies the
1135 .Fl f
1136 option)
1137 .It ! Ta versioned file expected on disk but missing
1138 .El
1139 .El
1140 .It Cm rm
1141 Short alias for
1142 .Cm remove .
1143 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
1144 Revert any local changes in files at the specified paths in a work tree.
1145 File contents will be overwritten with those contained in the
1146 work tree's base commit.
1147 There is no way to bring discarded changes back after
1148 .Cm got revert !
1149 .Pp
1150 If a file was added with
1151 .Cm got add
1152 it will become an unversioned file again.
1153 If a file was deleted with
1154 .Cm got remove
1155 it will be restored.
1156 .Pp
1157 The options for
1158 .Cm got revert
1159 are as follows:
1160 .Bl -tag -width Ds
1161 .It Fl p
1162 Instead of reverting all changes in files, interactively select or reject
1163 changes to revert based on
1164 .Dq y
1165 (revert change),
1166 .Dq n
1167 (keep change), and
1168 .Dq q
1169 (quit reverting this file) responses.
1170 If a file is in modified status, individual patches derived from the
1171 modified file content can be reverted.
1172 Files in added or deleted status may only be reverted in their entirety.
1173 .It Fl F Ar response-script
1174 With the
1175 .Fl p
1176 option, read
1177 .Dq y ,
1178 .Dq n ,
1179 and
1180 .Dq q
1181 responses line-by-line from the specified
1182 .Ar response-script
1183 file instead of prompting interactively.
1184 .It Fl R
1185 Permit recursion into directories.
1186 If this option is not specified,
1187 .Cm got revert
1188 will refuse to run if a specified
1189 .Ar path
1190 is a directory.
1191 .El
1192 .It Cm rv
1193 Short alias for
1194 .Cm revert .
1195 .It Cm commit Oo Fl m Ar message Oc Oo Fl S Oc Op Ar path ...
1196 Create a new commit in the repository from changes in a work tree
1197 and use this commit as the new base commit for the work tree.
1198 If no
1199 .Ar path
1200 is specified, commit all changes in the work tree.
1201 Otherwise, commit changes at or within the specified paths.
1202 .Pp
1203 If changes have been explicitly staged for commit with
1204 .Cm got stage ,
1205 only commit staged changes and reject any specified paths which
1206 have not been staged.
1207 .Pp
1208 Show the status of each affected file, using the following status codes:
1209 .Bl -column YXZ description
1210 .It M Ta modified file
1211 .It D Ta file was deleted
1212 .It A Ta new file was added
1213 .It m Ta modified file modes (executable bit only)
1214 .El
1215 .Pp
1216 Files which are not part of the new commit will retain their previously
1217 recorded base commit.
1218 Some
1219 .Nm
1220 commands may refuse to run while the work tree contains files from
1221 multiple base commits.
1222 The base commit of such a work tree can be made consistent by running
1223 .Cm got update
1224 across the entire work tree.
1225 .Pp
1226 The
1227 .Cm got commit
1228 command requires the
1229 .Ev GOT_AUTHOR
1230 environment variable to be set,
1231 unless Git's
1232 .Dv user.name
1233 and
1234 .Dv user.email
1235 configuration settings can be
1236 obtained from the repository's
1237 .Pa .git/config
1238 file or from Git's global
1239 .Pa ~/.gitconfig
1240 configuration file.
1241 .Pp
1242 The options for
1243 .Cm got commit
1244 are as follows:
1245 .Bl -tag -width Ds
1246 .It Fl m Ar message
1247 Use the specified log message when creating the new commit.
1248 Without the
1249 .Fl m
1250 option,
1251 .Cm got commit
1252 opens a temporary file in an editor where a log message can be written.
1253 .It Fl S
1254 Allow the addition of symbolic links which point outside of the path space
1255 that is under version control.
1256 By default,
1257 .Cm got commit
1258 will reject such symbolic links due to safety concerns.
1259 As a precaution,
1260 .Nm
1261 may decide to represent such a symbolic link as a regular file which contains
1262 the link's target path, rather than creating an actual symbolic link which
1263 points outside of the work tree.
1264 Use of this option is discouraged because external mechanisms such as
1265 .Dq make obj
1266 are better suited for managing symbolic links to paths not under
1267 version control.
1268 .El
1269 .Pp
1270 .Cm got commit
1271 will refuse to run if certain preconditions are not met.
1272 If the work tree's current branch is not in the
1273 .Dq refs/heads/
1274 reference namespace, new commits may not be created on this branch.
1275 Local changes may only be committed if they are based on file content
1276 found in the most recent commit on the work tree's branch.
1277 If a path is found to be out of date,
1278 .Cm got update
1279 must be used first in order to merge local changes with changes made
1280 in the repository.
1281 .It Cm ci
1282 Short alias for
1283 .Cm commit .
1284 .It Cm cherrypick Ar commit
1285 Merge changes from a single
1286 .Ar commit
1287 into the work tree.
1288 The specified
1289 .Ar commit
1290 must be on a different branch than the work tree's base commit.
1291 The expected argument is a reference or a commit ID SHA1 hash.
1292 An abbreviated hash argument will be expanded to a full SHA1 hash
1293 automatically, provided the abbreviation is unique.
1294 .Pp
1295 Show the status of each affected file, using the following status codes:
1296 .Bl -column YXZ description
1297 .It G Ta file was merged
1298 .It C Ta file was merged and conflicts occurred during merge
1299 .It ! Ta changes destined for a missing file were not merged
1300 .It D Ta file was deleted
1301 .It d Ta file's deletion was obstructed by local modifications
1302 .It A Ta new file was added
1303 .It \(a~ Ta changes destined for a non-regular file were not merged
1304 .It ? Ta changes destined for an unversioned file were not merged
1305 .El
1306 .Pp
1307 The merged changes will appear as local changes in the work tree, which
1308 may be viewed with
1309 .Cm got diff ,
1310 amended manually or with further
1311 .Cm got cherrypick
1312 commands,
1313 committed with
1314 .Cm got commit ,
1315 or discarded again with
1316 .Cm got revert .
1317 .Pp
1318 .Cm got cherrypick
1319 will refuse to run if certain preconditions are not met.
1320 If the work tree contains multiple base commits it must first be updated
1321 to a single base commit with
1322 .Cm got update .
1323 If the work tree already contains files with merge conflicts, these
1324 conflicts must be resolved first.
1325 .It Cm cy
1326 Short alias for
1327 .Cm cherrypick .
1328 .It Cm backout Ar commit
1329 Reverse-merge changes from a single
1330 .Ar commit
1331 into the work tree.
1332 The specified
1333 .Ar commit
1334 must be on the same branch as the work tree's base commit.
1335 The expected argument is a reference or a commit ID SHA1 hash.
1336 An abbreviated hash argument will be expanded to a full SHA1 hash
1337 automatically, provided the abbreviation is unique.
1338 .Pp
1339 Show the status of each affected file, using the following status codes:
1340 .Bl -column YXZ description
1341 .It G Ta file was merged
1342 .It C Ta file was merged and conflicts occurred during merge
1343 .It ! Ta changes destined for a missing file were not merged
1344 .It D Ta file was deleted
1345 .It d Ta file's deletion was obstructed by local modifications
1346 .It A Ta new file was added
1347 .It \(a~ Ta changes destined for a non-regular file were not merged
1348 .It ? Ta changes destined for an unversioned file were not merged
1349 .El
1350 .Pp
1351 The reverse-merged changes will appear as local changes in the work tree,
1352 which may be viewed with
1353 .Cm got diff ,
1354 amended manually or with further
1355 .Cm got backout
1356 commands,
1357 committed with
1358 .Cm got commit ,
1359 or discarded again with
1360 .Cm got revert .
1361 .Pp
1362 .Cm got backout
1363 will refuse to run if certain preconditions are not met.
1364 If the work tree contains multiple base commits it must first be updated
1365 to a single base commit with
1366 .Cm got update .
1367 If the work tree already contains files with merge conflicts, these
1368 conflicts must be resolved first.
1369 .It Cm bo
1370 Short alias for
1371 .Cm backout .
1372 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
1373 Rebase commits on the specified
1374 .Ar branch
1375 onto the tip of the current branch of the work tree.
1376 The
1377 .Ar branch
1378 must share common ancestry with the work tree's current branch.
1379 Rebasing begins with the first descendant commit of the youngest
1380 common ancestor commit shared by the specified
1381 .Ar branch
1382 and the work tree's current branch, and stops once the tip commit
1383 of the specified
1384 .Ar branch
1385 has been rebased.
1386 .Pp
1387 When
1388 .Cm got rebase
1389 is used as intended, the specified
1390 .Ar branch
1391 represents a local commit history and may already contain changes
1392 that are not yet visible in any other repositories.
1393 The work tree's current branch, which must be set with
1394 .Cm got update -b
1395 before starting the
1396 .Cm rebase
1397 operation, represents a branch from a remote repository which shares
1398 a common history with the specified
1399 .Ar branch
1400 but has progressed, and perhaps diverged, due to commits added to the
1401 remote repository.
1402 .Pp
1403 Rebased commits are accumulated on a temporary branch which the work tree
1404 will remain switched to throughout the entire rebase operation.
1405 Commits on this branch represent the same changes with the same log
1406 messages as their counterparts on the original
1407 .Ar branch ,
1408 but with different commit IDs.
1409 Once rebasing has completed successfully, the temporary branch becomes
1410 the new version of the specified
1411 .Ar branch
1412 and the work tree is automatically switched to it.
1413 .Pp
1414 While rebasing commits, show the status of each affected file,
1415 using the following status codes:
1416 .Bl -column YXZ description
1417 .It G Ta file was merged
1418 .It C Ta file was merged and conflicts occurred during merge
1419 .It ! Ta changes destined for a missing file were not merged
1420 .It D Ta file was deleted
1421 .It d Ta file's deletion was obstructed by local modifications
1422 .It A Ta new file was added
1423 .It \(a~ Ta changes destined for a non-regular file were not merged
1424 .It ? Ta changes destined for an unversioned file were not merged
1425 .El
1426 .Pp
1427 If merge conflicts occur the rebase operation is interrupted and may
1428 be continued once conflicts have been resolved.
1429 Alternatively, the rebase operation may be aborted which will leave
1430 .Ar branch
1431 unmodified and the work tree switched back to its original branch.
1432 .Pp
1433 If a merge conflict is resolved in a way which renders the merged
1434 change into a no-op change, the corresponding commit will be elided
1435 when the rebase operation continues.
1436 .Pp
1437 .Cm got rebase
1438 will refuse to run if certain preconditions are not met.
1439 If the work tree is not yet fully updated to the tip commit of its
1440 branch then the work tree must first be updated with
1441 .Cm got update .
1442 If changes have been staged with
1443 .Cm got stage ,
1444 these changes must first be committed with
1445 .Cm got commit
1446 or unstaged with
1447 .Cm got unstage .
1448 If the work tree contains local changes, these changes must first be
1449 committed with
1450 .Cm got commit
1451 or reverted with
1452 .Cm got revert .
1453 If the
1454 .Ar branch
1455 contains changes to files outside of the work tree's path prefix,
1456 the work tree cannot be used to rebase this branch.
1457 .Pp
1458 The
1459 .Cm got update
1460 and
1461 .Cm got commit
1462 commands will refuse to run while a rebase operation is in progress.
1463 Other commands which manipulate the work tree may be used for
1464 conflict resolution purposes.
1465 .Pp
1466 The options for
1467 .Cm got rebase
1468 are as follows:
1469 .Bl -tag -width Ds
1470 .It Fl a
1471 Abort an interrupted rebase operation.
1472 If this option is used, no other command-line arguments are allowed.
1473 .It Fl c
1474 Continue an interrupted rebase operation.
1475 If this option is used, no other command-line arguments are allowed.
1476 .El
1477 .It Cm rb
1478 Short alias for
1479 .Cm rebase .
1480 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc
1481 Edit commit history between the work tree's current base commit and
1482 the tip commit of the work tree's current branch.
1483 .Pp
1484 Before starting a
1485 .Cm histedit
1486 operation the work tree's current branch must be set with
1487 .Cm got update -b
1488 to the branch which should be edited, unless this branch is already the
1489 current branch of the work tree.
1490 The tip of this branch represents the upper bound (inclusive) of commits
1491 touched by the
1492 .Cm histedit
1493 operation.
1494 .Pp
1495 Furthermore, the work tree's base commit
1496 must be set with
1497 .Cm got update -c
1498 to a point in this branch's commit history where editing should begin.
1499 This commit represents the lower bound (non-inclusive) of commits touched
1500 by the
1501 .Cm histedit
1502 operation.
1503 .Pp
1504 Editing of commit history is controlled via a
1505 .Ar histedit script
1506 which can be written in an editor based on a template, passed on the
1507 command line, or generated with the
1508 .Fl m
1509 option if only log messages need to be edited.
1510 .Pp
1511 The format of the histedit script is line-based.
1512 Each line in the script begins with a command name, followed by
1513 whitespace and an argument.
1514 For most commands, the expected argument is a commit ID SHA1 hash.
1515 Any remaining text on the line is ignored.
1516 Lines which begin with the
1517 .Sq #
1518 character are ignored entirely.
1519 .Pp
1520 The available commands are as follows:
1521 .Bl -column YXZ pick-commit
1522 .It pick Ar commit Ta Use the specified commit as it is.
1523 .It edit Ar commit Ta Use the specified commit but once changes have been
1524 merged into the work tree interrupt the histedit operation for amending.
1525 .It fold Ar commit Ta Combine the specified commit with the next commit
1526 listed further below that will be used.
1527 .It drop Ar commit Ta Remove this commit from the edited history.
1528 .It mesg Ar log-message Ta Use the specified single-line log message for
1529 the commit on the previous line.
1530 If the log message argument is left empty, open an editor where a new
1531 log message can be written.
1532 .El
1533 .Pp
1534 Every commit in the history being edited must be mentioned in the script.
1535 Lines may be re-ordered to change the order of commits in the edited history.
1536 No commit may be listed more than once.
1537 .Pp
1538 Edited commits are accumulated on a temporary branch which the work tree
1539 will remain switched to throughout the entire histedit operation.
1540 Once history editing has completed successfully, the temporary branch becomes
1541 the new version of the work tree's branch and the work tree is automatically
1542 switched to it.
1543 .Pp
1544 While merging commits, show the status of each affected file,
1545 using the following status codes:
1546 .Bl -column YXZ description
1547 .It G Ta file was merged
1548 .It C Ta file was merged and conflicts occurred during merge
1549 .It ! Ta changes destined for a missing file were not merged
1550 .It D Ta file was deleted
1551 .It d Ta file's deletion was obstructed by local modifications
1552 .It A Ta new file was added
1553 .It \(a~ Ta changes destined for a non-regular file were not merged
1554 .It ? Ta changes destined for an unversioned file were not merged
1555 .El
1556 .Pp
1557 If merge conflicts occur the histedit operation is interrupted and may
1558 be continued once conflicts have been resolved.
1559 Alternatively, the histedit operation may be aborted which will leave
1560 the work tree switched back to its original branch.
1561 .Pp
1562 If a merge conflict is resolved in a way which renders the merged
1563 change into a no-op change, the corresponding commit will be elided
1564 when the histedit operation continues.
1565 .Pp
1566 .Cm got histedit
1567 will refuse to run if certain preconditions are not met.
1568 If the work tree's current branch is not in the
1569 .Dq refs/heads/
1570 reference namespace, the history of the branch may not be edited.
1571 If the work tree contains multiple base commits it must first be updated
1572 to a single base commit with
1573 .Cm got update .
1574 If changes have been staged with
1575 .Cm got stage ,
1576 these changes must first be committed with
1577 .Cm got commit
1578 or unstaged with
1579 .Cm got unstage .
1580 If the work tree contains local changes, these changes must first be
1581 committed with
1582 .Cm got commit
1583 or reverted with
1584 .Cm got revert .
1585 If the edited history contains changes to files outside of the work tree's
1586 path prefix, the work tree cannot be used to edit the history of this branch.
1587 .Pp
1588 The
1589 .Cm got update ,
1590 .Cm got rebase ,
1591 and
1592 .Cm got integrate
1593 commands will refuse to run while a histedit operation is in progress.
1594 Other commands which manipulate the work tree may be used, and the
1595 .Cm got commit
1596 command may be used to commit arbitrary changes to the temporary branch
1597 while the histedit operation is interrupted.
1598 .Pp
1599 The options for
1600 .Cm got histedit
1601 are as follows:
1602 .Bl -tag -width Ds
1603 .It Fl a
1604 Abort an interrupted histedit operation.
1605 If this option is used, no other command-line arguments are allowed.
1606 .It Fl c
1607 Continue an interrupted histedit operation.
1608 If this option is used, no other command-line arguments are allowed.
1609 .It Fl F Ar histedit-script
1610 Use the specified
1611 .Ar histedit-script
1612 instead of opening a temporary file in an editor where a histedit script
1613 can be written.
1614 .It Fl m
1615 Edit log messages only.
1616 This option is a quick equivalent to a histedit script which edits
1617 only log messages but otherwise leaves every picked commit as-is.
1618 The
1619 .Fl m
1620 option can only be used when starting a new histedit operation.
1621 If this option is used, no other command-line arguments are allowed.
1622 .El
1623 .It Cm he
1624 Short alias for
1625 .Cm histedit .
1626 .It Cm integrate Ar branch
1627 Integrate the specified
1628 .Ar branch
1629 into the work tree's current branch.
1630 Files in the work tree are updated to match the contents on the integrated
1631 .Ar branch ,
1632 and the reference of the work tree's branch is changed to point at the
1633 head commit of the integrated
1634 .Ar branch .
1635 .Pp
1636 Both branches can be considered equivalent after integration since they
1637 will be pointing at the same commit.
1638 Both branches remain available for future work, if desired.
1639 In case the integrated
1640 .Ar branch
1641 is no longer needed it may be deleted with
1642 .Cm got branch -d .
1643 .Pp
1644 Show the status of each affected file, using the following status codes:
1645 .Bl -column YXZ description
1646 .It U Ta file was updated
1647 .It D Ta file was deleted
1648 .It A Ta new file was added
1649 .It \(a~ Ta versioned file is obstructed by a non-regular file
1650 .It ! Ta a missing versioned file was restored
1651 .El
1652 .Pp
1653 .Cm got integrate
1654 will refuse to run if certain preconditions are not met.
1655 Most importantly, the
1656 .Ar branch
1657 must have been rebased onto the work tree's current branch with
1658 .Cm got rebase
1659 before it can be integrated, in order to linearize commit history and
1660 resolve merge conflicts.
1661 If the work tree contains multiple base commits it must first be updated
1662 to a single base commit with
1663 .Cm got update .
1664 If changes have been staged with
1665 .Cm got stage ,
1666 these changes must first be committed with
1667 .Cm got commit
1668 or unstaged with
1669 .Cm got unstage .
1670 If the work tree contains local changes, these changes must first be
1671 committed with
1672 .Cm got commit
1673 or reverted with
1674 .Cm got revert .
1675 .It Cm ig
1676 Short alias for
1677 .Cm integrate .
1678 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl S Oc Op Ar path ...
1679 Stage local changes for inclusion in the next commit.
1680 If no
1681 .Ar path
1682 is specified, stage all changes in the work tree.
1683 Otherwise, stage changes at or within the specified paths.
1684 Paths may be staged if they are added, modified, or deleted according to
1685 .Cm got status .
1686 .Pp
1687 Show the status of each affected file, using the following status codes:
1688 .Bl -column YXZ description
1689 .It A Ta file addition has been staged
1690 .It M Ta file modification has been staged
1691 .It D Ta file deletion has been staged
1692 .El
1693 .Pp
1694 Staged file contents are saved in newly created blob objects in the repository.
1695 These blobs will be referred to by tree objects once staged changes have been
1696 committed.
1697 .Pp
1698 Staged changes affect the behaviour of
1699 .Cm got commit ,
1700 .Cm got status ,
1701 and
1702 .Cm got diff .
1703 While paths with staged changes exist, the
1704 .Cm got commit
1705 command will refuse to commit any paths which do not have staged changes.
1706 Local changes created on top of staged changes can only be committed if
1707 the path is staged again, or if the staged changes are committed first.
1708 The
1709 .Cm got status
1710 command will show both local changes and staged changes.
1711 The
1712 .Cm got diff
1713 command is able to display local changes relative to staged changes,
1714 and to display staged changes relative to the repository.
1715 The
1716 .Cm got revert
1717 command cannot revert staged changes but may be used to revert
1718 local changes created on top of staged changes.
1719 .Pp
1720 The options for
1721 .Cm got stage
1722 are as follows:
1723 .Bl -tag -width Ds
1724 .It Fl l
1725 Instead of staging new changes, list paths which are already staged,
1726 along with the IDs of staged blob objects and stage status codes.
1727 If paths were provided in the command line show the staged paths
1728 among the specified paths.
1729 Otherwise, show all staged paths.
1730 .It Fl p
1731 Instead of staging the entire content of a changed file, interactively
1732 select or reject changes for staging based on
1733 .Dq y
1734 (stage change),
1735 .Dq n
1736 (reject change), and
1737 .Dq q
1738 (quit staging this file) responses.
1739 If a file is in modified status, individual patches derived from the
1740 modified file content can be staged.
1741 Files in added or deleted status may only be staged or rejected in
1742 their entirety.
1743 .It Fl F Ar response-script
1744 With the
1745 .Fl p
1746 option, read
1747 .Dq y ,
1748 .Dq n ,
1749 and
1750 .Dq q
1751 responses line-by-line from the specified
1752 .Ar response-script
1753 file instead of prompting interactively.
1754 .It Fl S
1755 Allow staging of symbolic links which point outside of the path space
1756 that is under version control.
1757 By default,
1758 .Cm got stage
1759 will reject such symbolic links due to safety concerns.
1760 As a precaution,
1761 .Nm
1762 may decide to represent such a symbolic link as a regular file which contains
1763 the link's target path, rather than creating an actual symbolic link which
1764 points outside of the work tree.
1765 Use of this option is discouraged because external mechanisms such as
1766 .Dq make obj
1767 are better suited for managing symbolic links to paths not under
1768 version control.
1769 .El
1770 .Pp
1771 .Cm got stage
1772 will refuse to run if certain preconditions are not met.
1773 If a file contains merge conflicts, these conflicts must be resolved first.
1774 If a file is found to be out of date relative to the head commit on the
1775 work tree's current branch, the file must be updated with
1776 .Cm got update
1777 before it can be staged (however, this does not prevent the file from
1778 becoming out-of-date at some point after having been staged).
1779 .Pp
1780 The
1781 .Cm got update ,
1782 .Cm got rebase ,
1783 and
1784 .Cm got histedit
1785 commands will refuse to run while staged changes exist.
1786 If staged changes cannot be committed because a staged path
1787 is out of date, the path must be unstaged with
1788 .Cm got unstage
1789 before it can be updated with
1790 .Cm got update ,
1791 and may then be staged again if necessary.
1792 .It Cm sg
1793 Short alias for
1794 .Cm stage .
1795 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1796 Merge staged changes back into the work tree and put affected paths
1797 back into non-staged status.
1798 If no
1799 .Ar path
1800 is specified, unstage all staged changes across the entire work tree.
1801 Otherwise, unstage changes at or within the specified paths.
1802 .Pp
1803 Show the status of each affected file, using the following status codes:
1804 .Bl -column YXZ description
1805 .It G Ta file was unstaged
1806 .It C Ta file was unstaged and conflicts occurred during merge
1807 .It ! Ta changes destined for a missing file were not merged
1808 .It D Ta file was staged as deleted and still is deleted
1809 .It d Ta file's deletion was obstructed by local modifications
1810 .It \(a~ Ta changes destined for a non-regular file were not merged
1811 .El
1812 .Pp
1813 The options for
1814 .Cm got unstage
1815 are as follows:
1816 .Bl -tag -width Ds
1817 .It Fl p
1818 Instead of unstaging the entire content of a changed file, interactively
1819 select or reject changes for unstaging based on
1820 .Dq y
1821 (unstage change),
1822 .Dq n
1823 (keep change staged), and
1824 .Dq q
1825 (quit unstaging this file) responses.
1826 If a file is staged in modified status, individual patches derived from the
1827 staged file content can be unstaged.
1828 Files staged in added or deleted status may only be unstaged in their entirety.
1829 .It Fl F Ar response-script
1830 With the
1831 .Fl p
1832 option, read
1833 .Dq y ,
1834 .Dq n ,
1835 and
1836 .Dq q
1837 responses line-by-line from the specified
1838 .Ar response-script
1839 file instead of prompting interactively.
1840 .El
1841 .It Cm ug
1842 Short alias for
1843 .Cm unstage .
1844 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1845 Parse and print contents of objects to standard output in a line-based
1846 text format.
1847 Content of commit, tree, and tag objects is printed in a way similar
1848 to the actual content stored in such objects.
1849 Blob object contents are printed as they would appear in files on disk.
1850 .Pp
1851 Attempt to interpret each argument as a reference, a tag name, or
1852 an object ID SHA1 hash.
1853 References will be resolved to an object ID.
1854 Tag names will resolved to a tag object.
1855 An abbreviated hash argument will be expanded to a full SHA1 hash
1856 automatically, provided the abbreviation is unique.
1857 .Pp
1858 If none of the above interpretations produce a valid result, or if the
1859 .Fl P
1860 option is used, attempt to interpret the argument as a path which will
1861 be resolved to the ID of an object found at this path in the repository.
1862 .Pp
1863 The options for
1864 .Cm got cat
1865 are as follows:
1866 .Bl -tag -width Ds
1867 .It Fl c Ar commit
1868 Look up paths in the specified
1869 .Ar commit .
1870 If this option is not used, paths are looked up in the commit resolved
1871 via the repository's HEAD reference.
1872 The expected argument is a commit ID SHA1 hash or an existing reference
1873 or tag name which will be resolved to a commit ID.
1874 An abbreviated hash argument will be expanded to a full SHA1 hash
1875 automatically, provided the abbreviation is unique.
1876 .It Fl r Ar repository-path
1877 Use the repository at the specified path.
1878 If not specified, assume the repository is located at or above the current
1879 working directory.
1880 If this directory is a
1881 .Nm
1882 work tree, use the repository path associated with this work tree.
1883 .It Fl P
1884 Interpret all arguments as paths only.
1885 This option can be used to resolve ambiguity in cases where paths
1886 look like tag names, reference names, or object IDs.
1887 .El
1888 .It Cm info Op Ar path ...
1889 Display meta-data stored in a work tree.
1890 See
1891 .Xr got-worktree 5
1892 for details.
1893 .Pp
1894 The work tree to use is resolved implicitly by walking upwards from the
1895 current working directory.
1896 .Pp
1897 If one or more
1898 .Ar path
1899 arguments are specified, show additional per-file information for tracked
1900 files located at or within these paths.
1901 If a
1902 .Ar path
1903 argument corresponds to the work tree's root directory, display information
1904 for all tracked files.
1905 .El
1906 .Sh ENVIRONMENT
1907 .Bl -tag -width GOT_AUTHOR
1908 .It Ev GOT_AUTHOR
1909 The author's name and email address for
1910 .Cm got commit
1911 and
1912 .Cm got import ,
1913 for example:
1914 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1915 Because
1916 .Xr git 1
1917 may fail to parse commits without an email address in author data,
1918 .Nm
1919 attempts to reject
1920 .Ev GOT_AUTHOR
1921 environment variables with a missing email address.
1922 .Pp
1923 If present, Git's
1924 .Dv user.name
1925 and
1926 .Dv user.email
1927 configuration settings in the repository's
1928 .Pa .git/config
1929 file will override the value of
1930 .Ev GOT_AUTHOR .
1931 However, the
1932 .Dv user.name
1933 and
1934 .Dv user.email
1935 configuration settings contained in Git's global
1936 .Pa ~/.gitconfig
1937 configuration file will be used only if the
1938 .Ev GOT_AUTHOR
1939 environment variable is
1940 .Em not
1941 set.
1942 .It Ev VISUAL , EDITOR
1943 The editor spawned by
1944 .Cm got commit ,
1945 .Cm got import ,
1947 .Cm got tag .
1948 .It Ev GOT_LOG_DEFAULT_LIMIT
1949 The default limit on the number of commits traversed by
1950 .Cm got log .
1951 If set to zero, the limit is unbounded.
1952 This variable will be silently ignored if it is set to a non-numeric value.
1953 .El
1954 .Sh EXIT STATUS
1955 .Ex -std got
1956 .Sh EXAMPLES
1957 Clone an existing Git repository for use with
1958 .Nm .
1959 .Pp
1960 .Dl $ cd /var/git/
1961 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1962 .Pp
1963 Use of HTTP URLs currently requires
1964 .Xr git 1 :
1965 .Pp
1966 .Dl $ cd /var/git/
1967 .Dl $ git clone --bare https://github.com/openbsd/src.git
1968 .Pp
1969 Alternatively, for quick and dirty local testing of
1970 .Nm
1971 a new Git repository could be created and populated with files,
1972 e.g. from a temporary CVS checkout located at
1973 .Pa /tmp/src :
1974 .Pp
1975 .Dl $ got init /var/git/src.git
1976 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1977 .Pp
1978 Check out a work tree from the Git repository to /usr/src:
1979 .Pp
1980 .Dl $ got checkout /var/git/src.git /usr/src
1981 .Pp
1982 View local changes in a work tree directory:
1983 .Pp
1984 .Dl $ got diff | less
1985 .Pp
1986 In a work tree, display files in a potentially problematic state:
1987 .Pp
1988 .Dl $ got status -s 'C!~?'
1989 .Pp
1990 Interactively revert selected local changes in a work tree directory:
1991 .Pp
1992 .Dl $ got revert -p -R\ .
1993 .Pp
1994 In a work tree or a git repository directory, list all branch references:
1995 .Pp
1996 .Dl $ got branch -l
1997 .Pp
1998 In a work tree or a git repository directory, create a new branch called
1999 .Dq unified-buffer-cache
2000 which is forked off the
2001 .Dq master
2002 branch:
2003 .Pp
2004 .Dl $ got branch unified-buffer-cache master
2005 .Pp
2006 Switch an existing work tree to the branch
2007 .Dq unified-buffer-cache .
2008 Local changes in the work tree will be preserved and merged if necessary:
2009 .Pp
2010 .Dl $ got update -b unified-buffer-cache
2011 .Pp
2012 Create a new commit from local changes in a work tree directory.
2013 This new commit will become the head commit of the work tree's current branch:
2014 .Pp
2015 .Dl $ got commit
2016 .Pp
2017 In a work tree or a git repository directory, view changes committed in
2018 the 3 most recent commits to the work tree's branch, or the branch resolved
2019 via the repository's HEAD reference, respectively:
2020 .Pp
2021 .Dl $ got log -p -l 3
2022 .Pp
2023 As above, but display changes in the order in which
2024 .Xr patch 1
2025 could apply them in sequence:
2026 .Pp
2027 .Dl $ got log -p -l 3 -R
2028 .Pp
2029 In a work tree or a git repository directory, log the history of a subdirectory:
2030 .Pp
2031 .Dl $ got log sys/uvm
2032 .Pp
2033 While operating inside a work tree, paths are specified relative to the current
2034 working directory, so this command will log the subdirectory
2035 .Pa sys/uvm :
2036 .Pp
2037 .Dl $ cd sys/uvm && got log\ .
2038 .Pp
2039 And this command has the same effect:
2040 .Pp
2041 .Dl $ cd sys/dev/usb && got log ../../uvm
2042 .Pp
2043 And this command displays work tree meta-data about all tracked files:
2044 .Pp
2045 .Dl $ cd /usr/src
2046 .Dl $ got info\ . | less
2047 .Pp
2048 Add new files and remove obsolete files in a work tree directory:
2049 .Pp
2050 .Dl $ got add sys/uvm/uvm_ubc.c
2051 .Dl $ got remove sys/uvm/uvm_vnode.c
2052 .Pp
2053 Create a new commit from local changes in a work tree directory
2054 with a pre-defined log message.
2055 .Pp
2056 .Dl $ got commit -m 'unify the buffer cache'
2057 .Pp
2058 Alternatively, create a new commit from local changes in a work tree
2059 directory with a log message that has been prepared in the file
2060 .Pa /tmp/msg .
2062 .Xr vi 1
2063 is set as the
2064 .Ev EDITOR ,
2065 .Pa /tmp/msg
2066 can be read into the buffer for review:
2067 .Pp
2068 .Dl $ got commit
2069 .Dl :r /tmp/msg
2070 .Pp
2071 Update any work tree checked out from the
2072 .Dq unified-buffer-cache
2073 branch to the latest commit on this branch:
2074 .Pp
2075 .Dl $ got update
2076 .Pp
2077 Roll file content on the unified-buffer-cache branch back by one commit,
2078 and then fetch the rolled-back change into the work tree as a local change
2079 to be amended and perhaps committed again:
2080 .Pp
2081 .Dl $ got backout unified-buffer-cache
2082 .Dl $ got commit -m 'roll back previous'
2083 .Dl $ # now back out the previous backout :-)
2084 .Dl $ got backout unified-buffer-cache
2085 .Pp
2086 Fetch new upstream commits into the local repository's
2087 .Dq origin/master
2088 branch:
2089 .Pp
2090 .Dl $ cd /usr/src
2091 .Dl $ got fetch
2092 .Pp
2093 In a repository created with a HTTP URL and
2094 .Cm git clone --bare
2095 the
2096 .Xr git-fetch 1
2097 command must be used instead:
2098 .Pp
2099 .Dl $ cd /var/git/src.git
2100 .Dl $ git fetch origin master:refs/remotes/origin/master
2101 .Pp
2102 Rebase the local
2103 .Dq master
2104 branch to merge the new changes that are now visible on the
2105 .Dq origin/master
2106 branch:
2107 .Pp
2108 .Dl $ cd /usr/src
2109 .Dl $ got update -b origin/master
2110 .Dl $ got rebase master
2111 .Pp
2112 Rebase the
2113 .Dq unified-buffer-cache
2114 branch on top of the new head commit of the
2115 .Dq master
2116 branch.
2117 .Pp
2118 .Dl $ got update -b master
2119 .Dl $ got rebase unified-buffer-cache
2120 .Pp
2121 Create a patch from all changes on the unified-buffer-cache branch.
2122 The patch can be mailed out for review and applied to
2123 .Ox Ns 's
2124 CVS tree:
2125 .Pp
2126 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
2127 .Pp
2128 Edit the entire commit history of the
2129 .Dq unified-buffer-cache
2130 branch:
2131 .Pp
2132 .Dl $ got update -b unified-buffer-cache
2133 .Dl $ got update -c master
2134 .Dl $ got histedit
2135 .Pp
2136 In order to merge changes committed to the
2137 .Dq unified-buffer-cache
2138 branch back into the
2139 .Dq master
2140 branch, the
2141 .Dq unified-buffer-cache
2142 branch must first be rebased onto the
2143 .Dq master
2144 branch:
2145 .Pp
2146 .Dl $ got update -b master
2147 .Dl $ got rebase unified-buffer-cache
2148 .Pp
2149 Changes on the
2150 .Dq unified-buffer-cache
2151 branch can now be made visible on the
2152 .Dq master
2153 branch with
2154 .Cm got integrate .
2155 Because the rebase operation switched the work tree to the
2156 .Dq unified-buffer-cache
2157 branch, the work tree must be switched back to the
2158 .Dq master
2159 branch before the
2160 .Dq unified-buffer-cache
2161 branch can be integrated into
2162 .Dq master :
2163 .Pp
2164 .Dl $ got update -b master
2165 .Dl $ got integrate unified-buffer-cache
2166 .Pp
2167 Additional steps may be necessary if local changes need to be pushed back
2168 to the remote repository, which currently requires
2169 .Cm git push .
2170 Before working against existing branches in a repository cloned with
2171 .Cm git clone --bare
2172 instead of
2173 .Cm got clone ,
2174 a Git
2175 .Dq refspec
2176 must be configured to map all references in the remote repository
2177 into the
2178 .Dq refs/remotes
2179 namespace of the local repository.
2180 This can achieved by setting Git's
2181 .Pa remote.origin.fetch
2182 configuration variable to the value
2183 .Dq +refs/heads/*:refs/remotes/origin/*
2184 with the
2185 .Cm git config
2186 command:
2187 .Pp
2188 .Dl $ cd /var/git/repo
2189 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
2190 .Pp
2191 Additionally, the
2192 .Dq mirror
2193 option must be disabled:
2194 .Pp
2195 .Dl $ cd /var/git/repo
2196 .Dl $ git config remote.origin.mirror false
2197 .Pp
2198 Alternatively, the following
2199 .Xr git-fetch 1
2200 configuration item can be added manually to the Git repository's
2201 .Pa config
2202 file:
2203 .Pp
2204 .Dl [remote "origin"]
2205 .Dl url = ...
2206 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
2207 .Dl mirror = false
2208 .Pp
2209 This configuration leaves the local repository's
2210 .Dq refs/heads
2211 namespace free for use by local branches checked out with
2212 .Cm got checkout
2213 and, if needed, created with
2214 .Cm got branch .
2215 .Pp
2216 Branches in the
2217 .Dq remotes/origin
2218 namespace can now be updated with incoming changes from the remote
2219 repository with
2220 .Cm got fetch
2222 .Xr git-fetch 1
2223 without extra command line arguments:
2224 .Pp
2225 .Dl $ cd /var/git/repo
2226 .Dl $ git fetch
2227 .Pp
2228 To make changes fetched from the remote repository appear on the
2229 .Dq master
2230 branch, the
2231 .Dq master
2232 branch must be rebased onto the
2233 .Dq origin/master
2234 branch.
2235 This will also merge local changes, if any, with the incoming changes:
2236 .Pp
2237 .Dl $ got update -b origin/master
2238 .Dl $ got rebase master
2239 .Pp
2240 On the
2241 .Dq master
2242 branch, log messages for local changes can now be amended with
2243 .Dq OK
2244 by other developers and any other important new information:
2245 .Pp
2246 .Dl $ got update -c origin/master
2247 .Dl $ got histedit -m
2248 .Pp
2249 Local changes on the
2250 .Dq master
2251 branch can then be pushed to the remote
2252 repository with
2253 .Cm git push :
2254 .Pp
2255 .Dl $ cd /var/git/repo
2256 .Dl $ git push origin master
2257 .Sh SEE ALSO
2258 .Xr tog 1 ,
2259 .Xr git-repository 5 ,
2260 .Xr got-worktree 5
2261 .Sh AUTHORS
2262 .An Stefan Sperling Aq Mt stsp@openbsd.org
2263 .An Martin Pieuchot Aq Mt mpi@openbsd.org
2264 .An Joshua Stein Aq Mt jcs@openbsd.org
2265 .An Ori Bernstein Aq Mt ori@openbsd.org
2266 .Sh CAVEATS
2267 .Nm
2268 is a work-in-progress and many commands remain to be implemented.
2269 At present, the user has to fall back on
2270 .Xr git 1
2271 to perform many tasks, in particular tasks related to repository
2272 administration and tasks which require a network connection.