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 .Tg im
66 .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
67 .Dl Pq alias: Cm im
68 Create an initial commit in a repository from the file hierarchy
69 within the specified
70 .Ar directory .
71 The created commit will not have any parent commits, i.e. it will be a
72 root commit.
73 Also create a new reference which provides a branch name for the newly
74 created commit.
75 Show the path of each imported file to indicate progress.
76 .Pp
77 The
78 .Cm got import
79 command requires the
80 .Ev GOT_AUTHOR
81 environment variable to be set,
82 unless an author has been configured in
83 .Xr got.conf 5
84 or Git's
85 .Dv user.name
86 and
87 .Dv user.email
88 configuration settings can be obtained from the repository's
89 .Pa .git/config
90 file or from Git's global
91 .Pa ~/.gitconfig
92 configuration file.
93 .Pp
94 The options for
95 .Cm got import
96 are as follows:
97 .Bl -tag -width Ds
98 .It Fl b Ar branch
99 Create the specified
100 .Ar branch
101 instead of creating the default branch
102 .Dq main .
103 Use of this option is required if the
104 .Dq main
105 branch already exists.
106 .It Fl m Ar message
107 Use the specified log message when creating the new commit.
108 Without the
109 .Fl m
110 option,
111 .Cm got import
112 opens a temporary file in an editor where a log message can be written.
113 .It Fl r Ar repository-path
114 Use the repository at the specified path.
115 If not specified, assume the repository is located at or above the current
116 working directory.
117 .It Fl I Ar pattern
118 Ignore files or directories with a name which matches the specified
119 .Ar pattern .
120 This option may be specified multiple times to build a list of ignore patterns.
121 The
122 .Ar pattern
123 follows the globbing rules documented in
124 .Xr glob 7 .
125 .El
126 .Tg cl
127 .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
128 .Dl Pq alias: Cm cl
129 Clone a Git repository at the specified
130 .Ar repository-URL
131 into the specified
132 .Ar directory .
133 If no
134 .Ar directory
135 is specified, the directory name will be derived from the name of the
136 cloned repository.
137 .Cm got clone
138 will refuse to run if the
139 .Ar directory
140 already exists.
141 .Pp
142 The
143 .Ar repository-URL
144 specifies a protocol scheme, a server hostname, an optional port number
145 separated from the hostname by a colon, and a path to the repository on
146 the server:
147 .Lk scheme://hostname:port/path/to/repository
148 .Pp
149 The following protocol schemes are supported:
150 .Bl -tag -width git+ssh
151 .It git
152 The Git protocol as implemented by the
153 .Xr git-daemon 1
154 server.
155 Use of this protocol is discouraged since it supports neither authentication
156 nor encryption.
157 .It git+ssh
158 The Git protocol wrapped in an authenticated and encrypted
159 .Xr ssh 1
160 tunnel.
161 With this protocol the hostname may contain an embedded username for
162 .Xr ssh 1
163 to use:
164 .Mt user@hostname
165 .It ssh
166 Short alias for git+ssh.
167 .El
168 .Pp
169 Objects in the cloned repository are stored in a pack file which is downloaded
170 from the server.
171 This pack file will then be indexed to facilitate access to the objects stored
172 within.
173 If any objects in the pack file are stored in deltified form, all deltas will
174 be fully resolved in order to compute the ID of such objects.
175 This can take some time.
176 More details about the pack file format are documented in
177 .Xr git-repository 5 .
178 .Pp
179 .Cm got clone
180 creates a remote repository entry in the
181 .Xr got.conf 5
182 and
183 .Pa config
184 files of the cloned repository to store the
185 .Ar repository-url
186 and any
187 .Ar branch
188 or
189 .Ar reference
190 arguments for future use by
191 .Cm got fetch
192 or
193 .Xr git-fetch 1 .
194 .Pp
195 The options for
196 .Cm got clone
197 are as follows:
198 .Bl -tag -width Ds
199 .It Fl a
200 Fetch all branches from the remote repository's
201 .Dq refs/heads/
202 reference namespace and set
203 .Cm fetch_all_branches
204 in the cloned repository's
205 .Xr got.conf 5
206 file for future use by
207 .Cm got fetch .
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 q
234 and
235 .Fl v .
236 .It Fl m
237 Create the cloned repository as a mirror of the original repository.
238 This is useful if the cloned repository will not be used to store
239 locally created commits.
240 .Pp
241 The repository's
242 .Xr got.conf 5
243 and
244 .Pa config
245 files will be set up with the
246 .Dq mirror
247 option enabled, such that
248 .Cm got fetch
249 or
250 .Xr git-fetch 1
251 will write incoming changes directly to branches in the
252 .Dq refs/heads/
253 reference namespace, rather than to branches in the
254 .Dq refs/remotes/
255 namespace.
256 This avoids the usual requirement of having to run
257 .Cm got rebase
258 after
259 .Cm got fetch
260 in order to make incoming changes appear on branches in the
261 .Dq refs/heads/
262 namespace.
263 But maintaining custom changes in the cloned repository becomes difficult
264 since such changes will be at risk of being discarded whenever incoming
265 changes are fetched.
266 .It Fl q
267 Suppress progress reporting output.
268 The same option will be passed to
269 .Xr ssh 1
270 if applicable.
271 .It Fl v
272 Verbose mode.
273 Causes
274 .Cm got clone
275 to print debugging messages to standard error output.
276 This option will be passed to
277 .Xr ssh 1
278 if applicable.
279 Multiple -v options increase the verbosity.
280 The maximum is 3.
281 .It Fl R Ar reference
282 In addition to the branches and tags that will be fetched, fetch an arbitrary
283 .Ar reference
284 from the remote repository's
285 .Dq refs/
286 namespace.
287 This option may be specified multiple times to build a list of additional
288 references to fetch.
289 The specified
290 .Ar reference
291 may either be a path to a specific reference, or a reference namespace
292 which will cause all references in this namespace to be fetched.
293 .Pp
294 Each reference will be mapped into the cloned repository's
295 .Dq refs/remotes/
296 namespace, unless the
297 .Fl m
298 option is used to mirror references directly into the cloned repository's
299 .Dq refs/
300 namespace.
301 .Pp
302 .Cm got clone
303 will refuse to fetch references from the remote repository's
304 .Dq refs/remotes/
305 or
306 .Dq refs/got/
307 namespace.
308 .El
309 .Tg fe
310 .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 Oo Fl X Oc Op Ar remote-repository
311 .Dl Pq alias: Cm fe
312 Fetch new changes from a remote repository.
313 If no
314 .Ar remote-repository
315 is specified,
316 .Dq origin
317 will be used.
318 The remote repository's URL is obtained from the corresponding entry in
319 .Xr got.conf 5
320 or Git's
321 .Pa config
322 file of the local repository, as created by
323 .Cm got clone .
324 .Pp
325 New changes will be stored in a separate pack file downloaded from the server.
326 Optionally, separate pack files stored in the repository can be combined with
327 .Xr git-repack 1 .
328 .Pp
329 By default, branch references in the
330 .Dq refs/remotes/
331 reference namespace will be updated to point at the newly fetched commits.
332 The
333 .Cm got rebase
334 command can then be used to make new changes visible on branches in the
335 .Dq refs/heads/
336 namespace, merging incoming changes with the changes on those branches
337 as necessary.
338 .Pp
339 If the repository was created as a mirror with
340 .Cm got clone -m ,
341 then all branches in the
342 .Dq refs/heads/
343 namespace will be updated directly to match the corresponding branches in
344 the remote repository.
345 If those branches contained local commits, these commits will no longer be
346 reachable via a reference and will therefore be at risk of being discarded
347 by Git's garbage collector or
348 .Cm gotadmin cleanup .
349 Maintaining custom changes in a mirror repository is therefore discouraged.
350 .Pp
351 In any case, references in the
352 .Dq refs/tags/
353 namespace will always be fetched and mapped directly to local references
354 in the same namespace.
355 .Pp
356 The options for
357 .Cm got fetch
358 are as follows:
359 .Bl -tag -width Ds
360 .It Fl a
361 Fetch all branches from the remote repository's
362 .Dq refs/heads/
363 reference namespace.
364 This option can be enabled by default for specific repositories in
365 .Xr got.conf 5 .
366 If this option is not specified, a branch resolved via the remote
367 repository's HEAD reference will be fetched.
368 Cannot be used together with the
369 .Fl b
370 option.
371 .It Fl b Ar branch
372 Fetch the specified
373 .Ar branch
374 from the remote repository's
375 .Dq refs/heads/
376 reference namespace.
377 This option may be specified multiple times to build a list of branches
378 to fetch.
379 If this option is not specified, a branch resolved via the remote
380 repository's HEAD reference will be fetched.
381 Cannot be used together with the
382 .Fl a
383 option.
384 .It Fl d
385 Delete branches and tags from the local repository which are no longer
386 present in the remote repository.
387 Only references are deleted.
388 Any commit, tree, tag, and blob objects belonging to deleted branches or
389 tags remain in the repository and may be removed separately with
390 Git's garbage collector or
391 .Cm gotadmin cleanup .
392 .It Fl l
393 List branches and tags available for fetching from the remote repository
394 and exit immediately.
395 Cannot be used together with any of the other options except
396 .Fl v ,
397 .Fl q ,
398 and
399 .Fl r .
400 .It Fl t
401 Allow existing references in the
402 .Dq refs/tags
403 namespace to be updated if they have changed on the server.
404 If not specified, only new tag references will be created.
405 .It Fl r Ar repository-path
406 Use the repository at the specified path.
407 If not specified, assume the repository is located at or above the current
408 working directory.
409 If this directory is a
410 .Nm
411 work tree, use the repository path associated with this work tree.
412 .It Fl q
413 Suppress progress reporting output.
414 The same option will be passed to
415 .Xr ssh 1
416 if applicable.
417 .It Fl v
418 Verbose mode.
419 Causes
420 .Cm got fetch
421 to print debugging messages to standard error output.
422 The same option will be passed to
423 .Xr ssh 1
424 if applicable.
425 Multiple -v options increase the verbosity.
426 The maximum is 3.
427 .It Fl R Ar reference
428 In addition to the branches and tags that will be fetched, fetch an arbitrary
429 .Ar reference
430 from the remote repository's
431 .Dq refs/
432 namespace.
433 This option may be specified multiple times to build a list of additional
434 references to fetch.
435 The specified
436 .Ar reference
437 may either be a path to a specific reference, or a reference namespace
438 which will cause all references in this namespace to be fetched.
439 .Pp
440 Each reference will be mapped into the local repository's
441 .Dq refs/remotes/
442 namespace, unless the local repository was created as a mirror with
443 .Cm got clone -m
444 in which case references will be mapped directly into the local repository's
445 .Dq refs/
446 namespace.
447 .Pp
448 Once a reference has been fetched, a branch based on it can be created with
449 .Cm got branch
450 if needed.
451 .Pp
452 .Cm got fetch
453 will refuse to fetch references from the remote repository's
454 .Dq refs/remotes/
455 or
456 .Dq refs/got/
457 namespace.
458 .It Fl X
459 Delete all references which correspond to a particular
460 .Ar remote-repository
461 instead of fetching new changes.
462 This can be useful when a remote repository is being removed from
463 .Xr got.conf 5 .
464 .Pp
465 With
466 .Fl X ,
467 the
468 .Ar remote-repository
469 argument is mandatory and no other options except
470 .Fl r ,
471 .Fl v ,
472 and
473 .Fl q
474 are allowed.
475 .Pp
476 Only references are deleted.
477 Any commit, tree, tag, and blob objects fetched from a remote repository
478 will generally be stored in pack files and may be removed separately with
479 .Xr git-repack 1
480 and Git's garbage collector.
481 .El
482 .Tg co
483 .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 Oo Fl q Oc Ar repository-path Op Ar work-tree-path
484 .Dl Pq alias: Cm co
485 Copy files from a repository into a new work tree.
486 Show the status of each affected file, using the following status codes:
487 .Bl -column YXZ description
488 .It A Ta new file was added
489 .It E Ta file already exists in work tree's meta-data
490 .El
491 .Pp
492 If the
493 .Ar work tree path
494 is not specified, either use the last component of
495 .Ar repository path ,
496 or if a
497 .Ar path prefix
498 was specified use the last component of
499 .Ar path prefix .
500 .Pp
501 The options for
502 .Cm got checkout
503 are as follows:
504 .Bl -tag -width Ds
505 .It Fl E
506 Proceed with the checkout operation even if the directory at
507 .Ar work-tree-path
508 is not empty.
509 Existing files will be left intact.
510 .It Fl b Ar branch
511 Check out files from a commit on the specified
512 .Ar branch .
513 If this option is not specified, a branch resolved via the repository's HEAD
514 reference will be used.
515 .It Fl c Ar commit
516 Check out files from the specified
517 .Ar commit
518 on the selected branch.
519 The expected argument is a commit ID SHA1 hash or an existing reference
520 or tag name which will be resolved to a commit ID.
521 An abbreviated hash argument will be expanded to a full SHA1 hash
522 automatically, provided the abbreviation is unique.
523 If this option is not specified, the most recent commit on the selected
524 branch will be used.
525 .Pp
526 If the specified
527 .Ar commit
528 is not contained in the selected branch, a different branch which contains
529 this commit must be specified with the
530 .Fl b
531 option.
532 If no such branch is known, a new branch must be created for this
533 commit with
534 .Cm got branch
535 before
536 .Cm got checkout
537 can be used.
538 Checking out work trees with an unknown branch is intentionally not supported.
539 .It Fl p Ar path-prefix
540 Restrict the work tree to a subset of the repository's tree hierarchy.
541 Only files beneath the specified
542 .Ar path-prefix
543 will be checked out.
544 .It Fl q
545 Silence progress output.
546 .El
547 .Tg up
548 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Oo Fl q Oc Op Ar path ...
549 .Dl Pq alias: Cm up
550 Update an existing work tree to a different
551 .Ar commit .
552 Change existing files in the work tree as necessary to match file contents
553 of this commit.
554 Preserve any local changes in the work tree and merge them with the
555 incoming changes.
556 .Pp
557 Files which already contain merge conflicts will not be updated to avoid
558 further complications.
559 Such files will be updated when
560 .Cm got update
561 is run again after merge conflicts have been resolved.
562 If the conflicting changes are no longer needed, affected files can be
563 reverted with
564 .Cm got revert
565 before running
566 .Cm got update
567 again.
568 .Pp
569 Show the status of each affected file, using the following status codes:
570 .Bl -column YXZ description
571 .It U Ta file was updated and contained no local changes
572 .It G Ta file was updated and local changes were merged cleanly
573 .It C Ta file was updated and conflicts occurred during merge
574 .It D Ta file was deleted
575 .It A Ta new file was added
576 .It \(a~ Ta versioned file is obstructed by a non-regular file
577 .It ! Ta a missing versioned file was restored
578 .It # Ta file was not updated because it contains merge conflicts
579 .It ? Ta changes destined for an unversioned file were not merged
580 .El
581 .Pp
582 If no
583 .Ar path
584 is specified, update the entire work tree.
585 Otherwise, restrict the update operation to files at or within the
586 specified paths.
587 Each path is required to exist in the update operation's target commit.
588 Files in the work tree outside specified paths will remain unchanged and
589 will retain their previously recorded base commit.
590 Some
591 .Nm
592 commands may refuse to run while the work tree contains files from
593 multiple base commits.
594 The base commit of such a work tree can be made consistent by running
595 .Cm got update
596 across the entire work tree.
597 Specifying a
598 .Ar path
599 is incompatible with the
600 .Fl b
601 option.
602 .Pp
603 .Cm got update
604 cannot update paths with staged changes.
605 If changes have been staged with
606 .Cm got stage ,
607 these changes must first be committed with
608 .Cm got commit
609 or unstaged with
610 .Cm got unstage .
611 .Pp
612 The options for
613 .Cm got update
614 are as follows:
615 .Bl -tag -width Ds
616 .It Fl b Ar branch
617 Switch the work tree's branch reference to the specified
618 .Ar branch
619 before updating the work tree.
620 This option requires that all paths in the work tree are updated.
621 .Pp
622 As usual, any local changes in the work tree will be preserved.
623 This can be useful when switching to a newly created branch in order
624 to commit existing local changes to this branch.
625 .Pp
626 Any local changes must be dealt with separately in order to obtain a
627 work tree with pristine file contents corresponding exactly to the specified
628 .Ar branch .
629 Such changes could first be committed to a different branch with
630 .Cm got commit ,
631 or could be discarded with
632 .Cm got revert .
633 .It Fl c Ar commit
634 Update the work tree to the specified
635 .Ar commit .
636 The expected argument is a commit ID SHA1 hash or an existing reference
637 or tag name which will be resolved to a commit ID.
638 An abbreviated hash argument will be expanded to a full SHA1 hash
639 automatically, provided the abbreviation is unique.
640 If this option is not specified, the most recent commit on the work tree's
641 branch will be used.
642 .It Fl q
643 Silence progress output.
644 .El
645 .Tg st
646 .It Cm status Oo Fl I Oc Oo Fl s Ar status-codes Oc Oo Fl S Ar status-codes Oc Op Ar path ...
647 .Dl Pq alias: Cm st
648 Show the current modification status of files in a work tree,
649 using the following status codes:
650 .Bl -column YXZ description
651 .It M Ta modified file
652 .It A Ta file scheduled for addition in next commit
653 .It D Ta file scheduled for deletion in next commit
654 .It C Ta modified or added file which contains merge conflicts
655 .It ! Ta versioned file was expected on disk but is missing
656 .It \(a~ Ta versioned file is obstructed by a non-regular file
657 .It ? Ta unversioned item not tracked by
658 .Nm
659 .It m Ta modified file modes (executable bit only)
660 .It N Ta non-existent
661 .Ar path
662 specified on the command line
663 .El
664 .Pp
665 If no
666 .Ar path
667 is specified, show modifications in the entire work tree.
668 Otherwise, show modifications at or within the specified paths.
669 .Pp
670 If changes have been staged with
671 .Cm got stage ,
672 staged changes are shown in the second output column, using the following
673 status codes:
674 .Bl -column YXZ description
675 .It M Ta file modification is staged
676 .It A Ta file addition is staged
677 .It D Ta file deletion is staged
678 .El
679 .Pp
680 Changes created on top of staged changes are indicated in the first column:
681 .Bl -column YXZ description
682 .It MM Ta file was modified after earlier changes have been staged
683 .It MA Ta file was modified after having been staged for addition
684 .El
685 .Pp
686 The options for
687 .Cm got status
688 are as follows:
689 .Bl -tag -width Ds
690 .It Fl I
691 Show unversioned files even if they match an ignore pattern.
692 .It Fl s Ar status-codes
693 Only show files with a modification status matching any of the
694 single-character status codes contained in the
695 .Ar status-codes
696 argument.
697 Any combination of codes from the above list of possible status codes
698 may be specified.
699 For staged files, status codes displayed in either column will be matched.
700 Cannot be used together with the
701 .Fl S
702 option.
703 .It Fl S Ar status-codes
704 Suppress the output of files with a modification status matching any of the
705 single-character status codes contained in the
706 .Ar status-codes
707 argument.
708 Any combination of codes from the above list of possible status codes
709 may be specified.
710 For staged files, status codes displayed in either column will be matched.
711 Cannot be used together with the
712 .Fl s
713 option.
714 .El
715 .Pp
716 For compatibility with
717 .Xr cvs 1
718 and
719 .Xr git 1 ,
720 .Cm got status
721 reads
722 .Xr glob 7
723 patterns from
724 .Pa .cvsignore
725 and
726 .Pa .gitignore
727 files in each traversed directory and will not display unversioned files
728 which match these patterns.
729 As an extension to
730 .Xr glob 7
731 matching rules,
732 .Cm got status
733 supports consecutive asterisks,
734 .Dq ** ,
735 which will match an arbitrary amount of directories.
736 Unlike
737 .Xr cvs 1 ,
738 .Cm got status
739 only supports a single ignore pattern per line.
740 Unlike
741 .Xr git 1 ,
742 .Cm got status
743 does not support negated ignore patterns prefixed with
744 .Dq \&! ,
745 and gives no special significance to the location of path component separators,
746 .Dq / ,
747 in a pattern.
748 .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 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
749 Display history of a repository.
750 If a
751 .Ar path
752 is specified, show only commits which modified this path.
753 If invoked in a work tree, the
754 .Ar path
755 is interpreted relative to the current working directory,
756 and the work tree's path prefix is implicitly prepended.
757 Otherwise, the path is interpreted relative to the repository root.
758 .Pp
759 The options for
760 .Cm got log
761 are as follows:
762 .Bl -tag -width Ds
763 .It Fl b
764 Display individual commits which were merged into the current branch
765 from other branches.
766 By default,
767 .Cm got log
768 shows the linear history of the current branch only.
769 .It Fl c Ar commit
770 Start traversing history at the specified
771 .Ar commit .
772 The expected argument is a commit ID SHA1 hash or an existing reference
773 or tag name which will be resolved to a commit ID.
774 An abbreviated hash argument will be expanded to a full SHA1 hash
775 automatically, provided the abbreviation is unique.
776 If this option is not specified, default to the work tree's current branch
777 if invoked in a work tree, or to the repository's HEAD reference.
778 .It Fl C Ar number
779 Set the number of context lines shown in diffs with
780 .Fl p .
781 By default, 3 lines of context are shown.
782 .It Fl l Ar N
783 Limit history traversal to a given number of commits.
784 If this option is not specified, a default limit value of zero is used,
785 which is treated as an unbounded limit.
786 The
787 .Ev GOT_LOG_DEFAULT_LIMIT
788 environment variable may be set to change this default value.
789 .It Fl p
790 Display the patch of modifications made in each commit.
791 If a
792 .Ar path
793 is specified, only show the patch of modifications at or within this path.
794 Cannot be used with the
795 .Fl s
796 option.
797 .It Fl P
798 Display the list of file paths changed in each commit, using the following
799 status codes:
800 .Bl -column YXZ description
801 .It M Ta modified file
802 .It D Ta file was deleted
803 .It A Ta new file was added
804 .It m Ta modified file modes (executable bit only)
805 .El
806 .Pp
807 Cannot be used with the
808 .Fl s
809 option.
810 .It Fl s
811 Display a short one-line summary of each commit, instead of the default
812 history format.
813 Cannot be used together with the
814 .Fl p
815 or
816 .Fl P
817 option.
818 .It Fl S Ar search-pattern
819 If specified, show only commits with a log message, author name,
820 committer name, or ID SHA1 hash matched by the extended regular
821 expression
822 .Ar search-pattern .
823 Lines in committed patches will be matched if
824 .Fl p
825 is specified.
826 File paths changed by a commit will be matched if
827 .Fl P
828 is specified.
829 Regular expression syntax is documented in
830 .Xr re_format 7 .
831 .It Fl r Ar repository-path
832 Use the repository at the specified path.
833 If not specified, assume the repository is located at or above the current
834 working directory.
835 If this directory is a
836 .Nm
837 work tree, use the repository path associated with this work tree.
838 .It Fl R
839 Determine a set of commits to display as usual, but display these commits
840 in reverse order.
841 .It Fl x Ar commit
842 Stop traversing commit history immediately after the specified
843 .Ar commit
844 has been traversed.
845 This option has no effect if the specified
846 .Ar commit
847 is never traversed.
848 .El
849 .Tg di
850 .It Cm diff Oo Fl a Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl P Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path ...
851 .Dl Pq alias: Cm di
852 When invoked within a work tree without any arguments, display all
853 local changes in the work tree.
854 If one or more
855 .Ar path
856 arguments are specified, only show changes within the specified paths.
857 .Pp
858 If two arguments are provided, treat each argument as a reference, a tag
859 name, or an object ID SHA1 hash, and display differences between the
860 corresponding objects.
861 Both objects must be of the same type (blobs, trees, or commits).
862 An abbreviated hash argument will be expanded to a full SHA1 hash
863 automatically, provided the abbreviation is unique.
864 If none of these interpretations produce a valid result or if the
865 .Fl P
866 option is used,
867 and if
868 .Cm got diff
869 is running in a work tree, attempt to interpret the two arguments as paths.
870 .Pp
871 The options for
872 .Cm got diff
873 are as follows:
874 .Bl -tag -width Ds
875 .It Fl a
876 Treat file contents as ASCII text even if binary data is detected.
877 .It Fl c Ar commit
878 Show differences between commits in the repository.
879 This options may be used up to two times.
880 When used only once, show differences between the specified
881 .Ar commit
882 and its first parent commit.
883 When used twice, show differences between the two specified commits.
884 .Pp
885 The expected argument is a commit ID SHA1 hash or an existing reference
886 or tag name which will be resolved to a commit ID.
887 An abbreviated hash argument will be expanded to a full SHA1 hash
888 automatically, provided the abbreviation is unique.
889 .Pp
890 If the
891 .Fl c
892 option is used, all non-option arguments will be interpreted as paths.
893 If one or more such
894 .Ar path
895 arguments are provided, only show differences for the specified paths.
896 .Pp
897 Cannot be used together with the
898 .Fl P
899 option.
900 .It Fl C Ar number
901 Set the number of context lines shown in the diff.
902 By default, 3 lines of context are shown.
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 s
911 Show changes staged with
912 .Cm got stage
913 instead of showing local changes in the work tree.
914 This option is only valid when
915 .Cm got diff
916 is invoked in a work tree.
917 .It Fl P
918 Interpret all arguments as paths only.
919 This option can be used to resolve ambiguity in cases where paths
920 look like tag names, reference names, or object IDs.
921 This option is only valid when
922 .Cm got diff
923 is invoked in a work tree.
924 .It Fl w
925 Ignore whitespace-only changes.
926 .El
927 .Tg bl
928 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
929 .Dl Pq alias: Cm bl
930 Display line-by-line history of a file at the specified path.
931 .Pp
932 The options for
933 .Cm got blame
934 are as follows:
935 .Bl -tag -width Ds
936 .It Fl c Ar commit
937 Start traversing history at the specified
938 .Ar commit .
939 The expected argument is a commit ID SHA1 hash or an existing reference
940 or tag name which will be resolved to a commit ID.
941 An abbreviated hash argument will be expanded to a full SHA1 hash
942 automatically, provided the abbreviation is unique.
943 .It Fl r Ar repository-path
944 Use the repository at the specified path.
945 If not specified, assume the repository is located at or above the current
946 working directory.
947 If this directory is a
948 .Nm
949 work tree, use the repository path associated with this work tree.
950 .El
951 .Tg tr
952 .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
953 .Dl Pq alias: Cm tr
954 Display a listing of files and directories at the specified
955 directory path in the repository.
956 Entries shown in this listing may carry one of the following trailing
957 annotations:
958 .Bl -column YXZ description
959 .It @ Ta entry is a symbolic link
960 .It / Ta entry is a directory
961 .It * Ta entry is an executable file
962 .It $ Ta entry is a Git submodule
963 .El
964 .Pp
965 Symbolic link entries are also annotated with the target path of the link.
966 .Pp
967 If no
968 .Ar path
969 is specified, list the repository path corresponding to the current
970 directory of the work tree, or the root directory of the repository
971 if there is no work tree.
972 .Pp
973 The options for
974 .Cm got tree
975 are as follows:
976 .Bl -tag -width Ds
977 .It Fl c Ar commit
978 List files and directories as they appear in the specified
979 .Ar commit .
980 The expected argument is a commit ID SHA1 hash or an existing reference
981 or tag name which will be resolved to a commit ID.
982 An abbreviated hash argument will be expanded to a full SHA1 hash
983 automatically, provided the abbreviation is unique.
984 .It Fl r Ar repository-path
985 Use the repository at the specified path.
986 If not specified, assume the repository is located at or above the current
987 working directory.
988 If this directory is a
989 .Nm
990 work tree, use the repository path associated with this work tree.
991 .It Fl i
992 Show object IDs of files (blob objects) and directories (tree objects).
993 .It Fl R
994 Recurse into sub-directories in the repository.
995 .El
996 .It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl t Oc Oo Fl c Ar object Oc Oo Fl s Ar reference Oc Oo Fl d Oc Op Ar name
997 Manage references in a repository.
998 .Pp
999 References may be listed, created, deleted, and changed.
1000 When creating, deleting, or changing a reference the specified
1001 .Ar name
1002 must be an absolute reference name, i.e. it must begin with
1003 .Dq refs/ .
1004 .Pp
1005 The options for
1006 .Cm got ref
1007 are as follows:
1008 .Bl -tag -width Ds
1009 .It Fl r Ar repository-path
1010 Use the repository at the specified path.
1011 If not specified, assume the repository is located at or above the current
1012 working directory.
1013 If this directory is a
1014 .Nm
1015 work tree, use the repository path associated with this work tree.
1016 .It Fl l
1017 List references in the repository.
1018 If no
1019 .Ar name
1020 is specified, list all existing references in the repository.
1022 .Ar name
1023 is a reference namespace, list all references in this namespace.
1024 Otherwise, show only the reference with the given
1025 .Ar name .
1026 Cannot be used together with any other options except
1027 .Fl r
1028 and
1029 .Fl t .
1030 .It Fl t
1031 Sort listed references by modification time (most recently modified first)
1032 instead of sorting by lexicographical order.
1033 Use of this option requires the
1034 .Fl l
1035 option to be used as well.
1036 .It Fl c Ar object
1037 Create a reference or change an existing reference.
1038 The reference with the specified
1039 .Ar name
1040 will point at the specified
1041 .Ar object .
1042 The expected
1043 .Ar object
1044 argument is a ID SHA1 hash or an existing reference or tag name which will
1045 be resolved to the ID of a corresponding commit, tree, tag, or blob object.
1046 Cannot be used together with any other options except
1047 .Fl r .
1048 .It Fl s Ar reference
1049 Create a symbolic reference, or change an existing symbolic reference.
1050 The symbolic reference with the specified
1051 .Ar name
1052 will point at the specified
1053 .Ar reference
1054 which must already exist in the repository.
1055 Care should be taken not to create loops between references when
1056 this option is used.
1057 Cannot be used together with any other options except
1058 .Fl r .
1059 .It Fl d
1060 Delete the reference with the specified
1061 .Ar name
1062 from the repository.
1063 Any commit, tree, tag, and blob objects belonging to deleted references
1064 remain in the repository and may be removed separately with
1065 Git's garbage collector or
1066 .Cm gotadmin cleanup .
1067 Cannot be used together with any other options except
1068 .Fl r .
1069 .El
1070 .Tg br
1071 .It Cm branch Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl t Oc Oo Fl d Ar name Oc Oo Fl n Oc Op Ar name
1072 .Dl Pq alias: Cm br
1073 Create, list, or delete branches.
1074 .Pp
1075 Local branches are managed via references which live in the
1076 .Dq refs/heads/
1077 reference namespace.
1078 The
1079 .Cm got branch
1080 command creates references in this namespace only.
1081 .Pp
1082 When deleting branches, the specified
1083 .Ar name
1084 is searched in the
1085 .Dq refs/heads
1086 reference namespace first.
1087 If no corresponding branch is found, the
1088 .Dq refs/remotes
1089 namespace will be searched next.
1090 .Pp
1091 If invoked in a work tree without any arguments, print the name of the
1092 work tree's current branch.
1093 .Pp
1094 If a
1095 .Ar name
1096 argument is passed, attempt to create a branch reference with the given name.
1097 By default the new branch reference will point at the latest commit on the
1098 work tree's current branch if invoked in a work tree, and otherwise to a commit
1099 resolved via the repository's HEAD reference.
1100 .Pp
1101 If invoked in a work tree, once the branch was created successfully
1102 switch the work tree's head reference to the newly created branch and
1103 update files across the entire work tree, just like
1104 .Cm got update -b Ar name
1105 would do.
1106 Show the status of each affected file, using the following status codes:
1107 .Bl -column YXZ description
1108 .It U Ta file was updated and contained no local changes
1109 .It G Ta file was updated and local changes were merged cleanly
1110 .It C Ta file was updated and conflicts occurred during merge
1111 .It D Ta file was deleted
1112 .It A Ta new file was added
1113 .It \(a~ Ta versioned file is obstructed by a non-regular file
1114 .It ! Ta a missing versioned file was restored
1115 .El
1116 .Pp
1117 The options for
1118 .Cm got branch
1119 are as follows:
1120 .Bl -tag -width Ds
1121 .It Fl c Ar commit
1122 Make a newly created branch reference point at the specified
1123 .Ar commit .
1124 The expected
1125 .Ar commit
1126 argument is a commit ID SHA1 hash or an existing reference
1127 or tag name which will be resolved to a commit ID.
1128 .It Fl r Ar repository-path
1129 Use the repository at the specified path.
1130 If not specified, assume the repository is located at or above the current
1131 working directory.
1132 If this directory is a
1133 .Nm
1134 work tree, use the repository path associated with this work tree.
1135 .It Fl l
1136 List all existing branches in the repository, including copies of remote
1137 repositories' branches in the
1138 .Dq refs/remotes/
1139 reference namespace.
1140 .Pp
1141 If invoked in a work tree, the work tree's current branch is shown
1142 with one the following annotations:
1143 .Bl -column YXZ description
1144 .It * Ta work tree's base commit matches the branch tip
1145 .It \(a~ Ta work tree's base commit is out-of-date
1146 .El
1147 .It Fl t
1148 Sort listed branches by modification time (most recently modified first)
1149 instead of sorting by lexicographical order.
1150 Branches in the
1151 .Dq refs/heads/
1152 reference namespace are listed before branches in
1153 .Dq refs/remotes/
1154 regardless.
1155 Use of this option requires the
1156 .Fl l
1157 option to be used as well.
1158 .It Fl d Ar name
1159 Delete the branch with the specified
1160 .Ar name
1161 from the
1162 .Dq refs/heads
1164 .Dq refs/remotes
1165 reference namespace.
1166 .Pp
1167 Only the branch reference is deleted.
1168 Any commit, tree, and blob objects belonging to the branch
1169 remain in the repository and may be removed separately with
1170 Git's garbage collector or
1171 .Cm gotadmin cleanup .
1172 .It Fl n
1173 Do not switch and update the work tree after creating a new branch.
1174 .El
1175 .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 Oo Fl s Ar signer-id Oc Oo Fl v Oc Oo Fl V Oc Ar name
1176 Manage tags in a repository.
1177 .Pp
1178 Tags are managed via references which live in the
1179 .Dq refs/tags/
1180 reference namespace.
1181 The
1182 .Cm got tag
1183 command operates on references in this namespace only.
1184 References in this namespace point at tag objects which contain a pointer
1185 to another object, a tag message, as well as author and timestamp information.
1186 .Pp
1187 Attempt to create a tag with the given
1188 .Ar name ,
1189 and make this tag point at the given
1190 .Ar commit .
1191 If no commit is specified, default to the latest commit on the work tree's
1192 current branch if invoked in a work tree, and to a commit resolved via
1193 the repository's HEAD reference otherwise.
1194 .Pp
1195 The options for
1196 .Cm got tag
1197 are as follows:
1198 .Bl -tag -width Ds
1199 .It Fl c Ar commit
1200 Make the newly created tag reference point at the specified
1201 .Ar commit .
1202 The expected
1203 .Ar commit
1204 argument is a commit ID SHA1 hash or an existing reference or tag name which
1205 will be resolved to a commit ID.
1206 An abbreviated hash argument will be expanded to a full SHA1 hash
1207 automatically, provided the abbreviation is unique.
1208 .It Fl m Ar message
1209 Use the specified tag message when creating the new tag.
1210 Without the
1211 .Fl m
1212 option,
1213 .Cm got tag
1214 opens a temporary file in an editor where a tag message can be written.
1215 .It Fl r Ar repository-path
1216 Use the repository at the specified path.
1217 If not specified, assume the repository is located at or above the current
1218 working directory.
1219 If this directory is a
1220 .Nm
1221 work tree, use the repository path associated with this work tree.
1222 .It Fl l
1223 List all existing tags in the repository instead of creating a new tag.
1224 If a
1225 .Ar name
1226 argument is passed, show only the tag with the given
1227 .Ar name .
1228 .It Fl s Ar signer-id
1229 While creating a new tag, sign this tag with the identity given in
1230 .Ar signer-id .
1231 .Pp
1232 For SSH-based signatures,
1233 .Ar signer-id
1234 is the path to a file which may refer to either a private SSH key,
1235 or a public SSH key with the private half available via
1236 .Xr ssh-agent 1 .
1237 .Cm got tag
1238 will sign the tag object by invoking
1239 .Xr ssh-keygen 1
1240 with the
1241 .Fl Y Ar sign
1242 command, using the signature namespace
1243 .Dq git
1244 for compatibility with
1245 .Xr git 1 .
1246 .It Fl v
1247 Verbose mode.
1248 During SSH signature creation and verification this option will be passed to
1249 .Xr ssh-keygen 1 .
1250 Multiple -v options increase the verbosity.
1251 The maximum is 3.
1252 .It Fl V
1253 Verify tag object signatures.
1254 If a
1255 .Ar name
1256 is specified, show and verify the tag object with the provided name.
1257 Otherwise, list all tag objects and verify signatures where present.
1258 .Pp
1259 .Cm got tag
1260 verifies SSH-based signatures by invoking
1261 .Xr ssh-keygen 1
1262 with the options
1263 .Fl Y Ar verify Fl f Ar allowed_signers .
1264 A path to the
1265 .Ar allowed_signers
1266 file must be set in
1267 .Xr got.conf 5 ,
1268 otherwise verification is impossible.
1269 .El
1270 .Pp
1271 By design, the
1272 .Cm got tag
1273 command will not delete tags or change existing tags.
1274 If a tag must be deleted, the
1275 .Cm got ref
1276 command may be used to delete a tag's reference.
1277 This should only be done if the tag has not already been copied to
1278 another repository.
1279 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
1280 Schedule unversioned files in a work tree for addition to the
1281 repository in the next commit.
1282 By default, files which match a
1283 .Cm got status
1284 ignore pattern will not be added.
1285 .Pp
1286 The options for
1287 .Cm got add
1288 are as follows:
1289 .Bl -tag -width Ds
1290 .It Fl R
1291 Permit recursion into directories.
1292 If this option is not specified,
1293 .Cm got add
1294 will refuse to run if a specified
1295 .Ar path
1296 is a directory.
1297 .It Fl I
1298 Add files even if they match a
1299 .Cm got status
1300 ignore pattern.
1301 .El
1302 .Tg rm
1303 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Oo Fl s Ar status-codes Oc Ar path ...
1304 .Dl Pq alias: Cm rm
1305 Remove versioned files from a work tree and schedule them for deletion
1306 from the repository in the next commit.
1307 .Pp
1308 The options for
1309 .Cm got remove
1310 are as follows:
1311 .Bl -tag -width Ds
1312 .It Fl f
1313 Perform the operation even if a file contains local modifications,
1314 and do not raise an error if a specified
1315 .Ar path
1316 does not exist on disk.
1317 .It Fl k
1318 Keep affected files on disk.
1319 .It Fl R
1320 Permit recursion into directories.
1321 If this option is not specified,
1322 .Cm got remove
1323 will refuse to run if a specified
1324 .Ar path
1325 is a directory.
1326 .It Fl s Ar status-codes
1327 Only delete files with a modification status matching one of the
1328 single-character status codes contained in the
1329 .Ar status-codes
1330 argument.
1331 The following status codes may be specified:
1332 .Bl -column YXZ description
1333 .It M Ta modified file (this implies the
1334 .Fl f
1335 option)
1336 .It ! Ta versioned file expected on disk but missing
1337 .El
1338 .El
1339 .Tg pa
1340 .It Cm patch Oo Fl c Ar commit Oc Oo Fl n Oc Oo Fl p Ar strip-count Oc Oo Fl R Oc Op Ar patchfile
1341 .Dl Pq alias: Cm pa
1342 Apply changes from
1343 .Ar patchfile
1344 to files in a work tree.
1345 Files added or removed by a patch will be scheduled for addition or removal in
1346 the work tree.
1347 .Pp
1348 The patch must be in the unified diff format as produced by
1349 .Cm got diff ,
1350 .Xr git-diff 1 ,
1351 or by
1352 .Xr diff 1
1353 and
1354 .Xr cvs 1
1355 diff when invoked with their
1356 .Fl u
1357 options.
1358 If no
1359 .Ar patchfile
1360 argument is provided, read unified diff data from standard input instead.
1361 .Pp
1362 If the
1363 .Ar patchfile
1364 contains multiple patches, then attempt to apply each of them in sequence.
1365 .Pp
1366 Show the status of each affected file, using the following status codes:
1367 .Bl -column XYZ description
1368 .It M Ta file was modified
1369 .It G Ta file was merged using a merge-base found in the repository
1370 .It C Ta file was merged and conflicts occurred during merge
1371 .It D Ta file was deleted
1372 .It A Ta file was added
1373 .It # Ta failed to patch the file
1374 .El
1375 .Pp
1376 If a change does not match at its exact line number, attempt to
1377 apply it somewhere else in the file if a good spot can be found.
1378 Otherwise, the patch will fail to apply.
1379 .Pp
1380 .Nm
1381 .Cm patch
1382 will refuse to apply a patch if certain preconditions are not met.
1383 Files to be deleted must already be under version control, and must
1384 not have been scheduled for deletion already.
1385 Files to be added must not yet be under version control and must not
1386 already be present on disk.
1387 Files to be modified must already be under version control and may not
1388 contain conflict markers.
1389 .Pp
1390 If an error occurs, the
1391 .Cm patch
1392 operation will be aborted.
1393 Any changes made to the work tree up to this point will be left behind.
1394 Such changes can be viewed with
1395 .Cm got diff
1396 and can be reverted with
1397 .Cm got revert
1398 if needed.
1399 .Pp
1400 The options for
1401 .Cm got patch
1402 are as follows:
1403 .Bl -tag -width Ds
1404 .It Fl c Ar commit
1405 Use files found in in the specified
1406 .Ar commit
1407 as a merge base for 3-way merges, overriding the meta-data in
1408 .Ar patchfile
1409 .Pq if any .
1410 In case no merge-base is available for a file
1411 .Cm got patch
1412 will attempt to apply the changes without doing a 3-way merge.
1414 .Fl p
1415 is used, the paths are stripped before being looked up.
1416 .It Fl n
1417 Do not make any modifications to the work tree.
1418 This can be used to check whether a patch would apply without issues.
1419 If the
1420 .Ar patchfile
1421 contains diffs that affect the same file multiple times, the results
1422 displayed may be incorrect.
1423 .It Fl p Ar strip-count
1424 Specify the number of leading path components to strip from paths
1425 parsed from
1426 .Ar patchfile .
1427 If the
1428 .Fl p
1429 option is not used,
1430 .Sq a/
1431 and
1432 .Sq b/
1433 path prefixes generated by
1434 .Xr git-diff 1
1435 will be recognized and stripped automatically.
1436 .It Fl R
1437 Reverse the patch before applying it.
1438 .El
1439 .Tg rv
1440 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
1441 .Dl Pq alias: Cm rv
1442 Revert any local changes in files at the specified paths in a work tree.
1443 File contents will be overwritten with those contained in the
1444 work tree's base commit.
1445 There is no way to bring discarded changes back after
1446 .Cm got revert !
1447 .Pp
1448 If a file was added with
1449 .Cm got add ,
1450 it will become an unversioned file again.
1451 If a file was deleted with
1452 .Cm got remove ,
1453 it will be restored.
1454 .Pp
1455 The options for
1456 .Cm got revert
1457 are as follows:
1458 .Bl -tag -width Ds
1459 .It Fl p
1460 Instead of reverting all changes in files, interactively select or reject
1461 changes to revert based on
1462 .Dq y
1463 (revert change),
1464 .Dq n
1465 (keep change), and
1466 .Dq q
1467 (quit reverting this file) responses.
1468 If a file is in modified status, individual patches derived from the
1469 modified file content can be reverted.
1470 Files in added or deleted status may only be reverted in their entirety.
1471 .It Fl F Ar response-script
1472 With the
1473 .Fl p
1474 option, read
1475 .Dq y ,
1476 .Dq n ,
1477 and
1478 .Dq q
1479 responses line-by-line from the specified
1480 .Ar response-script
1481 file instead of prompting interactively.
1482 .It Fl R
1483 Permit recursion into directories.
1484 If this option is not specified,
1485 .Cm got revert
1486 will refuse to run if a specified
1487 .Ar path
1488 is a directory.
1489 .El
1490 .Tg ci
1491 .It Cm commit Oo Fl A Ar author Oc Oo Fl F Ar path Oc Oo Fl m Ar message Oc Oo Fl N Oc Oo Fl S Oc Op Ar path ...
1492 .Dl Pq alias: Cm ci
1493 Create a new commit in the repository from changes in a work tree
1494 and use this commit as the new base commit for the work tree.
1495 If no
1496 .Ar path
1497 is specified, commit all changes in the work tree.
1498 Otherwise, commit changes at or within the specified paths.
1499 .Pp
1500 If changes have been explicitly staged for commit with
1501 .Cm got stage ,
1502 only commit staged changes and reject any specified paths which
1503 have not been staged.
1504 .Pp
1505 .Cm got commit
1506 opens a temporary file in an editor where a log message can be written
1507 unless the
1508 .Fl m
1509 option is used
1510 or the
1511 .Fl F
1512 and
1513 .Fl N
1514 options are used together.
1515 .Pp
1516 Show the status of each affected file, using the following status codes:
1517 .Bl -column YXZ description
1518 .It M Ta modified file
1519 .It D Ta file was deleted
1520 .It A Ta new file was added
1521 .It m Ta modified file modes (executable bit only)
1522 .El
1523 .Pp
1524 Files which are not part of the new commit will retain their previously
1525 recorded base commit.
1526 Some
1527 .Nm
1528 commands may refuse to run while the work tree contains files from
1529 multiple base commits.
1530 The base commit of such a work tree can be made consistent by running
1531 .Cm got update
1532 across the entire work tree.
1533 .Pp
1534 The
1535 .Cm got commit
1536 command requires the
1537 .Ev GOT_AUTHOR
1538 environment variable to be set,
1539 unless an author has been configured in
1540 .Xr got.conf 5
1541 or Git's
1542 .Dv user.name
1543 and
1544 .Dv user.email
1545 configuration settings can be
1546 obtained from the repository's
1547 .Pa .git/config
1548 file or from Git's global
1549 .Pa ~/.gitconfig
1550 configuration file.
1551 .Pp
1552 The options for
1553 .Cm got commit
1554 are as follows:
1555 .Bl -tag -width Ds
1556 .It Fl A Ar author
1557 Set author information in the newly created commit to
1558 .Ar author .
1559 This is useful when committing changes which were written by someone
1560 else.
1561 The
1562 .Ar author
1563 argument must use the same format as the
1564 .Ev GOT_AUTHOR
1565 environment variable.
1566 .Pp
1567 In addition to storing author information, the newly created commit
1568 object will retain
1569 .Dq committer
1570 information which is obtained, as usual, from the
1571 .Ev GOT_AUTHOR
1572 environment variable, or
1573 .Xr got.conf 5 ,
1574 or Git configuration settings.
1575 .It Fl F Ar path
1576 Use the prepared log message stored in the file found at
1577 .Ar path
1578 when creating the new commit.
1579 .Cm got commit
1580 opens a temporary file in an editor where the prepared log message can be
1581 reviewed and edited further if needed.
1582 Cannot be used together with the
1583 .Fl m
1584 option.
1585 .It Fl m Ar message
1586 Use the specified log message when creating the new commit.
1587 Cannot be used together with the
1588 .Fl F
1589 option.
1590 .It Fl N
1591 This option prevents
1592 .Cm got commit
1593 from opening the commit message in an editor.
1594 It has no effect unless it is used together with the
1595 .Fl F
1596 option and is intended for non-interactive use such as scripting.
1597 .It Fl S
1598 Allow the addition of symbolic links which point outside of the path space
1599 that is under version control.
1600 By default,
1601 .Cm got commit
1602 will reject such symbolic links due to safety concerns.
1603 As a precaution,
1604 .Nm
1605 may decide to represent such a symbolic link as a regular file which contains
1606 the link's target path, rather than creating an actual symbolic link which
1607 points outside of the work tree.
1608 Use of this option is discouraged because external mechanisms such as
1609 .Dq make obj
1610 are better suited for managing symbolic links to paths not under
1611 version control.
1612 .El
1613 .Pp
1614 .Cm got commit
1615 will refuse to run if certain preconditions are not met.
1616 If the work tree's current branch is not in the
1617 .Dq refs/heads/
1618 reference namespace, new commits may not be created on this branch.
1619 Local changes may only be committed if they are based on file content
1620 found in the most recent commit on the work tree's branch.
1621 If a path is found to be out of date,
1622 .Cm got update
1623 must be used first in order to merge local changes with changes made
1624 in the repository.
1625 .Tg se
1626 .It Cm send Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl d Ar branch Oc Oo Fl f Oc Oo Fl r Ar repository-path Oc Oo Fl t Ar tag Oc Oo Fl T Oc Oo Fl q Oc Oo Fl v Oc Op Ar remote-repository
1627 .Dl Pq alias: Cm se
1628 Send new changes to a remote repository.
1629 If no
1630 .Ar remote-repository
1631 is specified,
1632 .Dq origin
1633 will be used.
1634 The remote repository's URL is obtained from the corresponding entry in
1635 .Xr got.conf 5
1636 or Git's
1637 .Pa config
1638 file of the local repository, as created by
1639 .Cm got clone .
1640 .Pp
1641 All objects corresponding to new changes will be written to a temporary
1642 pack file which is then uploaded to the server.
1643 Upon success, references in the
1644 .Dq refs/remotes/
1645 reference namespace of the local repository will be updated to point at
1646 the commits which have been sent.
1647 .Pp
1648 By default, changes will only be sent if they are based on up-to-date
1649 copies of relevant branches in the remote repository.
1650 If any changes to be sent are based on out-of-date copies or would
1651 otherwise break linear history of existing branches, new changes must
1652 be fetched from the server with
1653 .Cm got fetch
1654 and local branches must be rebased with
1655 .Cm got rebase
1656 before
1657 .Cm got send
1658 can succeed.
1659 The
1660 .Fl f
1661 option can be used to make exceptions to these requirements.
1662 .Pp
1663 The options for
1664 .Cm got send
1665 are as follows:
1666 .Bl -tag -width Ds
1667 .It Fl a
1668 Send all branches from the local repository's
1669 .Dq refs/heads/
1670 reference namespace.
1671 The
1672 .Fl a
1673 option is equivalent to listing all branches with multiple
1674 .Fl b
1675 options.
1676 Cannot be used together with the
1677 .Fl b
1678 option.
1679 .It Fl b Ar branch
1680 Send the specified
1681 .Ar branch
1682 from the local repository's
1683 .Dq refs/heads/
1684 reference namespace.
1685 This option may be specified multiple times to build a list of branches
1686 to send.
1687 If this option is not specified, default to the work tree's current branch
1688 if invoked in a work tree, or to the repository's HEAD reference.
1689 Cannot be used together with the
1690 .Fl a
1691 option.
1692 .It Fl d Ar branch
1693 Delete the specified
1694 .Ar branch
1695 from the remote repository's
1696 .Dq refs/heads/
1697 reference namespace.
1698 This option may be specified multiple times to build a list of branches
1699 to delete.
1700 .Pp
1701 Only references are deleted.
1702 Any commit, tree, tag, and blob objects belonging to deleted branches
1703 may become subject to deletion by Git's garbage collector running on
1704 the server.
1705 .Pp
1706 Requesting deletion of branches results in an error if the server
1707 does not support this feature or disallows the deletion of branches
1708 based on its configuration.
1709 .It Fl f
1710 Attempt to force the server to overwrite existing branches or tags
1711 in the remote repository, even when
1712 .Cm got fetch
1713 and
1714 .Cm got rebase
1715 would usually be required before changes can be sent.
1716 The server may reject forced requests regardless, depending on its
1717 configuration.
1718 .Pp
1719 Any commit, tree, tag, and blob objects belonging to overwritten branches
1720 or tags may become subject to deletion by Git's garbage collector running
1721 on the server.
1722 .Pp
1723 The
1724 .Dq refs/tags
1725 reference namespace is globally shared between all repositories.
1726 Use of the
1727 .Fl f
1728 option to overwrite tags is discouraged because it can lead to
1729 inconsistencies between the tags present in different repositories.
1730 In general, creating a new tag with a different name is recommended
1731 instead of overwriting an existing tag.
1732 .Pp
1733 Use of the
1734 .Fl f
1735 option is particularly discouraged if changes being sent are based
1736 on an out-of-date copy of a branch in the remote repository.
1737 Instead of using the
1738 .Fl f
1739 option, new changes should
1740 be fetched with
1741 .Cm got fetch
1742 and local branches should be rebased with
1743 .Cm got rebase ,
1744 followed by another attempt to send the changes.
1745 .Pp
1746 The
1747 .Fl f
1748 option should only be needed in situations where the remote repository's
1749 copy of a branch or tag is known to be out-of-date and is considered
1750 disposable.
1751 The risks of creating inconsistencies between different repositories
1752 should also be taken into account.
1753 .It Fl r Ar repository-path
1754 Use the repository at the specified path.
1755 If not specified, assume the repository is located at or above the current
1756 working directory.
1757 If this directory is a
1758 .Nm
1759 work tree, use the repository path associated with this work tree.
1760 .It Fl t Ar tag
1761 Send the specified
1762 .Ar tag
1763 from the local repository's
1764 .Dq refs/tags/
1765 reference namespace, in addition to any branches that are being sent.
1766 The
1767 .Fl t
1768 option may be specified multiple times to build a list of tags to send.
1769 No tags will be sent if the
1770 .Fl t
1771 option is not used.
1772 .Pp
1773 Raise an error if the specified
1774 .Ar tag
1775 already exists in the remote repository, unless the
1776 .Fl f
1777 option is used to overwrite the server's copy of the tag.
1778 In general, creating a new tag with a different name is recommended
1779 instead of overwriting an existing tag.
1780 .Pp
1781 Cannot be used together with the
1782 .Fl T
1783 option.
1784 .It Fl T
1785 Attempt to send all tags from the local repository's
1786 .Dq refs/tags/
1787 reference namespace.
1788 The
1789 .Fl T
1790 option is equivalent to listing all tags with multiple
1791 .Fl t
1792 options.
1793 Cannot be used together with the
1794 .Fl t
1795 option.
1796 .It Fl q
1797 Suppress progress reporting output.
1798 The same option will be passed to
1799 .Xr ssh 1
1800 if applicable.
1801 .It Fl v
1802 Verbose mode.
1803 Causes
1804 .Cm got send
1805 to print debugging messages to standard error output.
1806 The same option will be passed to
1807 .Xr ssh 1
1808 if applicable.
1809 Multiple -v options increase the verbosity.
1810 The maximum is 3.
1811 .El
1812 .Tg cy
1813 .It Cm cherrypick Ar commit
1814 .Dl Pq alias: Cm cy
1815 Merge changes from a single
1816 .Ar commit
1817 into the work tree.
1818 The specified
1819 .Ar commit
1820 should be on a different branch than the work tree's base commit.
1821 The expected argument is a reference or a commit ID SHA1 hash.
1822 An abbreviated hash argument will be expanded to a full SHA1 hash
1823 automatically, provided the abbreviation is unique.
1824 .Pp
1825 Show the status of each affected file, using the following status codes:
1826 .Bl -column YXZ description
1827 .It G Ta file was merged
1828 .It C Ta file was merged and conflicts occurred during merge
1829 .It ! Ta changes destined for a missing file were not merged
1830 .It D Ta file was deleted
1831 .It d Ta file's deletion was prevented by local modifications
1832 .It A Ta new file was added
1833 .It \(a~ Ta changes destined for a non-regular file were not merged
1834 .It ? Ta changes destined for an unversioned file were not merged
1835 .El
1836 .Pp
1837 The merged changes will appear as local changes in the work tree, which
1838 may be viewed with
1839 .Cm got diff ,
1840 amended manually or with further
1841 .Cm got cherrypick
1842 commands,
1843 committed with
1844 .Cm got commit ,
1845 or discarded again with
1846 .Cm got revert .
1847 .Pp
1848 .Cm got cherrypick
1849 will refuse to run if certain preconditions are not met.
1850 If the work tree contains multiple base commits, it must first be updated
1851 to a single base commit with
1852 .Cm got update .
1853 If any relevant files already contain merge conflicts, these
1854 conflicts must be resolved first.
1855 .Tg bo
1856 .It Cm backout Ar commit
1857 .Dl Pq alias: Cm bo
1858 Reverse-merge changes from a single
1859 .Ar commit
1860 into the work tree.
1861 The specified
1862 .Ar commit
1863 should be on the same branch as the work tree's base commit.
1864 The expected argument is a reference or a commit ID SHA1 hash.
1865 An abbreviated hash argument will be expanded to a full SHA1 hash
1866 automatically, provided the abbreviation is unique.
1867 .Pp
1868 Show the status of each affected file, using the following status codes:
1869 .Bl -column YXZ description
1870 .It G Ta file was merged
1871 .It C Ta file was merged and conflicts occurred during merge
1872 .It ! Ta changes destined for a missing file were not merged
1873 .It D Ta file was deleted
1874 .It d Ta file's deletion was prevented by local modifications
1875 .It A Ta new file was added
1876 .It \(a~ Ta changes destined for a non-regular file were not merged
1877 .It ? Ta changes destined for an unversioned file were not merged
1878 .El
1879 .Pp
1880 The reverse-merged changes will appear as local changes in the work tree,
1881 which may be viewed with
1882 .Cm got diff ,
1883 amended manually or with further
1884 .Cm got backout
1885 commands,
1886 committed with
1887 .Cm got commit ,
1888 or discarded again with
1889 .Cm got revert .
1890 .Pp
1891 .Cm got backout
1892 will refuse to run if certain preconditions are not met.
1893 If the work tree contains multiple base commits, it must first be updated
1894 to a single base commit with
1895 .Cm got update .
1896 If any relevant files already contain merge conflicts, these
1897 conflicts must be resolved first.
1898 .Tg rb
1899 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Oo Fl l Oc Oo Fl X Oc Op Ar branch
1900 .Dl Pq alias: Cm rb
1901 Rebase commits on the specified
1902 .Ar branch
1903 onto the tip of the current branch of the work tree.
1904 The
1905 .Ar branch
1906 must share common ancestry with the work tree's current branch.
1907 Rebasing begins with the first descendant commit of the youngest
1908 common ancestor commit shared by the specified
1909 .Ar branch
1910 and the work tree's current branch, and stops once the tip commit
1911 of the specified
1912 .Ar branch
1913 has been rebased.
1914 .Pp
1915 When
1916 .Cm got rebase
1917 is used as intended, the specified
1918 .Ar branch
1919 represents a local commit history and may already contain changes
1920 that are not yet visible in any other repositories.
1921 The work tree's current branch, which must be set with
1922 .Cm got update -b
1923 before starting the
1924 .Cm rebase
1925 operation, represents a branch from a remote repository which shares
1926 a common history with the specified
1927 .Ar branch
1928 but has progressed, and perhaps diverged, due to commits added to the
1929 remote repository.
1930 .Pp
1931 Rebased commits are accumulated on a temporary branch which the work tree
1932 will remain switched to throughout the entire rebase operation.
1933 Commits on this branch represent the same changes with the same log
1934 messages as their counterparts on the original
1935 .Ar branch ,
1936 but with different commit IDs.
1937 Once rebasing has completed successfully, the temporary branch becomes
1938 the new version of the specified
1939 .Ar branch
1940 and the work tree is automatically switched to it.
1941 If author information is available via the
1942 .Ev GOT_AUTHOR
1943 environment variable,
1944 .Xr got.conf 5
1945 or Git's
1946 .Dv user.name
1947 and
1948 .Dv user.email
1949 configuration settings, this author information will be used to identify
1950 the
1951 .Dq committer
1952 of rebased commits.
1953 .Pp
1954 Old commits in their pre-rebase state are automatically backed up in the
1955 .Dq refs/got/backup/rebase
1956 reference namespace.
1957 As long as these references are not removed older versions of rebased
1958 commits will remain in the repository and can be viewed with the
1959 .Cm got rebase -l
1960 command.
1961 Removal of these references makes objects which become unreachable via
1962 any reference subject to removal by Git's garbage collector or
1963 .Cm gotadmin cleanup .
1964 .Pp
1965 While rebasing commits, show the status of each affected file,
1966 using the following status codes:
1967 .Bl -column YXZ description
1968 .It G Ta file was merged
1969 .It C Ta file was merged and conflicts occurred during merge
1970 .It ! Ta changes destined for a missing file were not merged
1971 .It D Ta file was deleted
1972 .It d Ta file's deletion was prevented by local modifications
1973 .It A Ta new file was added
1974 .It \(a~ Ta changes destined for a non-regular file were not merged
1975 .It ? Ta changes destined for an unversioned file were not merged
1976 .El
1977 .Pp
1978 If merge conflicts occur, the rebase operation is interrupted and may
1979 be continued once conflicts have been resolved.
1980 If any files with destined changes are found to be missing or unversioned,
1981 or if files could not be deleted due to differences in deleted content,
1982 the rebase operation will be interrupted to prevent potentially incomplete
1983 changes from being committed to the repository without user intervention.
1984 The work tree may be modified as desired and the rebase operation can be
1985 continued once the changes present in the work tree are considered complete.
1986 Alternatively, the rebase operation may be aborted which will leave
1987 .Ar branch
1988 unmodified and the work tree switched back to its original branch.
1989 .Pp
1990 If a merge conflict is resolved in a way which renders the merged
1991 change into a no-op change, the corresponding commit will be elided
1992 when the rebase operation continues.
1993 .Pp
1994 .Cm got rebase
1995 will refuse to run if certain preconditions are not met.
1996 If the work tree is not yet fully updated to the tip commit of its
1997 branch, then the work tree must first be updated with
1998 .Cm got update .
1999 If changes have been staged with
2000 .Cm got stage ,
2001 these changes must first be committed with
2002 .Cm got commit
2003 or unstaged with
2004 .Cm got unstage .
2005 If the work tree contains local changes, these changes must first be
2006 committed with
2007 .Cm got commit
2008 or reverted with
2009 .Cm got revert .
2010 If the
2011 .Ar branch
2012 contains changes to files outside of the work tree's path prefix,
2013 the work tree cannot be used to rebase this branch.
2014 .Pp
2015 The
2016 .Cm got update
2017 and
2018 .Cm got commit
2019 commands will refuse to run while a rebase operation is in progress.
2020 Other commands which manipulate the work tree may be used for
2021 conflict resolution purposes.
2022 .Pp
2023 If the specified
2024 .Ar branch
2025 is already based on the work tree's current branch, then no commits
2026 need to be rebased and
2027 .Cm got rebase
2028 will simply switch the work tree to the specified
2029 .Ar branch
2030 and update files in the work tree accordingly.
2031 .Pp
2032 The options for
2033 .Cm got rebase
2034 are as follows:
2035 .Bl -tag -width Ds
2036 .It Fl a
2037 Abort an interrupted rebase operation.
2038 If this option is used, no other command-line arguments are allowed.
2039 .It Fl c
2040 Continue an interrupted rebase operation.
2041 If this option is used, no other command-line arguments are allowed.
2042 .It Fl l
2043 Show a list of past rebase operations, represented by references in the
2044 .Dq refs/got/backup/rebase
2045 reference namespace.
2046 .Pp
2047 Display the author, date, and log message of each backed up commit,
2048 the object ID of the corresponding post-rebase commit, and
2049 the object ID of their common ancestor commit.
2050 Given these object IDs,
2051 the
2052 .Cm got log
2053 command with the
2054 .Fl c
2055 and
2056 .Fl x
2057 options can be used to examine the history of either version of the branch,
2058 and the
2059 .Cm got branch
2060 command with the
2061 .Fl c
2062 option can be used to create a new branch from a pre-rebase state if desired.
2063 .Pp
2064 If a
2065 .Ar branch
2066 is specified, only show commits which at some point in time represented this
2067 branch.
2068 Otherwise, list all backed up commits for any branches.
2069 .Pp
2070 If this option is used,
2071 .Cm got rebase
2072 does not require a work tree.
2073 None of the other options can be used together with
2074 .Fl l .
2075 .It Fl X
2076 Delete backups created by past rebase operations, represented by references
2077 in the
2078 .Dq refs/got/backup/rebase
2079 reference namespace.
2080 .Pp
2081 If a
2082 .Ar branch
2083 is specified, only delete backups which at some point in time represented
2084 this branch.
2085 Otherwise, delete all references found within
2086 .Dq refs/got/backup/rebase .
2087 .Pp
2088 Any commit, tree, tag, and blob objects belonging to deleted backups
2089 remain in the repository and may be removed separately with
2090 Git's garbage collector or
2091 .Cm gotadmin cleanup .
2092 .Pp
2093 If this option is used,
2094 .Cm got rebase
2095 does not require a work tree.
2096 None of the other options can be used together with
2097 .Fl X .
2098 .El
2099 .Tg he
2100 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl e Oc Oo Fl f Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc Oo Fl l Oc Oo Fl X Oc Op Ar branch
2101 .Dl Pq alias: Cm he
2102 Edit commit history between the work tree's current base commit and
2103 the tip commit of the work tree's current branch.
2104 .Pp
2105 The
2106 .Cm got histedit
2107 command requires the
2108 .Ev GOT_AUTHOR
2109 environment variable to be set,
2110 unless an author has been configured in
2111 .Xr got.conf 5
2112 or Git's
2113 .Dv user.name
2114 and
2115 .Dv user.email
2116 configuration settings can be obtained from the repository's
2117 .Pa .git/config
2118 file or from Git's global
2119 .Pa ~/.gitconfig
2120 configuration file.
2121 .Pp
2122 Before starting a
2123 .Cm histedit
2124 operation, the work tree's current branch must be set with
2125 .Cm got update -b
2126 to the branch which should be edited, unless this branch is already the
2127 current branch of the work tree.
2128 The tip of this branch represents the upper bound (inclusive) of commits
2129 touched by the
2130 .Cm histedit
2131 operation.
2132 .Pp
2133 Furthermore, the work tree's base commit
2134 must be set with
2135 .Cm got update -c
2136 to a point in this branch's commit history where editing should begin.
2137 This commit represents the lower bound (non-inclusive) of commits touched
2138 by the
2139 .Cm histedit
2140 operation.
2141 .Pp
2142 Editing of commit history is controlled via a
2143 .Ar histedit script
2144 which can be written in an editor based on a template, passed on the
2145 command line, or generated with the
2146 .Fl f
2148 .Fl m
2149 options.
2150 .Pp
2151 The format of the histedit script is line-based.
2152 Each line in the script begins with a command name, followed by
2153 whitespace and an argument.
2154 For most commands, the expected argument is a commit ID SHA1 hash.
2155 Any remaining text on the line is ignored.
2156 Lines which begin with the
2157 .Sq #
2158 character are ignored entirely.
2159 .Pp
2160 The available histedit script commands are as follows:
2161 .Bl -column YXZ pick-commit
2162 .It Cm pick Ar commit Ta Use the specified commit as it is.
2163 .It Cm edit Ar commit Ta Use the specified commit but once changes have been
2164 merged into the work tree interrupt the histedit operation for amending.
2165 .It Cm fold Ar commit Ta Combine the specified commit with the next commit
2166 listed further below that will be used.
2167 .It Cm drop Ar commit Ta Remove this commit from the edited history.
2168 .It Cm mesg Oo Ar log-message Oc Ta Create a new log message for the commit of
2169 a preceding
2170 .Cm pick
2172 .Cm edit
2173 command on the previous line of the histedit script.
2174 The optional
2175 .Ar log-message
2176 argument provides a new single-line log message to use.
2177 If the
2178 .Ar log-message
2179 argument is omitted, open an editor where a new log message can be written.
2180 .El
2181 .Pp
2182 Every commit in the history being edited must be mentioned in the script.
2183 Lines may be re-ordered to change the order of commits in the edited history.
2184 No commit may be listed more than once.
2185 .Pp
2186 Edited commits are accumulated on a temporary branch which the work tree
2187 will remain switched to throughout the entire histedit operation.
2188 Once history editing has completed successfully, the temporary branch becomes
2189 the new version of the work tree's branch and the work tree is automatically
2190 switched to it.
2191 .Pp
2192 Old commits in their pre-histedit state are automatically backed up in the
2193 .Dq refs/got/backup/histedit
2194 reference namespace.
2195 As long as these references are not removed older versions of edited
2196 commits will remain in the repository and can be viewed with the
2197 .Cm got histedit -l
2198 command.
2199 Removal of these references makes objects which become unreachable via
2200 any reference subject to removal by Git's garbage collector or
2201 .Cm gotadmin cleanup .
2202 .Pp
2203 While merging commits, show the status of each affected file,
2204 using the following status codes:
2205 .Bl -column YXZ description
2206 .It G Ta file was merged
2207 .It C Ta file was merged and conflicts occurred during merge
2208 .It ! Ta changes destined for a missing file were not merged
2209 .It D Ta file was deleted
2210 .It d Ta file's deletion was prevented by local modifications
2211 .It A Ta new file was added
2212 .It \(a~ Ta changes destined for a non-regular file were not merged
2213 .It ? Ta changes destined for an unversioned file were not merged
2214 .El
2215 .Pp
2216 If merge conflicts occur, the histedit operation is interrupted and may
2217 be continued once conflicts have been resolved.
2218 If any files with destined changes are found to be missing or unversioned,
2219 or if files could not be deleted due to differences in deleted content,
2220 the histedit operation will be interrupted to prevent potentially incomplete
2221 changes from being committed to the repository without user intervention.
2222 The work tree may be modified as desired and the histedit operation can be
2223 continued once the changes present in the work tree are considered complete.
2224 Alternatively, the histedit operation may be aborted which will leave
2225 the work tree switched back to its original branch.
2226 .Pp
2227 If a merge conflict is resolved in a way which renders the merged
2228 change into a no-op change, the corresponding commit will be elided
2229 when the histedit operation continues.
2230 .Pp
2231 .Cm got histedit
2232 will refuse to run if certain preconditions are not met.
2233 If the work tree's current branch is not in the
2234 .Dq refs/heads/
2235 reference namespace, the history of the branch may not be edited.
2236 If the work tree contains multiple base commits, it must first be updated
2237 to a single base commit with
2238 .Cm got update .
2239 If changes have been staged with
2240 .Cm got stage ,
2241 these changes must first be committed with
2242 .Cm got commit
2243 or unstaged with
2244 .Cm got unstage .
2245 If the work tree contains local changes, these changes must first be
2246 committed with
2247 .Cm got commit
2248 or reverted with
2249 .Cm got revert .
2250 If the edited history contains changes to files outside of the work tree's
2251 path prefix, the work tree cannot be used to edit the history of this branch.
2252 .Pp
2253 The
2254 .Cm got update ,
2255 .Cm got rebase ,
2256 and
2257 .Cm got integrate
2258 commands will refuse to run while a histedit operation is in progress.
2259 Other commands which manipulate the work tree may be used, and the
2260 .Cm got commit
2261 command may be used to commit arbitrary changes to the temporary branch
2262 while the histedit operation is interrupted.
2263 .Pp
2264 The options for
2265 .Cm got histedit
2266 are as follows:
2267 .Bl -tag -width Ds
2268 .It Fl a
2269 Abort an interrupted histedit operation.
2270 If this option is used, no other command-line arguments are allowed.
2271 .It Fl c
2272 Continue an interrupted histedit operation.
2273 If this option is used, no other command-line arguments are allowed.
2274 .It Fl e
2275 Interrupt the histedit operation for editing after merging each commit.
2276 This option is a quick equivalent to a histedit script which uses the
2277 .Cm edit
2278 command for all commits.
2279 The
2280 .Fl e
2281 option can only be used when starting a new histedit operation.
2282 If this option is used, no other command-line arguments are allowed.
2283 .It Fl f
2284 Fold all commits into a single commit.
2285 This option is a quick equivalent to a histedit script which folds all
2286 commits, combining them all into one commit.
2287 The
2288 .Fl f
2289 option can only be used when starting a new histedit operation.
2290 If this option is used, no other command-line arguments are allowed.
2291 .It Fl F Ar histedit-script
2292 Use the specified
2293 .Ar histedit-script
2294 instead of opening a temporary file in an editor where a histedit script
2295 can be written.
2296 .It Fl m
2297 Edit log messages only.
2298 This option is a quick equivalent to a histedit script which edits
2299 only log messages but otherwise leaves every picked commit as-is.
2300 The
2301 .Fl m
2302 option can only be used when starting a new histedit operation.
2303 If this option is used, no other command-line arguments are allowed.
2304 .It Fl l
2305 Show a list of past histedit operations, represented by references in the
2306 .Dq refs/got/backup/histedit
2307 reference namespace.
2308 .Pp
2309 Display the author, date, and log message of each backed up commit,
2310 the object ID of the corresponding post-histedit commit, and
2311 the object ID of their common ancestor commit.
2312 Given these object IDs,
2313 the
2314 .Cm got log
2315 command with the
2316 .Fl c
2317 and
2318 .Fl x
2319 options can be used to examine the history of either version of the branch,
2320 and the
2321 .Cm got branch
2322 command with the
2323 .Fl c
2324 option can be used to create a new branch from a pre-histedit state if desired.
2325 .Pp
2326 If a
2327 .Ar branch
2328 is specified, only show commits which at some point in time represented this
2329 branch.
2330 Otherwise, list all backed up commits for any branches.
2331 .Pp
2332 If this option is used,
2333 .Cm got histedit
2334 does not require a work tree.
2335 None of the other options can be used together with
2336 .Fl l .
2337 .It Fl X
2338 Delete backups created by past histedit operations, represented by references
2339 in the
2340 .Dq refs/got/backup/histedit
2341 reference namespace.
2342 .Pp
2343 If a
2344 .Ar branch
2345 is specified, only delete backups which at some point in time represented
2346 this branch.
2347 Otherwise, delete all references found within
2348 .Dq refs/got/backup/histedit .
2349 .Pp
2350 Any commit, tree, tag, and blob objects belonging to deleted backups
2351 remain in the repository and may be removed separately with
2352 Git's garbage collector or
2353 .Cm gotadmin cleanup .
2354 .Pp
2355 If this option is used,
2356 .Cm got histedit
2357 does not require a work tree.
2358 None of the other options can be used together with
2359 .Fl X .
2360 .El
2361 .Tg ig
2362 .It Cm integrate Ar branch
2363 .Dl Pq alias: Cm ig
2364 Integrate the specified
2365 .Ar branch
2366 into the work tree's current branch.
2367 Files in the work tree are updated to match the contents on the integrated
2368 .Ar branch ,
2369 and the reference of the work tree's branch is changed to point at the
2370 head commit of the integrated
2371 .Ar branch .
2372 .Pp
2373 Both branches can be considered equivalent after integration since they
2374 will be pointing at the same commit.
2375 Both branches remain available for future work, if desired.
2376 In case the integrated
2377 .Ar branch
2378 is no longer needed it may be deleted with
2379 .Cm got branch -d .
2380 .Pp
2381 Show the status of each affected file, using the following status codes:
2382 .Bl -column YXZ description
2383 .It U Ta file was updated
2384 .It D Ta file was deleted
2385 .It A Ta new file was added
2386 .It \(a~ Ta versioned file is obstructed by a non-regular file
2387 .It ! Ta a missing versioned file was restored
2388 .El
2389 .Pp
2390 .Cm got integrate
2391 will refuse to run if certain preconditions are not met.
2392 Most importantly, the
2393 .Ar branch
2394 must have been rebased onto the work tree's current branch with
2395 .Cm got rebase
2396 before it can be integrated, in order to linearize commit history and
2397 resolve merge conflicts.
2398 If the work tree contains multiple base commits, it must first be updated
2399 to a single base commit with
2400 .Cm got update .
2401 If changes have been staged with
2402 .Cm got stage ,
2403 these changes must first be committed with
2404 .Cm got commit
2405 or unstaged with
2406 .Cm got unstage .
2407 If the work tree contains local changes, these changes must first be
2408 committed with
2409 .Cm got commit
2410 or reverted with
2411 .Cm got revert .
2412 .Tg mg
2413 .It Cm merge Oo Fl a Oc Oo Fl c Oc Oo Fl n Oc Op Ar branch
2414 .Dl Pq alias: Cm mg
2415 Create a merge commit based on the current branch of the work tree and
2416 the specified
2417 .Ar branch .
2418 If a linear project history is desired, then use of
2419 .Cm got rebase
2420 should be preferred over
2421 .Cm got merge .
2422 However, even strictly linear projects may require merge commits in order
2423 to merge in new versions of third-party code stored on vendor branches
2424 created with
2425 .Cm got import .
2426 .Pp
2427 Merge commits are commits based on multiple parent commits.
2428 The tip commit of the work tree's current branch, which must be set with
2429 .Cm got update -b
2430 before starting the
2431 .Cm merge
2432 operation, will be used as the first parent.
2433 The tip commit of the specified
2434 .Ar branch
2435 will be used as the second parent.
2436 .Pp
2437 No ancestral relationship between the two branches is required.
2438 If the two branches have already been merged previously, only new changes
2439 will be merged.
2440 .Pp
2441 It is not possible to create merge commits with more than two parents.
2442 If more than one branch needs to be merged, then multiple merge commits
2443 with two parents each can be created in sequence.
2444 .Pp
2445 While merging changes found on the
2446 .Ar branch
2447 into the work tree, show the status of each affected file,
2448 using the following status codes:
2449 .Bl -column YXZ description
2450 .It G Ta file was merged
2451 .It C Ta file was merged and conflicts occurred during merge
2452 .It ! Ta changes destined for a missing file were not merged
2453 .It D Ta file was deleted
2454 .It d Ta file's deletion was prevented by local modifications
2455 .It A Ta new file was added
2456 .It \(a~ Ta changes destined for a non-regular file were not merged
2457 .It ? Ta changes destined for an unversioned file were not merged
2458 .El
2459 .Pp
2460 If merge conflicts occur, the merge operation is interrupted and conflicts
2461 must be resolved before the merge operation can continue.
2462 If any files with destined changes are found to be missing or unversioned,
2463 or if files could not be deleted due to differences in deleted content,
2464 the merge operation will be interrupted to prevent potentially incomplete
2465 changes from being committed to the repository without user intervention.
2466 The work tree may be modified as desired and the merge can be continued
2467 once the changes present in the work tree are considered complete.
2468 Alternatively, the merge operation may be aborted which will leave
2469 the work tree's current branch unmodified.
2470 .Pp
2471 If a merge conflict is resolved in a way which renders all merged
2472 changes into no-op changes, the merge operation cannot continue
2473 and must be aborted.
2474 .Pp
2475 .Cm got merge
2476 will refuse to run if certain preconditions are not met.
2477 If history of the
2478 .Ar branch
2479 is based on the work tree's current branch, then no merge commit can
2480 be created and
2481 .Cm got integrate
2482 may be used to integrate the
2483 .Ar branch
2484 instead.
2485 If the work tree is not yet fully updated to the tip commit of its
2486 branch, then the work tree must first be updated with
2487 .Cm got update .
2488 If the work tree contains multiple base commits, it must first be updated
2489 to a single base commit with
2490 .Cm got update .
2491 If changes have been staged with
2492 .Cm got stage ,
2493 these changes must first be committed with
2494 .Cm got commit
2495 or unstaged with
2496 .Cm got unstage .
2497 If the work tree contains local changes, these changes must first be
2498 committed with
2499 .Cm got commit
2500 or reverted with
2501 .Cm got revert .
2502 If the
2503 .Ar branch
2504 contains changes to files outside of the work tree's path prefix,
2505 the work tree cannot be used to merge this branch.
2506 .Pp
2507 The
2508 .Cm got update ,
2509 .Cm got commit ,
2510 .Cm got rebase ,
2511 .Cm got histedit ,
2512 .Cm got integrate ,
2513 and
2514 .Cm got stage
2515 commands will refuse to run while a merge operation is in progress.
2516 Other commands which manipulate the work tree may be used for
2517 conflict resolution purposes.
2518 .Pp
2519 The options for
2520 .Cm got merge
2521 are as follows:
2522 .Bl -tag -width Ds
2523 .It Fl a
2524 Abort an interrupted merge operation.
2525 If this option is used, no other command-line arguments are allowed.
2526 .It Fl c
2527 Continue an interrupted merge operation.
2528 If this option is used, no other command-line arguments are allowed.
2529 .It Fl n
2530 Merge changes into the work tree as usual but do not create a merge
2531 commit immediately.
2532 The merge result can be adjusted as desired before a merge commit is
2533 created with
2534 .Cm got merge -c .
2535 Alternatively, the merge may be aborted with
2536 .Cm got merge -a .
2537 .El
2538 .Tg sg
2539 .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 ...
2540 .Dl Pq alias: Cm sg
2541 Stage local changes for inclusion in the next commit.
2542 If no
2543 .Ar path
2544 is specified, stage all changes in the work tree.
2545 Otherwise, stage changes at or within the specified paths.
2546 Paths may be staged if they are added, modified, or deleted according to
2547 .Cm got status .
2548 .Pp
2549 Show the status of each affected file, using the following status codes:
2550 .Bl -column YXZ description
2551 .It A Ta file addition has been staged
2552 .It M Ta file modification has been staged
2553 .It D Ta file deletion has been staged
2554 .El
2555 .Pp
2556 Staged file contents are saved in newly created blob objects in the repository.
2557 These blobs will be referred to by tree objects once staged changes have been
2558 committed.
2559 .Pp
2560 Staged changes affect the behaviour of
2561 .Cm got commit ,
2562 .Cm got status ,
2563 and
2564 .Cm got diff .
2565 While paths with staged changes exist, the
2566 .Cm got commit
2567 command will refuse to commit any paths which do not have staged changes.
2568 Local changes created on top of staged changes can only be committed if
2569 the path is staged again, or if the staged changes are committed first.
2570 The
2571 .Cm got status
2572 command will show both local changes and staged changes.
2573 The
2574 .Cm got diff
2575 command is able to display local changes relative to staged changes,
2576 and to display staged changes relative to the repository.
2577 The
2578 .Cm got revert
2579 command cannot revert staged changes but may be used to revert
2580 local changes created on top of staged changes.
2581 .Pp
2582 The options for
2583 .Cm got stage
2584 are as follows:
2585 .Bl -tag -width Ds
2586 .It Fl l
2587 Instead of staging new changes, list paths which are already staged,
2588 along with the IDs of staged blob objects and stage status codes.
2589 If paths were provided on the command line, show the staged paths
2590 among the specified paths.
2591 Otherwise, show all staged paths.
2592 .It Fl p
2593 Instead of staging the entire content of a changed file, interactively
2594 select or reject changes for staging based on
2595 .Dq y
2596 (stage change),
2597 .Dq n
2598 (reject change), and
2599 .Dq q
2600 (quit staging this file) responses.
2601 If a file is in modified status, individual patches derived from the
2602 modified file content can be staged.
2603 Files in added or deleted status may only be staged or rejected in
2604 their entirety.
2605 .It Fl F Ar response-script
2606 With the
2607 .Fl p
2608 option, read
2609 .Dq y ,
2610 .Dq n ,
2611 and
2612 .Dq q
2613 responses line-by-line from the specified
2614 .Ar response-script
2615 file instead of prompting interactively.
2616 .It Fl S
2617 Allow staging of symbolic links which point outside of the path space
2618 that is under version control.
2619 By default,
2620 .Cm got stage
2621 will reject such symbolic links due to safety concerns.
2622 As a precaution,
2623 .Nm
2624 may decide to represent such a symbolic link as a regular file which contains
2625 the link's target path, rather than creating an actual symbolic link which
2626 points outside of the work tree.
2627 Use of this option is discouraged because external mechanisms such as
2628 .Dq make obj
2629 are better suited for managing symbolic links to paths not under
2630 version control.
2631 .El
2632 .Pp
2633 .Cm got stage
2634 will refuse to run if certain preconditions are not met.
2635 If a file contains merge conflicts, these conflicts must be resolved first.
2636 If a file is found to be out of date relative to the head commit on the
2637 work tree's current branch, the file must be updated with
2638 .Cm got update
2639 before it can be staged (however, this does not prevent the file from
2640 becoming out-of-date at some point after having been staged).
2641 .Pp
2642 The
2643 .Cm got update ,
2644 .Cm got rebase ,
2645 and
2646 .Cm got histedit
2647 commands will refuse to run while staged changes exist.
2648 If staged changes cannot be committed because a staged path
2649 is out of date, the path must be unstaged with
2650 .Cm got unstage
2651 before it can be updated with
2652 .Cm got update ,
2653 and may then be staged again if necessary.
2654 .Tg ug
2655 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
2656 .Dl Pq alias: Cm ug
2657 Merge staged changes back into the work tree and put affected paths
2658 back into non-staged status.
2659 If no
2660 .Ar path
2661 is specified, unstage all staged changes across the entire work tree.
2662 Otherwise, unstage changes at or within the specified paths.
2663 .Pp
2664 Show the status of each affected file, using the following status codes:
2665 .Bl -column YXZ description
2666 .It G Ta file was unstaged
2667 .It C Ta file was unstaged and conflicts occurred during merge
2668 .It ! Ta changes destined for a missing file were not merged
2669 .It D Ta file was staged as deleted and still is deleted
2670 .It d Ta file's deletion was prevented by local modifications
2671 .It \(a~ Ta changes destined for a non-regular file were not merged
2672 .El
2673 .Pp
2674 The options for
2675 .Cm got unstage
2676 are as follows:
2677 .Bl -tag -width Ds
2678 .It Fl p
2679 Instead of unstaging the entire content of a changed file, interactively
2680 select or reject changes for unstaging based on
2681 .Dq y
2682 (unstage change),
2683 .Dq n
2684 (keep change staged), and
2685 .Dq q
2686 (quit unstaging this file) responses.
2687 If a file is staged in modified status, individual patches derived from the
2688 staged file content can be unstaged.
2689 Files staged in added or deleted status may only be unstaged in their entirety.
2690 .It Fl F Ar response-script
2691 With the
2692 .Fl p
2693 option, read
2694 .Dq y ,
2695 .Dq n ,
2696 and
2697 .Dq q
2698 responses line-by-line from the specified
2699 .Ar response-script
2700 file instead of prompting interactively.
2701 .El
2702 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
2703 Parse and print contents of objects to standard output in a line-based
2704 text format.
2705 Content of commit, tree, and tag objects is printed in a way similar
2706 to the actual content stored in such objects.
2707 Blob object contents are printed as they would appear in files on disk.
2708 .Pp
2709 Attempt to interpret each argument as a reference, a tag name, or
2710 an object ID SHA1 hash.
2711 References will be resolved to an object ID.
2712 Tag names will resolved to a tag object.
2713 An abbreviated hash argument will be expanded to a full SHA1 hash
2714 automatically, provided the abbreviation is unique.
2715 .Pp
2716 If none of the above interpretations produce a valid result, or if the
2717 .Fl P
2718 option is used, attempt to interpret the argument as a path which will
2719 be resolved to the ID of an object found at this path in the repository.
2720 .Pp
2721 The options for
2722 .Cm got cat
2723 are as follows:
2724 .Bl -tag -width Ds
2725 .It Fl c Ar commit
2726 Look up paths in the specified
2727 .Ar commit .
2728 If this option is not used, paths are looked up in the commit resolved
2729 via the repository's HEAD reference.
2730 The expected argument is a commit ID SHA1 hash or an existing reference
2731 or tag name which will be resolved to a commit ID.
2732 An abbreviated hash argument will be expanded to a full SHA1 hash
2733 automatically, provided the abbreviation is unique.
2734 .It Fl r Ar repository-path
2735 Use the repository at the specified path.
2736 If not specified, assume the repository is located at or above the current
2737 working directory.
2738 If this directory is a
2739 .Nm
2740 work tree, use the repository path associated with this work tree.
2741 .It Fl P
2742 Interpret all arguments as paths only.
2743 This option can be used to resolve ambiguity in cases where paths
2744 look like tag names, reference names, or object IDs.
2745 .El
2746 .It Cm info Op Ar path ...
2747 Display meta-data stored in a work tree.
2748 See
2749 .Xr got-worktree 5
2750 for details.
2751 .Pp
2752 The work tree to use is resolved implicitly by walking upwards from the
2753 current working directory.
2754 .Pp
2755 If one or more
2756 .Ar path
2757 arguments are specified, show additional per-file information for tracked
2758 files located at or within these paths.
2759 If a
2760 .Ar path
2761 argument corresponds to the work tree's root directory, display information
2762 for all tracked files.
2763 .El
2764 .Sh ENVIRONMENT
2765 .Bl -tag -width GOT_IGNORE_GITCONFIG
2766 .It Ev GOT_AUTHOR
2767 The author's name and email address, such as
2768 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
2769 Used by the
2770 .Cm got commit ,
2771 .Cm got import ,
2772 .Cm got rebase ,
2773 and
2774 .Cm got histedit
2775 commands.
2776 Because
2777 .Xr git 1
2778 may fail to parse commits without an email address in author data,
2779 .Nm
2780 attempts to reject
2781 .Ev GOT_AUTHOR
2782 environment variables with a missing email address.
2783 .Pp
2784 .Ev GOT_AUTHOR will be overridden by configuration settings in
2785 .Xr got.conf 5
2786 or by Git's
2787 .Dv user.name
2788 and
2789 .Dv user.email
2790 configuration settings in the repository's
2791 .Pa .git/config
2792 file.
2793 The
2794 .Dv user.name
2795 and
2796 .Dv user.email
2797 configuration settings contained in Git's global
2798 .Pa ~/.gitconfig
2799 configuration file will only be used if neither
2800 .Xr got.conf 5
2801 nor the
2802 .Ev GOT_AUTHOR
2803 environment variable provide author information.
2804 .It Ev VISUAL , EDITOR
2805 The editor spawned by
2806 .Cm got commit ,
2807 .Cm got histedit ,
2808 .Cm got import ,
2810 .Cm got tag .
2811 If not set, the
2812 .Xr ed 1
2813 text editor will be spawned in order to give
2814 .Xr ed 1
2815 the attention it deserves.
2816 .It Ev GOT_LOG_DEFAULT_LIMIT
2817 The default limit on the number of commits traversed by
2818 .Cm got log .
2819 If set to zero, the limit is unbounded.
2820 This variable will be silently ignored if it is set to a non-numeric value.
2821 .It Ev GOT_IGNORE_GITCONFIG
2822 If this variable is set then any remote repository definitions or author
2823 information found in Git configuration files will be ignored.
2824 .El
2825 .Sh FILES
2826 .Bl -tag -width packed-refs -compact
2827 .It Pa got.conf
2828 Repository-wide configuration settings for
2829 .Nm .
2830 If present, a
2831 .Xr got.conf 5
2832 configuration file located in the root directory of a Git repository
2833 supersedes any relevant settings in Git's
2834 .Pa config
2835 file.
2836 .Pp
2837 .It Pa .got/got.conf
2838 Worktree-specific configuration settings for
2839 .Nm .
2840 If present, a
2841 .Xr got.conf 5
2842 configuration file in the
2843 .Pa .got
2844 meta-data directory of a work tree supersedes any relevant settings in
2845 the repository's
2846 .Xr got.conf 5
2847 configuration file and Git's
2848 .Pa config
2849 file.
2850 .El
2851 .Sh EXIT STATUS
2852 .Ex -std got
2853 .Sh EXAMPLES
2854 Enable tab-completion of
2855 .Nm
2856 command names in
2857 .Xr ksh 1 :
2858 .Pp
2859 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
2860 .Pp
2861 Clone an existing Git repository for use with
2862 .Nm .
2863 .Pp
2864 .Dl $ cd /var/git/
2865 .Dl $ got clone ssh://git@github.com/openbsd/src.git
2866 .Pp
2867 Use of HTTP URLs currently requires
2868 .Xr git 1 :
2869 .Pp
2870 .Dl $ cd /var/git/
2871 .Dl $ git clone --bare https://github.com/openbsd/src.git
2872 .Pp
2873 Alternatively, for quick and dirty local testing of
2874 .Nm
2875 a new Git repository could be created and populated with files,
2876 e.g. from a temporary CVS checkout located at
2877 .Pa /tmp/src :
2878 .Pp
2879 .Dl $ gotadmin init /var/git/src.git
2880 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
2881 .Pp
2882 Check out a work tree from the Git repository to /usr/src:
2883 .Pp
2884 .Dl $ got checkout /var/git/src.git /usr/src
2885 .Pp
2886 View local changes in a work tree directory:
2887 .Pp
2888 .Dl $ got diff | less
2889 .Pp
2890 In a work tree, display files in a potentially problematic state:
2891 .Pp
2892 .Dl $ got status -s 'C!~?'
2893 .Pp
2894 Interactively revert selected local changes in a work tree directory:
2895 .Pp
2896 .Dl $ got revert -p -R\ .
2897 .Pp
2898 In a work tree or a git repository directory, list all branch references:
2899 .Pp
2900 .Dl $ got branch -l
2901 .Pp
2902 In a work tree or a git repository directory, create a new branch called
2903 .Dq unified-buffer-cache
2904 which is forked off the
2905 .Dq master
2906 branch:
2907 .Pp
2908 .Dl $ got branch -c master unified-buffer-cache
2909 .Pp
2910 Switch an existing work tree to the branch
2911 .Dq unified-buffer-cache .
2912 Local changes in the work tree will be preserved and merged if necessary:
2913 .Pp
2914 .Dl $ got update -b unified-buffer-cache
2915 .Pp
2916 Create a new commit from local changes in a work tree directory.
2917 This new commit will become the head commit of the work tree's current branch:
2918 .Pp
2919 .Dl $ got commit
2920 .Pp
2921 In a work tree or a git repository directory, view changes committed in
2922 the 3 most recent commits to the work tree's branch, or the branch resolved
2923 via the repository's HEAD reference, respectively:
2924 .Pp
2925 .Dl $ got log -p -l 3
2926 .Pp
2927 As above, but display changes in the order in which
2928 .Xr patch 1
2929 could apply them in sequence:
2930 .Pp
2931 .Dl $ got log -p -l 3 -R
2932 .Pp
2933 In a work tree or a git repository directory, log the history of a subdirectory:
2934 .Pp
2935 .Dl $ got log sys/uvm
2936 .Pp
2937 While operating inside a work tree, paths are specified relative to the current
2938 working directory, so this command will log the subdirectory
2939 .Pa sys/uvm :
2940 .Pp
2941 .Dl $ cd sys/uvm && got log\ .
2942 .Pp
2943 And this command has the same effect:
2944 .Pp
2945 .Dl $ cd sys/dev/usb && got log ../../uvm
2946 .Pp
2947 And this command displays work tree meta-data about all tracked files:
2948 .Pp
2949 .Dl $ cd /usr/src
2950 .Dl $ got info\ . | less
2951 .Pp
2952 Add new files and remove obsolete files in a work tree directory:
2953 .Pp
2954 .Dl $ got add sys/uvm/uvm_ubc.c
2955 .Dl $ got remove sys/uvm/uvm_vnode.c
2956 .Pp
2957 Create a new commit from local changes in a work tree directory
2958 with a pre-defined log message.
2959 .Pp
2960 .Dl $ got commit -m 'unify the buffer cache'
2961 .Pp
2962 Alternatively, create a new commit from local changes in a work tree
2963 directory with a log message that has been prepared in the file
2964 .Pa /tmp/msg :
2965 .Pp
2966 .Dl $ got commit -F /tmp/msg
2967 .Pp
2968 Update any work tree checked out from the
2969 .Dq unified-buffer-cache
2970 branch to the latest commit on this branch:
2971 .Pp
2972 .Dl $ got update
2973 .Pp
2974 Roll file content on the unified-buffer-cache branch back by one commit,
2975 and then fetch the rolled-back change into the work tree as a local change
2976 to be amended and perhaps committed again:
2977 .Pp
2978 .Dl $ got backout unified-buffer-cache
2979 .Dl $ got commit -m 'roll back previous'
2980 .Dl $ # now back out the previous backout :-)
2981 .Dl $ got backout unified-buffer-cache
2982 .Pp
2983 Fetch new changes on the remote repository's
2984 .Dq master
2985 branch, making them visible on the local repository's
2986 .Dq origin/master
2987 branch:
2988 .Pp
2989 .Dl $ cd /usr/src
2990 .Dl $ got fetch
2991 .Pp
2992 In a repository created with a HTTP URL and
2993 .Cm git clone --bare
2994 the
2995 .Xr git-fetch 1
2996 command must be used instead:
2997 .Pp
2998 .Dl $ cd /var/git/src.git
2999 .Dl $ git fetch origin master:refs/remotes/origin/master
3000 .Pp
3001 Rebase the local
3002 .Dq master
3003 branch to merge the new changes that are now visible on the
3004 .Dq origin/master
3005 branch:
3006 .Pp
3007 .Dl $ cd /usr/src
3008 .Dl $ got update -b origin/master
3009 .Dl $ got rebase master
3010 .Pp
3011 Rebase the
3012 .Dq unified-buffer-cache
3013 branch on top of the new head commit of the
3014 .Dq master
3015 branch.
3016 .Pp
3017 .Dl $ got update -b master
3018 .Dl $ got rebase unified-buffer-cache
3019 .Pp
3020 Create a patch from all changes on the unified-buffer-cache branch.
3021 The patch can be mailed out for review and applied to
3022 .Ox Ns 's
3023 CVS tree:
3024 .Pp
3025 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
3026 .Pp
3027 Edit the entire commit history of the
3028 .Dq unified-buffer-cache
3029 branch:
3030 .Pp
3031 .Dl $ got update -b unified-buffer-cache
3032 .Dl $ got update -c master
3033 .Dl $ got histedit
3034 .Pp
3035 Before working against existing branches in a repository cloned with
3036 .Cm git clone --bare
3037 instead of
3038 .Cm got clone ,
3039 a Git
3040 .Dq refspec
3041 must be configured to map all references in the remote repository
3042 into the
3043 .Dq refs/remotes
3044 namespace of the local repository.
3045 This can be achieved by setting Git's
3046 .Pa remote.origin.fetch
3047 configuration variable to the value
3048 .Dq +refs/heads/*:refs/remotes/origin/*
3049 with the
3050 .Cm git config
3051 command:
3052 .Pp
3053 .Dl $ cd /var/git/repo
3054 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
3055 .Pp
3056 Additionally, the
3057 .Dq mirror
3058 option must be disabled:
3059 .Pp
3060 .Dl $ cd /var/git/repo
3061 .Dl $ git config remote.origin.mirror false
3062 .Pp
3063 Alternatively, the following
3064 .Xr git-fetch 1
3065 configuration item can be added manually to the Git repository's
3066 .Pa config
3067 file:
3068 .Pp
3069 .Dl [remote \&"origin\&"]
3070 .Dl url = ...
3071 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
3072 .Dl mirror = false
3073 .Pp
3074 This configuration leaves the local repository's
3075 .Dq refs/heads
3076 namespace free for use by local branches checked out with
3077 .Cm got checkout
3078 and, if needed, created with
3079 .Cm got branch .
3080 Branches in the
3081 .Dq refs/remotes/origin
3082 namespace can now be updated with incoming changes from the remote
3083 repository with
3084 .Cm got fetch
3086 .Xr git-fetch 1
3087 without extra command line arguments.
3088 Newly fetched changes can be examined with
3089 .Cm got log .
3090 .Pp
3091 Display changes on the remote repository's version of the
3092 .Dq master
3093 branch, as of the last time
3094 .Cm got fetch
3095 was run:
3096 .Pp
3097 .Dl $ got log -c origin/master | less
3098 .Pp
3099 As shown here, most commands accept abbreviated reference names such as
3100 .Dq origin/master
3101 instead of
3102 .Dq refs/remotes/origin/master .
3103 The latter is only needed in case of ambiguity.
3104 .Pp
3105 .Cm got rebase
3106 must be used to merge changes which are visible on the
3107 .Dq origin/master
3108 branch into the
3109 .Dq master
3110 branch.
3111 This will also merge local changes, if any, with the incoming changes:
3112 .Pp
3113 .Dl $ got update -b origin/master
3114 .Dl $ got rebase master
3115 .Pp
3116 In order to make changes committed to the
3117 .Dq unified-buffer-cache
3118 visible on the
3119 .Dq master
3120 branch, the
3121 .Dq unified-buffer-cache
3122 branch must first be rebased onto the
3123 .Dq master
3124 branch:
3125 .Pp
3126 .Dl $ got update -b master
3127 .Dl $ got rebase unified-buffer-cache
3128 .Pp
3129 Changes on the
3130 .Dq unified-buffer-cache
3131 branch can now be made visible on the
3132 .Dq master
3133 branch with
3134 .Cm got integrate .
3135 Because the rebase operation switched the work tree to the
3136 .Dq unified-buffer-cache
3137 branch, the work tree must be switched back to the
3138 .Dq master
3139 branch first:
3140 .Pp
3141 .Dl $ got update -b master
3142 .Dl $ got integrate unified-buffer-cache
3143 .Pp
3144 On the
3145 .Dq master
3146 branch, log messages for local changes can now be amended with
3147 .Dq OK
3148 by other developers and any other important new information:
3149 .Pp
3150 .Dl $ got update -c origin/master
3151 .Dl $ got histedit -m
3152 .Pp
3153 If the remote repository offers write access, local changes on the
3154 .Dq master
3155 branch can be sent to the remote repository with
3156 .Cm got send .
3157 Usually,
3158 .Cm got send
3159 can be run without further arguments.
3160 The arguments shown here match defaults, provided the work tree's
3161 current branch is the
3162 .Dq master
3163 branch:
3164 .Pp
3165 .Dl $ got send -b master origin
3166 .Pp
3167 If the remote repository requires the HTTPS protocol, the
3168 .Xr git-push 1
3169 command must be used instead:
3170 .Pp
3171 .Dl $ cd /var/git/src.git
3172 .Dl $ git push origin master
3173 .Pp
3174 When making contributions to projects which use the
3175 .Dq pull request
3176 workflow, SSH protocol repository access needs to be set up first.
3177 Once an account has been created on a Git hosting site it should
3178 be possible to upload a public SSH key for repository access
3179 authentication.
3180 .Pp
3181 The
3182 .Dq pull request
3183 workflow will usually involve two remote repositories.
3184 In the real-life example below, the
3185 .Dq origin
3186 repository was forked from the
3187 .Dq upstream
3188 repository by using the Git hosting site's web interface.
3189 The
3190 .Xr got.conf 5
3191 file in the local repository describes both remote repositories:
3192 .Bd -literal -offset indent
3193 # Jelmers's repository, which accepts pull requests
3194 remote "upstream" {
3195 server git@github.com
3196 protocol ssh
3197 repository "/jelmer/dulwich"
3198 branch { "master" }
3201 # Stefan's fork, used as the default remote repository
3202 remote "origin" {
3203 server git@github.com
3204 protocol ssh
3205 repository "/stspdotname/dulwich"
3206 branch { "master" }
3208 .Ed
3209 .Pp
3210 With this configuration, Stefan can create commits on
3211 .Dq refs/heads/master
3212 and send them to the
3213 .Dq origin
3214 repository by running:
3215 .Pp
3216 .Dl $ got send -b master origin
3217 .Pp
3218 The changes can now be proposed to Jelmer by opening a pull request
3219 via the Git hosting site's web interface.
3220 If Jelmer requests further changes to be made, additional commits
3221 can be created on the
3222 .Dq master
3223 branch and be added to the pull request by running
3224 .Cd got send
3225 again.
3226 .Pp
3227 If Jelmer prefers additional commits to be
3228 .Dq squashed
3229 then the following commands can be used to achieve this:
3230 .Pp
3231 .Dl $ got update -b master
3232 .Dl $ got update -c origin/master
3233 .Dl $ got histedit -f
3234 .Dl $ got send -f -b master origin
3235 .Pp
3236 Once Jelmer has accepted the pull request, Stefan can fetch the
3237 merged changes, and possibly several other new changes, by running:
3238 .Pp
3239 .Dl $ got fetch upstream
3240 .Pp
3241 The merged changes will now be visible under the reference
3242 .Dq refs/remotes/upstream/master .
3243 The local
3244 .Dq master
3245 branch can now be rebased on top of the latest changes
3246 from upstream:
3247 .Pp
3248 .Dl $ got update -b upstream/master
3249 .Dl $ got rebase master
3250 .Pp
3251 As a final step, the forked repository's copy of the master branch needs
3252 to be kept in sync by sending the new changes there:
3253 .Pp
3254 .Dl $ got send -f -b master origin
3255 .Pp
3256 If multiple pull requests need to be managed in parallel, a separate branch
3257 must be created for each pull request with
3258 .Cm got branch .
3259 Each such branch can then be used as above, in place of
3260 .Dq refs/heads/master .
3261 Changes for any accepted pull requests will still appear under
3262 .Dq refs/remotes/upstream/master,
3263 regardless of which branch was used in the forked repository to
3264 create a pull request.
3265 .Sh SEE ALSO
3266 .Xr gotadmin 1 ,
3267 .Xr tog 1 ,
3268 .Xr git-repository 5 ,
3269 .Xr got-worktree 5 ,
3270 .Xr got.conf 5 ,
3271 .Xr gotweb 8
3272 .Sh AUTHORS
3273 .An Anthony J. Bentley Aq Mt bentley@openbsd.org
3274 .An Christian Weisgerber Aq Mt naddy@openbsd.org
3275 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
3276 .An Josh Rickmar Aq Mt jrick@zettaport.com
3277 .An Joshua Stein Aq Mt jcs@openbsd.org
3278 .An Klemens Nanni Aq Mt kn@openbsd.org
3279 .An Martin Pieuchot Aq Mt mpi@openbsd.org
3280 .An Neels Hofmeyr Aq Mt neels@hofmeyr.de
3281 .An Omar Polo Aq Mt op@openbsd.org
3282 .An Ori Bernstein Aq Mt ori@openbsd.org
3283 .An Sebastien Marie Aq Mt semarie@openbsd.org
3284 .An Stefan Sperling Aq Mt stsp@openbsd.org
3285 .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au
3286 .An Theo Buehler Aq Mt tb@openbsd.org
3287 .An Thomas Adam Aq Mt thomas@xteddy.org
3288 .An Tracey Emery Aq Mt tracey@traceyemery.net
3289 .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org
3290 .Pp
3291 Parts of
3292 .Nm ,
3293 .Xr tog 1 ,
3294 and
3295 .Xr gotweb 8
3296 were derived from code under copyright by:
3297 .Pp
3298 .An Caldera International
3299 .An Daniel Hartmeier
3300 .An Esben Norby
3301 .An Henning Brauer
3302 .An HÃ¥kan Olsson
3303 .An Ingo Schwarze
3304 .An Jean-Francois Brousseau
3305 .An Joris Vink
3306 .An Jyri J. Virkki
3307 .An Larry Wall
3308 .An Markus Friedl
3309 .An Niall O'Higgins
3310 .An Niklas Hallqvist
3311 .An Ray Lai
3312 .An Ryan McBride
3313 .An Theo de Raadt
3314 .An Todd C. Miller
3315 .An Xavier Santolaria
3316 .Pp
3317 .Nm
3318 contains code contributed to the public domain by
3319 .An Austin Appleby
3320 .Sh CAVEATS
3321 .Nm
3322 is a work-in-progress and some features remain to be implemented.
3323 .Pp
3324 At present, the user has to fall back on
3325 .Xr git 1
3326 to perform some tasks.
3327 In particular:
3328 .Bl -bullet
3329 .It
3330 Reading from remote repositories over HTTP or HTTPS protocols requires
3331 .Xr git-clone 1
3332 and
3333 .Xr git-fetch 1 .
3334 .It
3335 Writing to remote repositories over HTTP or HTTPS protocols requires
3336 .Xr git-push 1 .
3337 .It
3338 The creation of merge commits with more than two parent commits requires
3339 .Xr git-merge 1 .
3340 .It
3341 In situations where files or directories were moved around
3342 .Cm got
3343 will not automatically merge changes to new locations and
3344 .Xr git 1
3345 will usually produce better results.
3346 .El