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