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