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 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 For compatibility with
650 .Xr cvs 1
651 and
652 .Xr git 1 ,
653 .Cm got status
654 reads
655 .Xr glob 7
656 patterns from
657 .Pa .cvsignore
658 and
659 .Pa .gitignore
660 files in each traversed directory and will not display unversioned files
661 which match these patterns.
662 As an extension to
663 .Xr glob 7
664 matching rules,
665 .Cm got status
666 supports consecutive asterisks,
667 .Dq ** ,
668 which will match an arbitrary amount of directories.
669 Unlike
670 .Xr cvs 1 ,
671 .Cm got status
672 only supports a single ignore pattern per line.
673 Unlike
674 .Xr git 1 ,
675 .Cm got status
676 does not support negated ignore patterns prefixed with
677 .Dq \&! ,
678 and gives no special significance to the location of path component separators,
679 .Dq / ,
680 in a pattern.
681 .It Cm st
682 Short alias for
683 .Cm status .
684 .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
685 Display history of a repository.
686 If a
687 .Ar path
688 is specified, show only commits which modified this path.
689 If invoked in a work tree, the
690 .Ar path
691 is interpreted relative to the current working directory,
692 and the work tree's path prefix is implicitly prepended.
693 Otherwise, the path is interpreted relative to the repository root.
694 .Pp
695 The options for
696 .Cm got log
697 are as follows:
698 .Bl -tag -width Ds
699 .It Fl b
700 Display individual commits which were merged into the current branch
701 from other branches.
702 By default,
703 .Cm got log
704 shows the linear history of the current branch only.
705 .It Fl c Ar commit
706 Start traversing history at the specified
707 .Ar commit .
708 The expected argument is a commit ID SHA1 hash or an existing reference
709 or tag name which will be resolved to a commit ID.
710 An abbreviated hash argument will be expanded to a full SHA1 hash
711 automatically, provided the abbreviation is unique.
712 If this option is not specified, default to the work tree's current branch
713 if invoked in a work tree, or to the repository's HEAD reference.
714 .It Fl C Ar number
715 Set the number of context lines shown in diffs with
716 .Fl p .
717 By default, 3 lines of context are shown.
718 .It Fl l Ar N
719 Limit history traversal to a given number of commits.
720 If this option is not specified, a default limit value of zero is used,
721 which is treated as an unbounded limit.
722 The
723 .Ev GOT_LOG_DEFAULT_LIMIT
724 environment variable may be set to change this default value.
725 .It Fl p
726 Display the patch of modifications made in each commit.
727 If a
728 .Ar path
729 is specified, only show the patch of modifications at or within this path.
730 .It Fl P
731 Display the list of file paths changed in each commit, using the following
732 status codes:
733 .Bl -column YXZ description
734 .It M Ta modified file
735 .It D Ta file was deleted
736 .It A Ta new file was added
737 .It m Ta modified file modes (executable bit only)
738 .El
739 .It Fl s Ar search-pattern
740 If specified, show only commits with a log message matched by the extended
741 regular expression
742 .Ar search-pattern .
743 When used together with
744 .Fl P
745 then the file paths changed by a commit can be matched as well.
746 Regular expression syntax is documented in
747 .Xr re_format 7 .
748 .It Fl r Ar repository-path
749 Use the repository at the specified path.
750 If not specified, assume the repository is located at or above the current
751 working directory.
752 If this directory is a
753 .Nm
754 work tree, use the repository path associated with this work tree.
755 .It Fl R
756 Determine a set of commits to display as usual, but display these commits
757 in reverse order.
758 .It Fl x Ar commit
759 Stop traversing commit history as soon as the specified
760 .Ar commit
761 has been traversed.
762 This option has no effect if the specified
763 .Ar commit
764 is never traversed.
765 .El
766 .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
767 When invoked within a work tree with less than two arguments, display
768 local changes in the work tree.
769 If a
770 .Ar path
771 is specified, only show changes within this path.
772 .Pp
773 If two arguments are provided, treat each argument as a reference, a tag
774 name, or an object ID SHA1 hash, and display differences between the
775 corresponding objects.
776 Both objects must be of the same type (blobs, trees, or commits).
777 An abbreviated hash argument will be expanded to a full SHA1 hash
778 automatically, provided the abbreviation is unique.
779 .Pp
780 The options for
781 .Cm got diff
782 are as follows:
783 .Bl -tag -width Ds
784 .It Fl C Ar number
785 Set the number of context lines shown in the diff.
786 By default, 3 lines of context are shown.
787 .It Fl r Ar repository-path
788 Use the repository at the specified path.
789 If not specified, assume the repository is located at or above the current
790 working directory.
791 If this directory is a
792 .Nm
793 work tree, use the repository path associated with this work tree.
794 .It Fl s
795 Show changes staged with
796 .Cm got stage
797 instead of showing local changes in the work tree.
798 This option is only valid when
799 .Cm got diff
800 is invoked in a work tree.
801 .It Fl w
802 Ignore whitespace-only changes.
803 .El
804 .It Cm di
805 Short alias for
806 .Cm diff .
807 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
808 Display line-by-line history of a file at the specified path.
809 .Pp
810 The options for
811 .Cm got blame
812 are as follows:
813 .Bl -tag -width Ds
814 .It Fl c Ar commit
815 Start traversing history at the specified
816 .Ar commit .
817 The expected argument is a commit ID SHA1 hash or an existing reference
818 or tag name which will be resolved to a commit ID.
819 An abbreviated hash argument will be expanded to a full SHA1 hash
820 automatically, provided the abbreviation is unique.
821 .It Fl r Ar repository-path
822 Use the repository at the specified path.
823 If not specified, assume the repository is located at or above the current
824 working directory.
825 If this directory is a
826 .Nm
827 work tree, use the repository path associated with this work tree.
828 .El
829 .It Cm bl
830 Short alias for
831 .Cm blame .
832 .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
833 Display a listing of files and directories at the specified
834 directory path in the repository.
835 Entries shown in this listing may carry one of the following trailing
836 annotations:
837 .Bl -column YXZ description
838 .It @ Ta entry is a symbolic link
839 .It / Ta entry is a directory
840 .It * Ta entry is an executable file
841 .It $ Ta entry is a Git submodule
842 .El
843 .Pp
844 Symbolic link entries are also annotated with the target path of the link.
845 .Pp
846 If no
847 .Ar path
848 is specified, list the repository path corresponding to the current
849 directory of the work tree, or the root directory of the repository
850 if there is no work tree.
851 .Pp
852 The options for
853 .Cm got tree
854 are as follows:
855 .Bl -tag -width Ds
856 .It Fl c Ar commit
857 List files and directories as they appear in the specified
858 .Ar commit .
859 The expected argument is a commit ID SHA1 hash or an existing reference
860 or tag name which will be resolved to a commit ID.
861 An abbreviated hash argument will be expanded to a full SHA1 hash
862 automatically, provided the abbreviation is unique.
863 .It Fl r Ar repository-path
864 Use the repository at the specified path.
865 If not specified, assume the repository is located at or above the current
866 working directory.
867 If this directory is a
868 .Nm
869 work tree, use the repository path associated with this work tree.
870 .It Fl i
871 Show object IDs of files (blob objects) and directories (tree objects).
872 .It Fl R
873 Recurse into sub-directories in the repository.
874 .El
875 .It Cm tr
876 Short alias for
877 .Cm tree .
878 .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
879 Manage references in a repository.
880 .Pp
881 References may be listed, created, deleted, and changed.
882 When creating, deleting, or changing a reference the specified
883 .Ar name
884 must be an absolute reference name, i.e. it must begin with
885 .Dq refs/ .
886 .Pp
887 The options for
888 .Cm got ref
889 are as follows:
890 .Bl -tag -width Ds
891 .It Fl r Ar repository-path
892 Use the repository at the specified path.
893 If not specified, assume the repository is located at or above the current
894 working directory.
895 If this directory is a
896 .Nm
897 work tree, use the repository path associated with this work tree.
898 .It Fl l
899 List references in the repository.
900 If no
901 .Ar name
902 is specified, list all existing references in the repository.
903 If
904 .Ar name
905 is a reference namespace, list all references in this namespace.
906 Otherwise, show only the reference with the given
907 .Ar name .
908 Cannot be used together with any other options except
909 .Fl r .
910 .It Fl c Ar object
911 Create a reference or change an existing reference.
912 The reference with the specified
913 .Ar name
914 will point at the specified
915 .Ar object.
916 The expected
917 .Ar object
918 argument is a ID SHA1 hash or an existing reference or tag name which will
919 be resolved to the ID of a corresponding commit, tree, tag, or blob object.
920 Cannot be used together with any other options except
921 .Fl r .
922 .It Fl s Ar reference
923 Create a symbolic reference, or change an existing symbolic reference.
924 The symbolic reference with the specified
925 .Ar name
926 will point at the specified
927 .Ar reference
928 which must already exist in the repository.
929 Care should be taken not to create loops between references when
930 this option is used.
931 Cannot be used together with any other options except
932 .Fl r .
933 .It Fl d
934 Delete the reference with the specified
935 .Ar name
936 from the repository.
937 Cannot be used together with any other options except
938 .Fl r .
939 .El
940 .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
941 Create, list, or delete branches.
942 .Pp
943 Branches are managed via references which live in the
944 .Dq refs/heads/
945 reference namespace.
946 The
947 .Cm got branch
948 command operates on references in this namespace only.
949 .Pp
950 If invoked in a work tree without any arguments, print the name of the
951 work tree's current branch.
952 .Pp
953 If a
954 .Ar name
955 argument is passed, attempt to create a branch reference with the given name.
956 By default the new branch reference will point at the latest commit on the
957 work tree's current branch if invoked in a work tree, and otherwise to a commit
958 resolved via the repository's HEAD reference.
959 .Pp
960 If invoked in a work tree, once the branch was created successfully
961 switch the work tree's head reference to the newly created branch and
962 update files across the entire work tree, just like
963 .Cm got update -b Ar name
964 would do.
965 Show the status of each affected file, using the following status codes:
966 .Bl -column YXZ description
967 .It U Ta file was updated and contained no local changes
968 .It G Ta file was updated and local changes were merged cleanly
969 .It C Ta file was updated and conflicts occurred during merge
970 .It D Ta file was deleted
971 .It A Ta new file was added
972 .It \(a~ Ta versioned file is obstructed by a non-regular file
973 .It ! Ta a missing versioned file was restored
974 .El
975 .Pp
976 The options for
977 .Cm got branch
978 are as follows:
979 .Bl -tag -width Ds
980 .It Fl c Ar commit
981 Make a newly created branch reference point at the specified
982 .Ar commit .
983 The expected
984 .Ar commit
985 argument is a commit ID SHA1 hash or an existing reference
986 or tag name which will be resolved to a commit ID.
987 .It Fl r Ar repository-path
988 Use the repository at the specified path.
989 If not specified, assume the repository is located at or above the current
990 working directory.
991 If this directory is a
992 .Nm
993 work tree, use the repository path associated with this work tree.
994 .It Fl l
995 List all existing branches in the repository.
996 If invoked in a work tree, the work tree's current branch is shown
997 with one the following annotations:
998 .Bl -column YXZ description
999 .It * Ta work tree's base commit matches the branch tip
1000 .It \(a~ Ta work tree's base commit is out-of-date
1001 .El
1002 .It Fl d Ar name
1003 Delete the branch with the specified name from the repository.
1004 Only the branch reference is deleted.
1005 Any commit, tree, and blob objects belonging to the branch
1006 remain in the repository and may be removed separately with
1007 Git's garbage collector.
1008 .It Fl n
1009 Do not switch and update the work tree after creating a new branch.
1010 .El
1011 .It Cm br
1012 Short alias for
1013 .Cm branch .
1014 .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
1015 Manage tags in a repository.
1016 .Pp
1017 Tags are managed via references which live in the
1018 .Dq refs/tags/
1019 reference namespace.
1020 The
1021 .Cm got tag
1022 command operates on references in this namespace only.
1023 References in this namespace point at tag objects which contain a pointer
1024 to another object, a tag message, as well as author and timestamp information.
1025 .Pp
1026 Attempt to create a tag with the given
1027 .Ar name ,
1028 and make this tag point at the given
1029 .Ar commit .
1030 If no commit is specified, default to the latest commit on the work tree's
1031 current branch if invoked in a work tree, and to a commit resolved via
1032 the repository's HEAD reference otherwise.
1033 .Pp
1034 The options for
1035 .Cm got tag
1036 are as follows:
1037 .Bl -tag -width Ds
1038 .It Fl c Ar commit
1039 Make the newly created tag reference point at the specified
1040 .Ar commit .
1041 The expected
1042 .Ar commit
1043 argument is a commit ID SHA1 hash or an existing reference or tag name which
1044 will be resolved to a commit ID.
1045 An abbreviated hash argument will be expanded to a full SHA1 hash
1046 automatically, provided the abbreviation is unique.
1047 .It Fl m Ar message
1048 Use the specified tag message when creating the new tag.
1049 Without the
1050 .Fl m
1051 option,
1052 .Cm got tag
1053 opens a temporary file in an editor where a tag message can be written.
1054 .It Fl r Ar repository-path
1055 Use the repository at the specified path.
1056 If not specified, assume the repository is located at or above the current
1057 working directory.
1058 If this directory is a
1059 .Nm
1060 work tree, use the repository path associated with this work tree.
1061 .It Fl l
1062 List all existing tags in the repository instead of creating a new tag.
1063 If this option is used, no other command-line arguments are allowed.
1064 .El
1065 .Pp
1066 By design, the
1067 .Cm got tag
1068 command will not delete tags or change existing tags.
1069 If a tag must be deleted, the
1070 .Cm got ref
1071 command may be used to delete a tag's reference.
1072 This should only be done if the tag has not already been copied to
1073 another repository.
1074 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
1075 Schedule unversioned files in a work tree for addition to the
1076 repository in the next commit.
1077 .Pp
1078 The options for
1079 .Cm got add
1080 are as follows:
1081 .Bl -tag -width Ds
1082 .It Fl R
1083 Permit recursion into directories.
1084 If this option is not specified,
1085 .Cm got add
1086 will refuse to run if a specified
1087 .Ar path
1088 is a directory.
1089 .It Fl I
1090 With -R, add files even if they match a
1091 .Cm got status
1092 ignore pattern.
1093 .El
1094 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Ar path ...
1095 Remove versioned files from a work tree and schedule them for deletion
1096 from the repository in the next commit.
1097 .Pp
1098 The options for
1099 .Cm got remove
1100 are as follows:
1101 .Bl -tag -width Ds
1102 .It Fl f
1103 Perform the operation even if a file contains local modifications.
1104 .It Fl k
1105 Keep affected files on disk.
1106 .It Fl R
1107 Permit recursion into directories.
1108 If this option is not specified,
1109 .Cm got remove
1110 will refuse to run if a specified
1111 .Ar path
1112 is a directory.
1113 .El
1114 .It Cm rm
1115 Short alias for
1116 .Cm remove .
1117 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
1118 Revert any local changes in files at the specified paths in a work tree.
1119 File contents will be overwritten with those contained in the
1120 work tree's base commit.
1121 There is no way to bring discarded changes back after
1122 .Cm got revert !
1123 .Pp
1124 If a file was added with
1125 .Cm got add
1126 it will become an unversioned file again.
1127 If a file was deleted with
1128 .Cm got remove
1129 it will be restored.
1130 .Pp
1131 The options for
1132 .Cm got revert
1133 are as follows:
1134 .Bl -tag -width Ds
1135 .It Fl p
1136 Instead of reverting all changes in files, interactively select or reject
1137 changes to revert based on
1138 .Dq y
1139 (revert change),
1140 .Dq n
1141 (keep change), and
1142 .Dq q
1143 (quit reverting this file) responses.
1144 If a file is in modified status, individual patches derived from the
1145 modified file content can be reverted.
1146 Files in added or deleted status may only be reverted in their entirety.
1147 .It Fl F Ar response-script
1148 With the
1149 .Fl p
1150 option, read
1151 .Dq y ,
1152 .Dq n ,
1153 and
1154 .Dq q
1155 responses line-by-line from the specified
1156 .Ar response-script
1157 file instead of prompting interactively.
1158 .It Fl R
1159 Permit recursion into directories.
1160 If this option is not specified,
1161 .Cm got revert
1162 will refuse to run if a specified
1163 .Ar path
1164 is a directory.
1165 .El
1166 .It Cm rv
1167 Short alias for
1168 .Cm revert .
1169 .It Cm commit Oo Fl m Ar message Oc Oo Fl S Oc Op Ar path ...
1170 Create a new commit in the repository from changes in a work tree
1171 and use this commit as the new base commit for the work tree.
1172 If no
1173 .Ar path
1174 is specified, commit all changes in the work tree.
1175 Otherwise, commit changes at or within the specified paths.
1176 .Pp
1177 If changes have been explicitly staged for commit with
1178 .Cm got stage ,
1179 only commit staged changes and reject any specified paths which
1180 have not been staged.
1181 .Pp
1182 Show the status of each affected file, using the following status codes:
1183 .Bl -column YXZ description
1184 .It M Ta modified file
1185 .It D Ta file was deleted
1186 .It A Ta new file was added
1187 .It m Ta modified file modes (executable bit only)
1188 .El
1189 .Pp
1190 Files which are not part of the new commit will retain their previously
1191 recorded base commit.
1192 Some
1193 .Nm
1194 commands may refuse to run while the work tree contains files from
1195 multiple base commits.
1196 The base commit of such a work tree can be made consistent by running
1197 .Cm got update
1198 across the entire work tree.
1199 .Pp
1200 The
1201 .Cm got commit
1202 command requires the
1203 .Ev GOT_AUTHOR
1204 environment variable to be set,
1205 unless Git's
1206 .Dv user.name
1207 and
1208 .Dv user.email
1209 configuration settings can be
1210 obtained from the repository's
1211 .Pa .git/config
1212 file or from Git's global
1213 .Pa ~/.gitconfig
1214 configuration file.
1215 .Pp
1216 The options for
1217 .Cm got commit
1218 are as follows:
1219 .Bl -tag -width Ds
1220 .It Fl m Ar message
1221 Use the specified log message when creating the new commit.
1222 Without the
1223 .Fl m
1224 option,
1225 .Cm got commit
1226 opens a temporary file in an editor where a log message can be written.
1227 .It Fl S
1228 Allow the addition of symbolic links which point outside of the path space
1229 that is under version control.
1230 By default,
1231 .Cm got commit
1232 will reject such symbolic links due to safety concerns.
1233 As a precaution,
1234 .Nm
1235 may decide to represent such a symbolic link as a regular file which contains
1236 the link's target path, rather than creating an actual symbolic link which
1237 points outside of the work tree.
1238 Use of this option is discouraged because external mechanisms such as
1239 .Dq make obj
1240 are better suited for managing symbolic links to paths not under
1241 version control.
1242 .El
1243 .Pp
1244 .Cm got commit
1245 will refuse to run if certain preconditions are not met.
1246 If the work tree's current branch is not in the
1247 .Dq refs/heads/
1248 reference namespace, new commits may not be created on this branch.
1249 Local changes may only be committed if they are based on file content
1250 found in the most recent commit on the work tree's branch.
1251 If a path is found to be out of date,
1252 .Cm got update
1253 must be used first in order to merge local changes with changes made
1254 in the repository.
1255 .It Cm ci
1256 Short alias for
1257 .Cm commit .
1258 .It Cm cherrypick Ar commit
1259 Merge changes from a single
1260 .Ar commit
1261 into the work tree.
1262 The specified
1263 .Ar commit
1264 must be on a different branch than the work tree's base commit.
1265 The expected argument is a reference or a commit ID SHA1 hash.
1266 An abbreviated hash argument will be expanded to a full SHA1 hash
1267 automatically, provided the abbreviation is unique.
1268 .Pp
1269 Show the status of each affected file, using the following status codes:
1270 .Bl -column YXZ description
1271 .It G Ta file was merged
1272 .It C Ta file was merged and conflicts occurred during merge
1273 .It ! Ta changes destined for a missing file were not merged
1274 .It D Ta file was deleted
1275 .It d Ta file's deletion was obstructed by local modifications
1276 .It A Ta new file was added
1277 .It \(a~ Ta changes destined for a non-regular file were not merged
1278 .It ? Ta changes destined for an unversioned file were not merged
1279 .El
1280 .Pp
1281 The merged changes will appear as local changes in the work tree, which
1282 may be viewed with
1283 .Cm got diff ,
1284 amended manually or with further
1285 .Cm got cherrypick
1286 commands,
1287 committed with
1288 .Cm got commit ,
1289 or discarded again with
1290 .Cm got revert .
1291 .Pp
1292 .Cm got cherrypick
1293 will refuse to run if certain preconditions are not met.
1294 If the work tree contains multiple base commits it must first be updated
1295 to a single base commit with
1296 .Cm got update .
1297 If the work tree already contains files with merge conflicts, these
1298 conflicts must be resolved first.
1299 .It Cm cy
1300 Short alias for
1301 .Cm cherrypick .
1302 .It Cm backout Ar commit
1303 Reverse-merge changes from a single
1304 .Ar commit
1305 into the work tree.
1306 The specified
1307 .Ar commit
1308 must be on the same branch as the work tree's base commit.
1309 The expected argument is a reference or a commit ID SHA1 hash.
1310 An abbreviated hash argument will be expanded to a full SHA1 hash
1311 automatically, provided the abbreviation is unique.
1312 .Pp
1313 Show the status of each affected file, using the following status codes:
1314 .Bl -column YXZ description
1315 .It G Ta file was merged
1316 .It C Ta file was merged and conflicts occurred during merge
1317 .It ! Ta changes destined for a missing file were not merged
1318 .It D Ta file was deleted
1319 .It d Ta file's deletion was obstructed by local modifications
1320 .It A Ta new file was added
1321 .It \(a~ Ta changes destined for a non-regular file were not merged
1322 .It ? Ta changes destined for an unversioned file were not merged
1323 .El
1324 .Pp
1325 The reverse-merged changes will appear as local changes in the work tree,
1326 which may be viewed with
1327 .Cm got diff ,
1328 amended manually or with further
1329 .Cm got backout
1330 commands,
1331 committed with
1332 .Cm got commit ,
1333 or discarded again with
1334 .Cm got revert .
1335 .Pp
1336 .Cm got backout
1337 will refuse to run if certain preconditions are not met.
1338 If the work tree contains multiple base commits it must first be updated
1339 to a single base commit with
1340 .Cm got update .
1341 If the work tree already contains files with merge conflicts, these
1342 conflicts must be resolved first.
1343 .It Cm bo
1344 Short alias for
1345 .Cm backout .
1346 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
1347 Rebase commits on the specified
1348 .Ar branch
1349 onto the tip of the current branch of the work tree.
1350 The
1351 .Ar branch
1352 must share common ancestry with the work tree's current branch.
1353 Rebasing begins with the first descendant commit of the youngest
1354 common ancestor commit shared by the specified
1355 .Ar branch
1356 and the work tree's current branch, and stops once the tip commit
1357 of the specified
1358 .Ar branch
1359 has been rebased.
1360 .Pp
1361 When
1362 .Cm got rebase
1363 is used as intended, the specified
1364 .Ar branch
1365 represents a local commit history and may already contain changes
1366 that are not yet visible in any other repositories.
1367 The work tree's current branch, which must be set with
1368 .Cm got update -b
1369 before starting the
1370 .Cm rebase
1371 operation, represents a branch from a remote repository which shares
1372 a common history with the specified
1373 .Ar branch
1374 but has progressed, and perhaps diverged, due to commits added to the
1375 remote repository.
1376 .Pp
1377 Rebased commits are accumulated on a temporary branch which the work tree
1378 will remain switched to throughout the entire rebase operation.
1379 Commits on this branch represent the same changes with the same log
1380 messages as their counterparts on the original
1381 .Ar branch ,
1382 but with different commit IDs.
1383 Once rebasing has completed successfully, the temporary branch becomes
1384 the new version of the specified
1385 .Ar branch
1386 and the work tree is automatically switched to it.
1387 .Pp
1388 While rebasing commits, show the status of each affected file,
1389 using the following status codes:
1390 .Bl -column YXZ description
1391 .It G Ta file was merged
1392 .It C Ta file was merged and conflicts occurred during merge
1393 .It ! Ta changes destined for a missing file were not merged
1394 .It D Ta file was deleted
1395 .It d Ta file's deletion was obstructed by local modifications
1396 .It A Ta new file was added
1397 .It \(a~ Ta changes destined for a non-regular file were not merged
1398 .It ? Ta changes destined for an unversioned file were not merged
1399 .El
1400 .Pp
1401 If merge conflicts occur the rebase operation is interrupted and may
1402 be continued once conflicts have been resolved.
1403 Alternatively, the rebase operation may be aborted which will leave
1404 .Ar branch
1405 unmodified and the work tree switched back to its original branch.
1406 .Pp
1407 If a merge conflict is resolved in a way which renders the merged
1408 change into a no-op change, the corresponding commit will be elided
1409 when the rebase operation continues.
1410 .Pp
1411 .Cm got rebase
1412 will refuse to run if certain preconditions are not met.
1413 If the work tree is not yet fully updated to the tip commit of its
1414 branch then the work tree must first be updated with
1415 .Cm got update .
1416 If changes have been staged with
1417 .Cm got stage ,
1418 these changes must first be committed with
1419 .Cm got commit
1420 or unstaged with
1421 .Cm got unstage .
1422 If the work tree contains local changes, these changes must first be
1423 committed with
1424 .Cm got commit
1425 or reverted with
1426 .Cm got revert .
1427 If the
1428 .Ar branch
1429 contains changes to files outside of the work tree's path prefix,
1430 the work tree cannot be used to rebase this branch.
1431 .Pp
1432 The
1433 .Cm got update
1434 and
1435 .Cm got commit
1436 commands will refuse to run while a rebase operation is in progress.
1437 Other commands which manipulate the work tree may be used for
1438 conflict resolution purposes.
1439 .Pp
1440 The options for
1441 .Cm got rebase
1442 are as follows:
1443 .Bl -tag -width Ds
1444 .It Fl a
1445 Abort an interrupted rebase operation.
1446 If this option is used, no other command-line arguments are allowed.
1447 .It Fl c
1448 Continue an interrupted rebase operation.
1449 If this option is used, no other command-line arguments are allowed.
1450 .El
1451 .It Cm rb
1452 Short alias for
1453 .Cm rebase .
1454 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc
1455 Edit commit history between the work tree's current base commit and
1456 the tip commit of the work tree's current branch.
1457 .Pp
1458 Before starting a
1459 .Cm histedit
1460 operation the work tree's current branch must be set with
1461 .Cm got update -b
1462 to the branch which should be edited, unless this branch is already the
1463 current branch of the work tree.
1464 The tip of this branch represents the upper bound (inclusive) of commits
1465 touched by the
1466 .Cm histedit
1467 operation.
1468 .Pp
1469 Furthermore, the work tree's base commit
1470 must be set with
1471 .Cm got update -c
1472 to a point in this branch's commit history where editing should begin.
1473 This commit represents the lower bound (non-inclusive) of commits touched
1474 by the
1475 .Cm histedit
1476 operation.
1477 .Pp
1478 Editing of commit history is controlled via a
1479 .Ar histedit script
1480 which can be written in an editor based on a template, passed on the
1481 command line, or generated with the
1482 .Fl m
1483 option if only log messages need to be edited.
1484 .Pp
1485 The format of the histedit script is line-based.
1486 Each line in the script begins with a command name, followed by
1487 whitespace and an argument.
1488 For most commands, the expected argument is a commit ID SHA1 hash.
1489 Any remaining text on the line is ignored.
1490 Lines which begin with the
1491 .Sq #
1492 character are ignored entirely.
1493 .Pp
1494 The available commands are as follows:
1495 .Bl -column YXZ pick-commit
1496 .It pick Ar commit Ta Use the specified commit as it is.
1497 .It edit Ar commit Ta Use the specified commit but once changes have been
1498 merged into the work tree interrupt the histedit operation for amending.
1499 .It fold Ar commit Ta Combine the specified commit with the next commit
1500 listed further below that will be used.
1501 .It drop Ar commit Ta Remove this commit from the edited history.
1502 .It mesg Ar log-message Ta Use the specified single-line log message for
1503 the commit on the previous line.
1504 If the log message argument is left empty, open an editor where a new
1505 log message can be written.
1506 .El
1507 .Pp
1508 Every commit in the history being edited must be mentioned in the script.
1509 Lines may be re-ordered to change the order of commits in the edited history.
1510 No commit may be listed more than once.
1511 .Pp
1512 Edited commits are accumulated on a temporary branch which the work tree
1513 will remain switched to throughout the entire histedit operation.
1514 Once history editing has completed successfully, the temporary branch becomes
1515 the new version of the work tree's branch and the work tree is automatically
1516 switched to it.
1517 .Pp
1518 While merging commits, show the status of each affected file,
1519 using the following status codes:
1520 .Bl -column YXZ description
1521 .It G Ta file was merged
1522 .It C Ta file was merged and conflicts occurred during merge
1523 .It ! Ta changes destined for a missing file were not merged
1524 .It D Ta file was deleted
1525 .It d Ta file's deletion was obstructed by local modifications
1526 .It A Ta new file was added
1527 .It \(a~ Ta changes destined for a non-regular file were not merged
1528 .It ? Ta changes destined for an unversioned file were not merged
1529 .El
1530 .Pp
1531 If merge conflicts occur the histedit operation is interrupted and may
1532 be continued once conflicts have been resolved.
1533 Alternatively, the histedit operation may be aborted which will leave
1534 the work tree switched back to its original branch.
1535 .Pp
1536 If a merge conflict is resolved in a way which renders the merged
1537 change into a no-op change, the corresponding commit will be elided
1538 when the histedit operation continues.
1539 .Pp
1540 .Cm got histedit
1541 will refuse to run if certain preconditions are not met.
1542 If the work tree's current branch is not in the
1543 .Dq refs/heads/
1544 reference namespace, the history of the branch may not be edited.
1545 If the work tree contains multiple base commits it must first be updated
1546 to a single base commit with
1547 .Cm got update .
1548 If changes have been staged with
1549 .Cm got stage ,
1550 these changes must first be committed with
1551 .Cm got commit
1552 or unstaged with
1553 .Cm got unstage .
1554 If the work tree contains local changes, these changes must first be
1555 committed with
1556 .Cm got commit
1557 or reverted with
1558 .Cm got revert .
1559 If the edited history contains changes to files outside of the work tree's
1560 path prefix, the work tree cannot be used to edit the history of this branch.
1561 .Pp
1562 The
1563 .Cm got update ,
1564 .Cm got rebase ,
1565 and
1566 .Cm got integrate
1567 commands will refuse to run while a histedit operation is in progress.
1568 Other commands which manipulate the work tree may be used, and the
1569 .Cm got commit
1570 command may be used to commit arbitrary changes to the temporary branch
1571 while the histedit operation is interrupted.
1572 .Pp
1573 The options for
1574 .Cm got histedit
1575 are as follows:
1576 .Bl -tag -width Ds
1577 .It Fl a
1578 Abort an interrupted histedit operation.
1579 If this option is used, no other command-line arguments are allowed.
1580 .It Fl c
1581 Continue an interrupted histedit operation.
1582 If this option is used, no other command-line arguments are allowed.
1583 .It Fl F Ar histedit-script
1584 Use the specified
1585 .Ar histedit-script
1586 instead of opening a temporary file in an editor where a histedit script
1587 can be written.
1588 .It Fl m
1589 Edit log messages only.
1590 This option is a quick equivalent to a histedit script which edits
1591 only log messages but otherwise leaves every picked commit as-is.
1592 The
1593 .Fl m
1594 option can only be used when starting a new histedit operation.
1595 If this option is used, no other command-line arguments are allowed.
1596 .El
1597 .It Cm he
1598 Short alias for
1599 .Cm histedit .
1600 .It Cm integrate Ar branch
1601 Integrate the specified
1602 .Ar branch
1603 into the work tree's current branch.
1604 Files in the work tree are updated to match the contents on the integrated
1605 .Ar branch ,
1606 and the reference of the work tree's branch is changed to point at the
1607 head commit of the integrated
1608 .Ar branch .
1609 .Pp
1610 Both branches can be considered equivalent after integration since they
1611 will be pointing at the same commit.
1612 Both branches remain available for future work, if desired.
1613 In case the integrated
1614 .Ar branch
1615 is no longer needed it may be deleted with
1616 .Cm got branch -d .
1617 .Pp
1618 Show the status of each affected file, using the following status codes:
1619 .Bl -column YXZ description
1620 .It U Ta file was updated
1621 .It D Ta file was deleted
1622 .It A Ta new file was added
1623 .It \(a~ Ta versioned file is obstructed by a non-regular file
1624 .It ! Ta a missing versioned file was restored
1625 .El
1626 .Pp
1627 .Cm got integrate
1628 will refuse to run if certain preconditions are not met.
1629 Most importantly, the
1630 .Ar branch
1631 must have been rebased onto the work tree's current branch with
1632 .Cm got rebase
1633 before it can be integrated, in order to linearize commit history and
1634 resolve merge conflicts.
1635 If the work tree contains multiple base commits it must first be updated
1636 to a single base commit with
1637 .Cm got update .
1638 If changes have been staged with
1639 .Cm got stage ,
1640 these changes must first be committed with
1641 .Cm got commit
1642 or unstaged with
1643 .Cm got unstage .
1644 If the work tree contains local changes, these changes must first be
1645 committed with
1646 .Cm got commit
1647 or reverted with
1648 .Cm got revert .
1649 .It Cm ig
1650 Short alias for
1651 .Cm integrate .
1652 .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 ...
1653 Stage local changes for inclusion in the next commit.
1654 If no
1655 .Ar path
1656 is specified, stage all changes in the work tree.
1657 Otherwise, stage changes at or within the specified paths.
1658 Paths may be staged if they are added, modified, or deleted according to
1659 .Cm got status .
1660 .Pp
1661 Show the status of each affected file, using the following status codes:
1662 .Bl -column YXZ description
1663 .It A Ta file addition has been staged
1664 .It M Ta file modification has been staged
1665 .It D Ta file deletion has been staged
1666 .El
1667 .Pp
1668 Staged file contents are saved in newly created blob objects in the repository.
1669 These blobs will be referred to by tree objects once staged changes have been
1670 committed.
1671 .Pp
1672 Staged changes affect the behaviour of
1673 .Cm got commit ,
1674 .Cm got status ,
1675 and
1676 .Cm got diff .
1677 While paths with staged changes exist, the
1678 .Cm got commit
1679 command will refuse to commit any paths which do not have staged changes.
1680 Local changes created on top of staged changes can only be committed if
1681 the path is staged again, or if the staged changes are committed first.
1682 The
1683 .Cm got status
1684 command will show both local changes and staged changes.
1685 The
1686 .Cm got diff
1687 command is able to display local changes relative to staged changes,
1688 and to display staged changes relative to the repository.
1689 The
1690 .Cm got revert
1691 command cannot revert staged changes but may be used to revert
1692 local changes created on top of staged changes.
1693 .Pp
1694 The options for
1695 .Cm got stage
1696 are as follows:
1697 .Bl -tag -width Ds
1698 .It Fl l
1699 Instead of staging new changes, list paths which are already staged,
1700 along with the IDs of staged blob objects and stage status codes.
1701 If paths were provided in the command line show the staged paths
1702 among the specified paths.
1703 Otherwise, show all staged paths.
1704 .It Fl p
1705 Instead of staging the entire content of a changed file, interactively
1706 select or reject changes for staging based on
1707 .Dq y
1708 (stage change),
1709 .Dq n
1710 (reject change), and
1711 .Dq q
1712 (quit staging this file) responses.
1713 If a file is in modified status, individual patches derived from the
1714 modified file content can be staged.
1715 Files in added or deleted status may only be staged or rejected in
1716 their entirety.
1717 .It Fl F Ar response-script
1718 With the
1719 .Fl p
1720 option, read
1721 .Dq y ,
1722 .Dq n ,
1723 and
1724 .Dq q
1725 responses line-by-line from the specified
1726 .Ar response-script
1727 file instead of prompting interactively.
1728 .It Fl S
1729 Allow staging of symbolic links which point outside of the path space
1730 that is under version control.
1731 By default,
1732 .Cm got stage
1733 will reject such symbolic links due to safety concerns.
1734 As a precaution,
1735 .Nm
1736 may decide to represent such a symbolic link as a regular file which contains
1737 the link's target path, rather than creating an actual symbolic link which
1738 points outside of the work tree.
1739 Use of this option is discouraged because external mechanisms such as
1740 .Dq make obj
1741 are better suited for managing symbolic links to paths not under
1742 version control.
1743 .El
1744 .Pp
1745 .Cm got stage
1746 will refuse to run if certain preconditions are not met.
1747 If a file contains merge conflicts, these conflicts must be resolved first.
1748 If a file is found to be out of date relative to the head commit on the
1749 work tree's current branch, the file must be updated with
1750 .Cm got update
1751 before it can be staged (however, this does not prevent the file from
1752 becoming out-of-date at some point after having been staged).
1753 .Pp
1754 The
1755 .Cm got update ,
1756 .Cm got rebase ,
1757 and
1758 .Cm got histedit
1759 commands will refuse to run while staged changes exist.
1760 If staged changes cannot be committed because a staged path
1761 is out of date, the path must be unstaged with
1762 .Cm got unstage
1763 before it can be updated with
1764 .Cm got update ,
1765 and may then be staged again if necessary.
1766 .It Cm sg
1767 Short alias for
1768 .Cm stage .
1769 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1770 Merge staged changes back into the work tree and put affected paths
1771 back into non-staged status.
1772 If no
1773 .Ar path
1774 is specified, unstage all staged changes across the entire work tree.
1775 Otherwise, unstage changes at or within the specified paths.
1776 .Pp
1777 Show the status of each affected file, using the following status codes:
1778 .Bl -column YXZ description
1779 .It G Ta file was unstaged
1780 .It C Ta file was unstaged and conflicts occurred during merge
1781 .It ! Ta changes destined for a missing file were not merged
1782 .It D Ta file was staged as deleted and still is deleted
1783 .It d Ta file's deletion was obstructed by local modifications
1784 .It \(a~ Ta changes destined for a non-regular file were not merged
1785 .El
1786 .Pp
1787 The options for
1788 .Cm got unstage
1789 are as follows:
1790 .Bl -tag -width Ds
1791 .It Fl p
1792 Instead of unstaging the entire content of a changed file, interactively
1793 select or reject changes for unstaging based on
1794 .Dq y
1795 (unstage change),
1796 .Dq n
1797 (keep change staged), and
1798 .Dq q
1799 (quit unstaging this file) responses.
1800 If a file is staged in modified status, individual patches derived from the
1801 staged file content can be unstaged.
1802 Files staged in added or deleted status may only be unstaged in their entirety.
1803 .It Fl F Ar response-script
1804 With the
1805 .Fl p
1806 option, read
1807 .Dq y ,
1808 .Dq n ,
1809 and
1810 .Dq q
1811 responses line-by-line from the specified
1812 .Ar response-script
1813 file instead of prompting interactively.
1814 .El
1815 .It Cm ug
1816 Short alias for
1817 .Cm unstage .
1818 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1819 Parse and print contents of objects to standard output in a line-based
1820 text format.
1821 Content of commit, tree, and tag objects is printed in a way similar
1822 to the actual content stored in such objects.
1823 Blob object contents are printed as they would appear in files on disk.
1824 .Pp
1825 Attempt to interpret each argument as a reference, a tag name, or
1826 an object ID SHA1 hash.
1827 References will be resolved to an object ID.
1828 Tag names will resolved to a tag object.
1829 An abbreviated hash argument will be expanded to a full SHA1 hash
1830 automatically, provided the abbreviation is unique.
1831 .Pp
1832 If none of the above interpretations produce a valid result, or if the
1833 .Fl P
1834 option is used, attempt to interpret the argument as a path which will
1835 be resolved to the ID of an object found at this path in the repository.
1836 .Pp
1837 The options for
1838 .Cm got cat
1839 are as follows:
1840 .Bl -tag -width Ds
1841 .It Fl c Ar commit
1842 Look up paths in the specified
1843 .Ar commit .
1844 If this option is not used, paths are looked up in the commit resolved
1845 via the repository's HEAD reference.
1846 The expected argument is a commit ID SHA1 hash or an existing reference
1847 or tag name which will be resolved to a commit ID.
1848 An abbreviated hash argument will be expanded to a full SHA1 hash
1849 automatically, provided the abbreviation is unique.
1850 .It Fl r Ar repository-path
1851 Use the repository at the specified path.
1852 If not specified, assume the repository is located at or above the current
1853 working directory.
1854 If this directory is a
1855 .Nm
1856 work tree, use the repository path associated with this work tree.
1857 .It Fl P
1858 Interpret all arguments as paths only.
1859 This option can be used to resolve ambiguity in cases where paths
1860 look like tag names, reference names, or object IDs.
1861 .El
1862 .It Cm info Op Ar path ...
1863 Display meta-data stored in a work tree.
1864 See
1865 .Xr got-worktree 5
1866 for details.
1867 .Pp
1868 The work tree to use is resolved implicitly by walking upwards from the
1869 current working directory.
1870 .Pp
1871 If one or more
1872 .Ar path
1873 arguments are specified, show additional per-file information for tracked
1874 files located at or within these paths.
1875 If a
1876 .Ar path
1877 argument corresponds to the work tree's root directory, display information
1878 for all tracked files.
1879 .El
1880 .Sh ENVIRONMENT
1881 .Bl -tag -width GOT_AUTHOR
1882 .It Ev GOT_AUTHOR
1883 The author's name and email address for
1884 .Cm got commit
1885 and
1886 .Cm got import ,
1887 for example:
1888 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1889 Because
1890 .Xr git 1
1891 may fail to parse commits without an email address in author data,
1892 .Nm
1893 attempts to reject
1894 .Ev GOT_AUTHOR
1895 environment variables with a missing email address.
1896 .Pp
1897 If present, Git's
1898 .Dv user.name
1899 and
1900 .Dv user.email
1901 configuration settings in the repository's
1902 .Pa .git/config
1903 file will override the value of
1904 .Ev GOT_AUTHOR .
1905 However, the
1906 .Dv user.name
1907 and
1908 .Dv user.email
1909 configuration settings contained in Git's global
1910 .Pa ~/.gitconfig
1911 configuration file will be used only if the
1912 .Ev GOT_AUTHOR
1913 environment variable is
1914 .Em not
1915 set.
1916 .It Ev VISUAL , EDITOR
1917 The editor spawned by
1918 .Cm got commit ,
1919 .Cm got import ,
1921 .Cm got tag .
1922 .It Ev GOT_LOG_DEFAULT_LIMIT
1923 The default limit on the number of commits traversed by
1924 .Cm got log .
1925 If set to zero, the limit is unbounded.
1926 This variable will be silently ignored if it is set to a non-numeric value.
1927 .El
1928 .Sh EXIT STATUS
1929 .Ex -std got
1930 .Sh EXAMPLES
1931 Clone an existing Git repository for use with
1932 .Nm .
1933 .Pp
1934 .Dl $ cd /var/git/
1935 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1936 .Pp
1937 Use of HTTP URLs currently requires
1938 .Xr git 1 :
1939 .Pp
1940 .Dl $ cd /var/git/
1941 .Dl $ git clone --bare https://github.com/openbsd/src.git
1942 .Pp
1943 Alternatively, for quick and dirty local testing of
1944 .Nm
1945 a new Git repository could be created and populated with files,
1946 e.g. from a temporary CVS checkout located at
1947 .Pa /tmp/src :
1948 .Pp
1949 .Dl $ got init /var/git/src.git
1950 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1951 .Pp
1952 Check out a work tree from the Git repository to /usr/src:
1953 .Pp
1954 .Dl $ got checkout /var/git/src.git /usr/src
1955 .Pp
1956 View local changes in a work tree directory:
1957 .Pp
1958 .Dl $ got status
1959 .Dl $ got diff | less
1960 .Pp
1961 Interactively revert selected local changes in a work tree directory:
1962 .Pp
1963 .Dl $ got revert -p -R\ .
1964 .Pp
1965 In a work tree or a git repository directory, list all branch references:
1966 .Pp
1967 .Dl $ got branch -l
1968 .Pp
1969 In a work tree or a git repository directory, create a new branch called
1970 .Dq unified-buffer-cache
1971 which is forked off the
1972 .Dq master
1973 branch:
1974 .Pp
1975 .Dl $ got branch unified-buffer-cache master
1976 .Pp
1977 Switch an existing work tree to the branch
1978 .Dq unified-buffer-cache .
1979 Local changes in the work tree will be preserved and merged if necessary:
1980 .Pp
1981 .Dl $ got update -b unified-buffer-cache
1982 .Pp
1983 Create a new commit from local changes in a work tree directory.
1984 This new commit will become the head commit of the work tree's current branch:
1985 .Pp
1986 .Dl $ got commit
1987 .Pp
1988 In a work tree or a git repository directory, view changes committed in
1989 the 3 most recent commits to the work tree's branch, or the branch resolved
1990 via the repository's HEAD reference, respectively:
1991 .Pp
1992 .Dl $ got log -p -l 3
1993 .Pp
1994 As above, but display changes in the order in which
1995 .Xr patch 1
1996 could apply them in sequence:
1997 .Pp
1998 .Dl $ got log -p -l 3 -R
1999 .Pp
2000 In a work tree or a git repository directory, log the history of a subdirectory:
2001 .Pp
2002 .Dl $ got log sys/uvm
2003 .Pp
2004 While operating inside a work tree, paths are specified relative to the current
2005 working directory, so this command will log the subdirectory
2006 .Pa sys/uvm :
2007 .Pp
2008 .Dl $ cd sys/uvm && got log\ .
2009 .Pp
2010 And this command has the same effect:
2011 .Pp
2012 .Dl $ cd sys/dev/usb && got log ../../uvm
2013 .Pp
2014 And this command displays work tree meta-data about all tracked files:
2015 .Pp
2016 .Dl $ cd /usr/src
2017 .Dl $ got info\ . | less
2018 .Pp
2019 Add new files and remove obsolete files in a work tree directory:
2020 .Pp
2021 .Dl $ got add sys/uvm/uvm_ubc.c
2022 .Dl $ got remove sys/uvm/uvm_vnode.c
2023 .Pp
2024 Create a new commit from local changes in a work tree directory
2025 with a pre-defined log message.
2026 .Pp
2027 .Dl $ got commit -m 'unify the buffer cache'
2028 .Pp
2029 Alternatively, create a new commit from local changes in a work tree
2030 directory with a log message that has been prepared in the file
2031 .Pa /tmp/msg .
2033 .Xr vi 1
2034 is set as the
2035 .Ev EDITOR ,
2036 .Pa /tmp/msg
2037 can be read into the buffer for review:
2038 .Pp
2039 .Dl $ got commit
2040 .Dl :r /tmp/msg
2041 .Pp
2042 Update any work tree checked out from the
2043 .Dq unified-buffer-cache
2044 branch to the latest commit on this branch:
2045 .Pp
2046 .Dl $ got update
2047 .Pp
2048 Roll file content on the unified-buffer-cache branch back by one commit,
2049 and then fetch the rolled-back change into the work tree as a local change
2050 to be amended and perhaps committed again:
2051 .Pp
2052 .Dl $ got backout unified-buffer-cache
2053 .Dl $ got commit -m 'roll back previous'
2054 .Dl $ # now back out the previous backout :-)
2055 .Dl $ got backout unified-buffer-cache
2056 .Pp
2057 Fetch new upstream commits into the local repository's
2058 .Dq origin/master
2059 branch:
2060 .Pp
2061 .Dl $ cd /usr/src
2062 .Dl $ got fetch
2063 .Pp
2064 In a repository created with a HTTP URL and
2065 .Cm git clone --bare
2066 the
2067 .Xr git-fetch 1
2068 command must be used instead:
2069 .Pp
2070 .Dl $ cd /var/git/src.git
2071 .Dl $ git fetch origin master:refs/remotes/origin/master
2072 .Pp
2073 Rebase the local
2074 .Dq master
2075 branch to merge the new changes that are now visible on the
2076 .Dq origin/master
2077 branch:
2078 .Pp
2079 .Dl $ cd /usr/src
2080 .Dl $ got update -b origin/master
2081 .Dl $ got rebase master
2082 .Pp
2083 Rebase the
2084 .Dq unified-buffer-cache
2085 branch on top of the new head commit of the
2086 .Dq master
2087 branch.
2088 .Pp
2089 .Dl $ got update -b master
2090 .Dl $ got rebase unified-buffer-cache
2091 .Pp
2092 Create a patch from all changes on the unified-buffer-cache branch.
2093 The patch can be mailed out for review and applied to
2094 .Ox Ns 's
2095 CVS tree:
2096 .Pp
2097 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
2098 .Pp
2099 Edit the entire commit history of the
2100 .Dq unified-buffer-cache
2101 branch:
2102 .Pp
2103 .Dl $ got update -b unified-buffer-cache
2104 .Dl $ got update -c master
2105 .Dl $ got histedit
2106 .Pp
2107 In order to merge changes committed to the
2108 .Dq unified-buffer-cache
2109 branch back into the
2110 .Dq master
2111 branch, the
2112 .Dq unified-buffer-cache
2113 branch must first be rebased onto the
2114 .Dq master
2115 branch:
2116 .Pp
2117 .Dl $ got update -b master
2118 .Dl $ got rebase unified-buffer-cache
2119 .Pp
2120 Changes on the
2121 .Dq unified-buffer-cache
2122 branch can now be made visible on the
2123 .Dq master
2124 branch with
2125 .Cm got integrate .
2126 Because the rebase operation switched the work tree to the
2127 .Dq unified-buffer-cache
2128 branch, the work tree must be switched back to the
2129 .Dq master
2130 branch before the
2131 .Dq unified-buffer-cache
2132 branch can be integrated into
2133 .Dq master :
2134 .Pp
2135 .Dl $ got update -b master
2136 .Dl $ got integrate unified-buffer-cache
2137 .Pp
2138 Additional steps may be necessary if local changes need to be pushed back
2139 to the remote repository, which currently requires
2140 .Cm git push .
2141 Before working against existing branches in a repository cloned with
2142 .Cm git clone --bare
2143 instead of
2144 .Cm got clone ,
2145 a Git
2146 .Dq refspec
2147 must be configured to map all references in the remote repository
2148 into the
2149 .Dq refs/remotes
2150 namespace of the local repository.
2151 This can achieved by setting Git's
2152 .Pa remote.origin.fetch
2153 configuration variable to the value
2154 .Dq +refs/heads/*:refs/remotes/origin/*
2155 with the
2156 .Cm git config
2157 command:
2158 .Pp
2159 .Dl $ cd /var/git/repo
2160 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
2161 .Pp
2162 Additionally, the
2163 .Dq mirror
2164 option must be disabled:
2165 .Pp
2166 .Dl $ cd /var/git/repo
2167 .Dl $ git config remote.origin.mirror false
2168 .Pp
2169 Alternatively, the following
2170 .Xr git-fetch 1
2171 configuration item can be added manually to the Git repository's
2172 .Pa config
2173 file:
2174 .Pp
2175 .Dl [remote "origin"]
2176 .Dl url = ...
2177 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
2178 .Dl mirror = false
2179 .Pp
2180 This configuration leaves the local repository's
2181 .Dq refs/heads
2182 namespace free for use by local branches checked out with
2183 .Cm got checkout
2184 and, if needed, created with
2185 .Cm got branch .
2186 .Pp
2187 Branches in the
2188 .Dq remotes/origin
2189 namespace can now be updated with incoming changes from the remote
2190 repository with
2191 .Cm got fetch
2193 .Xr git-fetch 1
2194 without extra command line arguments:
2195 .Pp
2196 .Dl $ cd /var/git/repo
2197 .Dl $ git fetch
2198 .Pp
2199 To make changes fetched from the remote repository appear on the
2200 .Dq master
2201 branch, the
2202 .Dq master
2203 branch must be rebased onto the
2204 .Dq origin/master
2205 branch.
2206 This will also merge local changes, if any, with the incoming changes:
2207 .Pp
2208 .Dl $ got update -b origin/master
2209 .Dl $ got rebase master
2210 .Pp
2211 On the
2212 .Dq master
2213 branch, log messages for local changes can now be amended with
2214 .Dq OK
2215 by other developers and any other important new information:
2216 .Pp
2217 .Dl $ got update -c origin/master
2218 .Dl $ got histedit -m
2219 .Pp
2220 Local changes on the
2221 .Dq master
2222 branch can then be pushed to the remote
2223 repository with
2224 .Cm git push :
2225 .Pp
2226 .Dl $ cd /var/git/repo
2227 .Dl $ git push origin master
2228 .Sh SEE ALSO
2229 .Xr tog 1 ,
2230 .Xr git-repository 5 ,
2231 .Xr got-worktree 5
2232 .Sh AUTHORS
2233 .An Stefan Sperling Aq Mt stsp@openbsd.org
2234 .An Martin Pieuchot Aq Mt mpi@openbsd.org
2235 .An Joshua Stein Aq Mt jcs@openbsd.org
2236 .An Ori Bernstein Aq Mt ori@openbsd.org
2237 .Sh CAVEATS
2238 .Nm
2239 is a work-in-progress and many commands remain to be implemented.
2240 At present, the user has to fall back on
2241 .Xr git 1
2242 to perform many tasks, in particular tasks related to repository
2243 administration and tasks which require a network connection.