Blob


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