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 .Op Fl hV
26 .Ar command
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 The
52 .Nm
53 utility provides global and command-specific options.
54 Global options must precede the command name, and are as follows:
55 .Bl -tag -width tenletters
56 .It Fl h
57 Display usage information and exit immediately.
58 .It Fl V , -version
59 Display program version and exit immediately.
60 .El
61 .Pp
62 The
63 .Nm
64 utility only provides commands needed to perform version control tasks.
65 Commands needed for repository maintenance tasks are provided by
66 .Xr gotadmin 1 .
67 Git repository server functionality is provided by
68 .Xr gotd 8 .
69 A repository interface for web browsers is provided by
70 .Xr gotwebd 8 .
71 An interactive repository interface for the terminal is provided by
72 .Xr tog 1 .
73 .Pp
74 The commands for
75 .Nm
76 are as follows:
77 .Bl -tag -width checkout
78 .It Cm init Oo Fl b Ar branch Oc Ar repository-path
79 Create a new empty repository at the specified
80 .Ar repository-path .
81 .Pp
82 After
83 .Cm got init ,
84 the new repository must be populated before
85 .Cm got checkout
86 can be used.
87 The
88 .Cm got import
89 command can be used to populate the new repository with data from
90 a local directory.
91 Alternatively, on a server running
92 .Xr gotd 8 ,
93 the new repository can be made available to
94 .Xr got 1
95 or
96 .Xr git 1
97 clients by adding the repository to
98 .Xr gotd.conf 5
99 and restarting
100 .Xr gotd 8 .
101 Clients may then clone the new repository from the server, populate the cloned
102 repository, and then populate the new repository on the server via
103 .Cm got send
104 or
105 .Cm git push .
106 .Pp
107 The options for
108 .Cm got init
109 are as follows:
110 .Bl -tag -width Ds
111 .It Fl b Ar branch
112 Make the repository's HEAD reference point to the specified
113 .Ar branch
114 instead of the default branch
115 .Dq main .
116 .El
117 .Pp
118 The
119 .Cm got init
120 command is equivalent to
121 .Cm gotadmin init .
122 .Tg im
123 .It Xo
124 .Cm import
125 .Op Fl b Ar branch
126 .Op Fl I Ar pattern
127 .Op Fl m Ar message
128 .Op Fl r Ar repository-path
129 .Ar directory
130 .Xc
131 .Dl Pq alias: Cm im
132 Create an initial commit in a repository from the file hierarchy
133 within the specified
134 .Ar directory .
135 The created commit will not have any parent commits, i.e. it will be a
136 root commit.
137 Also create a new reference which provides a branch name for the newly
138 created commit.
139 Show the path of each imported file to indicate progress.
140 .Pp
141 The
142 .Cm got import
143 command requires the
144 .Ev GOT_AUTHOR
145 environment variable to be set,
146 unless an author has been configured in
147 .Xr got.conf 5
148 or Git's
149 .Dv user.name
150 and
151 .Dv user.email
152 configuration settings can be obtained from the repository's
153 .Pa .git/config
154 file or from Git's global
155 .Pa ~/.gitconfig
156 configuration file.
157 .Pp
158 The options for
159 .Cm got import
160 are as follows:
161 .Bl -tag -width Ds
162 .It Fl b Ar branch
163 Create the specified
164 .Ar branch .
165 If this option is not specified, a branch corresponding to the repository's
166 HEAD reference will be used.
167 Use of this option is required if the branch resolved via the repository's
168 HEAD reference already exists.
169 .It Fl I Ar pattern
170 Ignore files or directories with a name which matches the specified
171 .Ar pattern .
172 This option may be specified multiple times to build a list of ignore patterns.
173 The
174 .Ar pattern
175 follows the globbing rules documented in
176 .Xr glob 7 .
177 Ignore patterns which end with a slash,
178 .Dq / ,
179 will only match directories.
180 .It Fl m Ar message
181 Use the specified log message when creating the new commit.
182 Without the
183 .Fl m
184 option,
185 .Cm got import
186 opens a temporary file in an editor where a log message can be written.
187 Quitting the editor without saving the file will abort the import operation.
188 .It Fl r Ar repository-path
189 Use the repository at the specified path.
190 If not specified, assume the repository is located at or above the current
191 working directory.
192 .El
193 .Tg cl
194 .It Xo
195 .Cm clone
196 .Op Fl almqv
197 .Op Fl b Ar branch
198 .Op Fl R Ar reference
199 .Ar repository-URL
200 .Op Ar directory
201 .Xc
202 .Dl Pq alias: Cm cl
203 Clone a Git repository at the specified
204 .Ar repository-URL
205 into the specified
206 .Ar directory .
207 If no
208 .Ar directory
209 is specified, the directory name will be derived from the name of the
210 cloned repository.
211 .Cm got clone
212 will refuse to run if the
213 .Ar directory
214 already exists.
215 .Pp
216 The
217 .Ar repository-URL
218 specifies a protocol scheme, a server hostname, an optional port number
219 separated from the hostname by a colon, and a path to the repository on
220 the server:
221 .Lk scheme://hostname:port/path/to/repository
222 .Pp
223 The following protocol schemes are supported:
224 .Bl -tag -width https
225 .It git
226 The Git protocol as implemented by the
227 .Xr git-daemon 1
228 server.
229 Use of this protocol is discouraged since it supports neither authentication
230 nor encryption.
231 .It ssh
232 The Git protocol wrapped in an authenticated and encrypted
233 .Xr ssh 1
234 tunnel.
235 With this protocol the hostname may contain an embedded username for
236 .Xr ssh 1
237 to use:
238 .Mt user@hostname
239 .It http
240 The
241 .Dq smart
242 Git HTTP protocol.
243 Not compatible with servers using the
244 .Dq dumb
245 Git HTTP protocol.
246 .Pp
247 The
248 .Dq smart
249 Git HTTP protocol is supported by
250 .Cm got clone
251 and
252 .Cm got fetch ,
253 but not by
254 .Cm got send .
255 Sending from a repository cloned over HTTP will require use of a
256 .Ic send
257 block in
258 .Xr got.conf 5
259 to ensure that the
260 .Dq ssh://
261 protocol will be used by
262 .Cm got send .
263 .Pp
264 Use of this protocol is discouraged since it supports neither authentication
265 nor encryption.
266 .It https
267 The
268 .Dq smart
269 Git HTTP protocol wrapped in SSL/TLS.
270 .El
271 .Pp
272 Objects in the cloned repository are stored in a pack file which is downloaded
273 from the server.
274 This pack file will then be indexed to facilitate access to the objects stored
275 within.
276 If any objects in the pack file are stored in deltified form, all deltas will
277 be fully resolved in order to compute the ID of such objects.
278 This can take some time.
279 More details about the pack file format are documented in
280 .Xr git-repository 5 .
281 .Pp
282 .Cm got clone
283 creates a remote repository entry in the
284 .Xr got.conf 5
285 and
286 .Pa config
287 files of the cloned repository to store the
288 .Ar repository-url
289 and any
290 .Ar branch
291 or
292 .Ar reference
293 arguments for future use by
294 .Cm got fetch
295 or
296 .Xr git-fetch 1 .
297 .Pp
298 The options for
299 .Cm got clone
300 are as follows:
301 .Bl -tag -width Ds
302 .It Fl a
303 Fetch all branches from the remote repository's
304 .Dq refs/heads/
305 reference namespace and set
306 .Cm fetch_all_branches
307 in the cloned repository's
308 .Xr got.conf 5
309 file for future use by
310 .Cm got fetch .
311 If this option is not specified, a branch resolved via the remote
312 repository's HEAD reference will be fetched.
313 Cannot be used together with the
314 .Fl b
315 option.
316 .It Fl b Ar branch
317 Fetch the specified
318 .Ar branch
319 from the remote repository's
320 .Dq refs/heads/
321 reference namespace.
322 This option may be specified multiple times to build a list of branches
323 to fetch.
324 If the branch corresponding to the remote repository's HEAD reference is not
325 in this list, the cloned repository's HEAD reference will be set to the first
326 branch which was fetched.
327 If this option is not specified, a branch resolved via the remote
328 repository's HEAD reference will be fetched.
329 Cannot be used together with the
330 .Fl a
331 option.
332 .It Fl l
333 List branches and tags available for fetching from the remote repository
334 and exit immediately.
335 Cannot be used together with any of the other options except
336 .Fl q
337 and
338 .Fl v .
339 .It Fl m
340 Create the cloned repository as a mirror of the original repository.
341 This is useful if the cloned repository will not be used to store
342 locally created commits.
343 .Pp
344 The repository's
345 .Xr got.conf 5
346 and
347 .Pa config
348 files will be set up with the
349 .Dq mirror
350 option enabled, such that
351 .Cm got fetch
352 or
353 .Xr git-fetch 1
354 will write incoming changes directly to branches in the
355 .Dq refs/heads/
356 reference namespace, rather than to branches in the
357 .Dq refs/remotes/
358 namespace.
359 This avoids the usual requirement of having to run
360 .Cm got rebase
361 or
362 .Cm got merge
363 after
364 .Cm got fetch
365 in order to make incoming changes appear on branches in the
366 .Dq refs/heads/
367 namespace.
368 But maintaining custom changes in the cloned repository becomes difficult
369 since such changes will be at risk of being discarded whenever incoming
370 changes are fetched.
371 .It Fl q
372 Suppress progress reporting output.
373 The same option will be passed to
374 .Xr ssh 1
375 if applicable.
376 .It Fl R Ar reference
377 In addition to the branches and tags that will be fetched, fetch an arbitrary
378 .Ar reference
379 from the remote repository's
380 .Dq refs/
381 namespace.
382 This option may be specified multiple times to build a list of additional
383 references to fetch.
384 The specified
385 .Ar reference
386 may either be a path to a specific reference, or a reference namespace
387 which will cause all references in this namespace to be fetched.
388 .Pp
389 Each reference will be mapped into the cloned repository's
390 .Dq refs/remotes/
391 namespace, unless the
392 .Fl m
393 option is used to mirror references directly into the cloned repository's
394 .Dq refs/
395 namespace.
396 .Pp
397 .Cm got clone
398 will refuse to fetch references from the remote repository's
399 .Dq refs/remotes/
400 or
401 .Dq refs/got/
402 namespace.
403 .It Fl v
404 Verbose mode.
405 Causes
406 .Cm got clone
407 to print debugging messages to standard error output.
408 This option will be passed to
409 .Xr ssh 1
410 if applicable.
411 Multiple -v options increase the verbosity.
412 The maximum is 3.
413 .El
414 .Tg fe
415 .It Xo
416 .Cm fetch
417 .Op Fl adlqtvX
418 .Op Fl b Ar branch
419 .Op Fl R Ar reference
420 .Op Fl r Ar repository-path
421 .Op Ar remote-repository
422 .Xc
423 .Dl Pq alias: Cm fe
424 Fetch new changes from a remote repository.
425 If no
426 .Ar remote-repository
427 is specified,
428 .Dq origin
429 will be used.
430 The remote repository's URL is obtained from the corresponding entry in
431 .Xr got.conf 5
432 or Git's
433 .Pa config
434 file of the local repository, as created by
435 .Cm got clone .
436 .Pp
437 By default, any branches configured in
438 .Xr got.conf 5
439 for the
440 .Ar remote-repository
441 will be fetched.
442 If
443 .Cm got fetch
444 is invoked in a work tree then this work tree's current branch will be
445 fetched, too, provided it is present on the server.
446 If no branches to fetch can be found in
447 .Xr got.conf 5
448 or via a work tree, or said branches are not found on the server, a branch
449 resolved via the remote repository's HEAD reference will be fetched.
450 Likewise, if a HEAD reference for the
451 .Ar remote-repository
452 exists but its target no longer matches the remote HEAD, then
453 the new target branch will be fetched.
454 This default behaviour can be overridden with the
455 .Fl a
456 and
457 .Fl b
458 options.
459 .Pp
460 New changes will be stored in a separate pack file downloaded from the server.
461 Optionally, separate pack files stored in the repository can be combined with
462 .Xr git-repack 1 .
463 .Pp
464 By default, branch references in the
465 .Dq refs/remotes/
466 reference namespace will be updated to point at the newly fetched commits.
467 The
468 .Cm got rebase
469 or
470 .Cm got merge
471 command can then be used to make new changes visible on branches in the
472 .Dq refs/heads/
473 namespace, merging incoming changes with the changes on those branches
474 as necessary.
475 .Pp
476 If the repository was created as a mirror with
477 .Cm got clone -m ,
478 then all branches in the
479 .Dq refs/heads/
480 namespace will be updated directly to match the corresponding branches in
481 the remote repository.
482 If those branches contained local commits, these commits will no longer be
483 reachable via a reference and will therefore be at risk of being discarded
484 by Git's garbage collector or
485 .Cm gotadmin cleanup .
486 Maintaining custom changes in a mirror repository is therefore discouraged.
487 .Pp
488 In any case, references in the
489 .Dq refs/tags/
490 namespace will always be fetched and mapped directly to local references
491 in the same namespace.
492 .Pp
493 The options for
494 .Cm got fetch
495 are as follows:
496 .Bl -tag -width Ds
497 .It Fl a
498 Fetch all branches from the remote repository's
499 .Dq refs/heads/
500 reference namespace.
501 This option can be enabled by default for specific repositories in
502 .Xr got.conf 5 .
503 Cannot be used together with the
504 .Fl b
505 option.
506 .It Fl b Ar branch
507 Fetch the specified
508 .Ar branch
509 from the remote repository's
510 .Dq refs/heads/
511 reference namespace.
512 This option may be specified multiple times to build a list of branches
513 to fetch.
514 Cannot be used together with the
515 .Fl a
516 option.
517 .It Fl d
518 Delete branches and tags from the local repository which are no longer
519 present in the remote repository.
520 Only references are deleted.
521 Any commit, tree, tag, and blob objects belonging to deleted branches or
522 tags remain in the repository and may be removed separately with
523 Git's garbage collector or
524 .Cm gotadmin cleanup .
525 .It Fl l
526 List branches and tags available for fetching from the remote repository
527 and exit immediately.
528 Cannot be used together with any of the other options except
529 .Fl v ,
530 .Fl q ,
531 and
532 .Fl r .
533 .It Fl q
534 Suppress progress reporting output.
535 The same option will be passed to
536 .Xr ssh 1
537 if applicable.
538 .It Fl R Ar reference
539 In addition to the branches and tags that will be fetched, fetch an arbitrary
540 .Ar reference
541 from the remote repository's
542 .Dq refs/
543 namespace.
544 This option may be specified multiple times to build a list of additional
545 references to fetch.
546 The specified
547 .Ar reference
548 may either be a path to a specific reference, or a reference namespace
549 which will cause all references in this namespace to be fetched.
550 .Pp
551 Each reference will be mapped into the local repository's
552 .Dq refs/remotes/
553 namespace, unless the local repository was created as a mirror with
554 .Cm got clone -m
555 in which case references will be mapped directly into the local repository's
556 .Dq refs/
557 namespace.
558 .Pp
559 Once a reference has been fetched, a branch based on it can be created with
560 .Cm got branch
561 if needed.
562 .Pp
563 .Cm got fetch
564 will refuse to fetch references from the remote repository's
565 .Dq refs/remotes/
566 or
567 .Dq refs/got/
568 namespace.
569 .It Fl r Ar repository-path
570 Use the repository at the specified path.
571 If not specified, assume the repository is located at or above the current
572 working directory.
573 If this directory is a
574 .Nm
575 work tree, use the repository path associated with this work tree.
576 .It Fl t
577 Allow existing references in the
578 .Dq refs/tags
579 namespace to be updated if they have changed on the server.
580 If not specified, only new tag references will be created.
581 .It Fl v
582 Verbose mode.
583 Causes
584 .Cm got fetch
585 to print debugging messages to standard error output.
586 The same option will be passed to
587 .Xr ssh 1
588 if applicable.
589 Multiple -v options increase the verbosity.
590 The maximum is 3.
591 .It Fl X
592 Delete all references which correspond to a particular
593 .Ar remote-repository
594 instead of fetching new changes.
595 This can be useful when a remote repository is being removed from
596 .Xr got.conf 5 .
597 .Pp
598 With
599 .Fl X ,
600 the
601 .Ar remote-repository
602 argument is mandatory and no other options except
603 .Fl r ,
604 .Fl v ,
605 and
606 .Fl q
607 are allowed.
608 .Pp
609 Only references are deleted.
610 Any commit, tree, tag, and blob objects fetched from a remote repository
611 will generally be stored in pack files and may be removed separately with
612 .Xr git-repack 1
613 and Git's garbage collector.
614 .El
615 .Tg co
616 .It Xo
617 .Cm checkout
618 .Op Fl \&Eq
619 .Op Fl b Ar branch
620 .Op Fl c Ar commit
621 .Op Fl p Ar path-prefix
622 .Ar repository-path
623 .Op Ar work-tree-path
624 .Xc
625 .Dl Pq alias: Cm co
626 Copy files from a repository into a new work tree.
627 Show the status of each affected file, using the following status codes:
628 .Bl -column YXZ description
629 .It A Ta new file was added
630 .It E Ta file already exists in work tree's meta-data
631 .El
632 .Pp
633 If the
634 .Ar work tree path
635 is not specified, either use the last component of
636 .Ar repository path ,
637 or if a
638 .Ar path prefix
639 was specified use the last component of
640 .Ar path prefix .
641 .Pp
642 The options for
643 .Cm got checkout
644 are as follows:
645 .Bl -tag -width Ds
646 .It Fl b Ar branch
647 Check out files from a commit on the specified
648 .Ar branch .
649 If this option is not specified, a branch resolved via the repository's HEAD
650 reference will be used.
651 .It Fl c Ar commit
652 Check out files from the specified
653 .Ar commit
654 on the selected branch.
655 If this option is not specified, the most recent commit on the selected
656 branch will be used.
657 .Pp
658 The expected
659 .Ar commit
660 argument is a commit ID SHA1 hash, or a reference name or a keyword
661 which will be resolved to a commit ID.
662 An abbreviated hash argument will be expanded to a full SHA1 hash
663 automatically, provided the abbreviation is unique.
664 The keywords
665 .Qq :base
666 and
667 .Qq :head
668 resolve to the repository's HEAD reference, or, if the
669 .Fl b
670 option is used, the head of the checked-out
671 .Ar branch .
672 Keywords and reference names may be appended with
673 .Qq :+
674 or
675 .Qq :-
676 modifiers and an optional integer N to denote the
677 Nth descendant or antecedent by first parent traversal, respectively;
678 for example,
679 .Sy :head:-2
680 denotes the work tree branch head's 2nd generation ancestor, and
681 .Sy foo:-3
682 will denote the 3rd generation ancestor of the commit resolved by the
683 .Qq foo
684 reference.
685 If an integer does not follow the
686 .Qq :+
687 or
688 .Qq :-
689 modifier, a
690 .Qq 1
691 is implicitly appended
692 .Po e.g.,
693 .Sy :head:-
694 is equivalent to
695 .Sy :head:-1
696 .Pc .
697 .Pp
698 If the specified
699 .Ar commit
700 is not contained in the selected branch, a different branch which contains
701 this commit must be specified with the
702 .Fl b
703 option.
704 If no such branch is known, a new branch must be created for this
705 commit with
706 .Cm got branch
707 before
708 .Cm got checkout
709 can be used.
710 Checking out work trees with an unknown branch is intentionally not supported.
711 .It Fl E
712 Proceed with the checkout operation even if the directory at
713 .Ar work-tree-path
714 is not empty.
715 Existing files will be left intact.
716 .It Fl p Ar path-prefix
717 Restrict the work tree to a subset of the repository's tree hierarchy.
718 Only files beneath the specified
719 .Ar path-prefix
720 will be checked out.
721 .It Fl q
722 Silence progress output.
723 .El
724 .Tg up
725 .It Xo
726 .Cm update
727 .Op Fl q
728 .Op Fl b Ar branch
729 .Op Fl c Ar commit
730 .Op Ar path ...
731 .Xc
732 .Dl Pq alias: Cm up
733 Update an existing work tree to a different
734 .Ar commit .
735 Change existing files in the work tree as necessary to match file contents
736 of this commit.
737 Preserve any local changes in the work tree and merge them with the
738 incoming changes.
739 .Pp
740 Files which already contain merge conflicts will not be updated to avoid
741 further complications.
742 Such files will be updated when
743 .Cm got update
744 is run again after merge conflicts have been resolved.
745 If the conflicting changes are no longer needed, affected files can be
746 reverted with
747 .Cm got revert
748 before running
749 .Cm got update
750 again.
751 .Pp
752 Show the status of each affected file, using the following status codes:
753 .Bl -column YXZ description
754 .It U Ta file was updated and contained no local changes
755 .It G Ta file was updated and local changes were merged cleanly
756 .It C Ta file was updated and conflicts occurred during merge
757 .It D Ta file was deleted
758 .It d Ta file's deletion was prevented by local modifications
759 .It A Ta new file was added
760 .It \(a~ Ta versioned file is obstructed by a non-regular file
761 .It ! Ta a missing versioned file was restored
762 .It # Ta file was not updated because it contains merge conflicts
763 .It ? Ta changes destined for an unversioned file were not merged
764 .El
765 .Pp
766 If no
767 .Ar path
768 is specified, update the entire work tree.
769 Otherwise, restrict the update operation to files at or within the
770 specified paths.
771 Each path is required to exist in the update operation's target commit.
772 Files in the work tree outside specified paths will remain unchanged and
773 will retain their previously recorded base commit.
774 Some
775 .Nm
776 commands may refuse to run while the work tree contains files from
777 multiple base commits.
778 The base commit of such a work tree can be made consistent by running
779 .Cm got update
780 across the entire work tree.
781 Specifying a
782 .Ar path
783 is incompatible with the
784 .Fl b
785 option.
786 .Pp
787 .Cm got update
788 cannot update paths with staged changes.
789 If changes have been staged with
790 .Cm got stage ,
791 these changes must first be committed with
792 .Cm got commit
793 or unstaged with
794 .Cm got unstage .
795 .Pp
796 The options for
797 .Cm got update
798 are as follows:
799 .Bl -tag -width Ds
800 .It Fl b Ar branch
801 Switch the work tree's branch reference to the specified
802 .Ar branch
803 before updating the work tree.
804 This option requires that all paths in the work tree are updated.
805 .Pp
806 As usual, any local changes in the work tree will be preserved.
807 This can be useful when switching to a newly created branch in order
808 to commit existing local changes to this branch.
809 .Pp
810 Any local changes must be dealt with separately in order to obtain a
811 work tree with pristine file contents corresponding exactly to the specified
812 .Ar branch .
813 Such changes could first be committed to a different branch with
814 .Cm got commit ,
815 or could be discarded with
816 .Cm got revert .
817 .It Fl c Ar commit
818 Update the work tree to the specified
819 .Ar commit .
820 If this option is not specified, the most recent commit on the work tree's
821 branch will be used.
822 .Pp
823 The expected
824 .Ar commit
825 argument is a commit ID SHA1 hash, or a reference name or a keyword
826 which will be resolved to a commit ID.
827 An abbreviated hash argument will be expanded to a full SHA1 hash
828 automatically, provided the abbreviation is unique.
829 The keywords
830 .Qq :base
831 and
832 .Qq :head
833 resolve to the work tree's base commit and branch head, respectively.
834 Keywords and reference names may be appended with
835 .Qq :+
836 or
837 .Qq :-
838 modifiers and an optional integer N to denote the
839 Nth descendant or antecedent, respectively, by first parent traversal;
840 for example,
841 .Sy :head:-2
842 denotes the work tree branch head's 2nd generation ancestor, and
843 .Sy :base:+4
844 denotes the 4th generation descendant of the work tree's base commit.
845 Similarly,
846 .Sy foo:-3
847 will denote the 3rd generation ancestor of the commit resolved by the
848 .Qq foo
849 reference.
850 If an integer does not follow the
851 .Qq :+
852 or
853 .Qq :-
854 modifier, a
855 .Qq 1
856 is implicitly appended
857 .Po e.g.,
858 .Sy :head:-
859 is equivalent to
860 .Sy :head:-1
861 .Pc .
862 .It Fl q
863 Silence progress output.
864 .El
865 .Tg st
866 .It Xo
867 .Cm status
868 .Op Fl I
869 .Op Fl S Ar status-codes
870 .Op Fl s Ar status-codes
871 .Op Ar path ...
872 .Xc
873 .Dl Pq alias: Cm st
874 Show the current modification status of files in a work tree,
875 using the following status codes:
876 .Bl -column YXZ description
877 .It M Ta modified file
878 .It A Ta file scheduled for addition in next commit
879 .It D Ta file scheduled for deletion in next commit
880 .It C Ta modified or added file which contains merge conflicts
881 .It ! Ta versioned file was expected on disk but is missing
882 .It \(a~ Ta versioned file is obstructed by a non-regular file
883 .It ? Ta unversioned item not tracked by
884 .Nm
885 .It m Ta modified file modes (executable bit only)
886 .It N Ta non-existent
887 .Ar path
888 specified on the command line
889 .El
890 .Pp
891 If no
892 .Ar path
893 is specified, show modifications in the entire work tree.
894 Otherwise, show modifications at or within the specified paths.
895 .Pp
896 If changes have been staged with
897 .Cm got stage ,
898 staged changes are shown in the second output column, using the following
899 status codes:
900 .Bl -column YXZ description
901 .It M Ta file modification is staged
902 .It A Ta file addition is staged
903 .It D Ta file deletion is staged
904 .El
905 .Pp
906 Changes created on top of staged changes are indicated in the first column:
907 .Bl -column YXZ description
908 .It MM Ta file was modified after earlier changes have been staged
909 .It MA Ta file was modified after having been staged for addition
910 .El
911 .Pp
912 If the work tree contains the results of an interrupted
913 .Cm got rebase ,
914 .Cm got histedit ,
915 or
916 .Cm got merge
917 operation then display a message which shows the branches involved.
918 .Pp
919 The options for
920 .Cm got status
921 are as follows:
922 .Bl -tag -width Ds
923 .It Fl I
924 Show unversioned files even if they match an ignore pattern.
925 .It Fl S Ar status-codes
926 Suppress the output of files with a modification status matching any of the
927 single-character status codes contained in the
928 .Ar status-codes
929 argument.
930 Any combination of codes from the above list of possible status codes
931 may be specified.
932 For staged files, status codes displayed in either column will be matched.
933 Cannot be used together with the
934 .Fl s
935 option.
936 .It Fl s Ar status-codes
937 Only show files with a modification status matching any of the
938 single-character status codes contained in the
939 .Ar status-codes
940 argument.
941 Any combination of codes from the above list of possible status codes
942 may be specified.
943 For staged files, status codes displayed in either column will be matched.
944 Cannot be used together with the
945 .Fl S
946 option.
947 .El
948 .Pp
949 For compatibility with
950 .Xr cvs 1
951 and
952 .Xr git 1 ,
953 .Cm got status
954 reads
955 .Xr glob 7
956 patterns from
957 .Pa .cvsignore
958 and
959 .Pa .gitignore
960 files in each traversed directory and will not display unversioned files
961 which match these patterns.
962 Ignore patterns which end with a slash,
963 .Dq / ,
964 will only match directories.
965 As an extension to
966 .Xr glob 7
967 matching rules,
968 .Cm got status
969 supports consecutive asterisks,
970 .Dq ** ,
971 which will match an arbitrary amount of directories.
972 Unlike
973 .Xr cvs 1 ,
974 .Cm got status
975 only supports a single ignore pattern per line.
976 Unlike
977 .Xr git 1 ,
978 .Cm got status
979 does not support negated ignore patterns prefixed with
980 .Dq \&! ,
981 and gives no special significance to the location of path component separators,
982 .Dq / ,
983 in a pattern.
984 .It Xo
985 .Cm log
986 .Op Fl bdPpRst
987 .Op Fl C Ar number
988 .Op Fl c Ar commit
989 .Op Fl l Ar N
990 .Op Fl r Ar repository-path
991 .Op Fl S Ar search-pattern
992 .Op Fl x Ar commit
993 .Op Ar path
994 .Xc
995 Display history of a repository.
996 If a
997 .Ar path
998 is specified, show only commits which modified this path.
999 If invoked in a work tree, the
1000 .Ar path
1001 is interpreted relative to the current working directory,
1002 and the work tree's path prefix is implicitly prepended.
1003 Otherwise, the path is interpreted relative to the repository root.
1004 .Pp
1005 The options for
1006 .Cm got log
1007 are as follows:
1008 .Bl -tag -width Ds
1009 .It Fl b
1010 Display individual commits which were merged into the current branch
1011 from other branches.
1012 By default,
1013 .Cm got log
1014 shows the linear history of the current branch only.
1015 .It Fl C Ar number
1016 Set the number of context lines shown in diffs with
1017 .Fl p .
1018 By default, 3 lines of context are shown.
1019 .It Fl c Ar commit
1020 Start traversing history at the specified
1021 .Ar commit .
1022 If this option is not specified, default to the work tree's current branch
1023 if invoked in a work tree, or to the repository's HEAD reference.
1024 .Pp
1025 The expected
1026 .Ar commit
1027 argument is a commit ID SHA1 hash, or a reference name or a keyword
1028 which will be resolved to a commit ID.
1029 An abbreviated hash argument will be expanded to a full SHA1 hash
1030 automatically, provided the abbreviation is unique.
1031 The keywords
1032 .Qq :base
1033 and
1034 .Qq :head
1035 resolve to the work tree's base commit and branch head, respectively.
1036 The former is only valid if invoked in a work tree, while the latter will
1037 resolve to the tip of the work tree's current branch if invoked in a
1038 work tree, otherwise it will resolve to the repository's HEAD reference.
1039 Keywords and references may be appended with
1040 .Qq :+
1042 .Qq :-
1043 modifiers and an optional integer N to denote the
1044 Nth descendant or antecedent, respectively, by first parent traversal;
1045 for example,
1046 .Sy :head:-2
1047 denotes the HEAD reference's 2nd generation ancestor, and
1048 .Sy :base:+4
1049 denotes the 4th generation descendant of the work tree's base commit.
1050 Similarly,
1051 .Sy bar:+3
1052 will denote the 3rd generation descendant of the commit resolved by the
1053 .Qq bar
1054 reference.
1056 .Qq :+
1058 .Qq :-
1059 modifier without a trailing integer has an implicit
1060 .Qq 1
1061 appended
1062 .Po e.g.,
1063 .Sy :base:+
1064 is equivalent to
1065 .Sy :base:+1
1066 .Pc .
1067 .It Fl d
1068 Display diffstat of changes introduced in each commit.
1069 Cannot be used with the
1070 .Fl s
1071 option.
1072 Implies the
1073 .Fl P
1074 option (diffstat displays a list of changed paths).
1075 .It Fl l Ar N
1076 Limit history traversal to a given number of commits.
1077 If this option is not specified, a default limit value of zero is used,
1078 which is treated as an unbounded limit.
1079 The
1080 .Ev GOT_LOG_DEFAULT_LIMIT
1081 environment variable may be set to change this default value.
1082 .It Fl P
1083 Display the list of file paths changed in each commit, using the following
1084 status codes:
1085 .Bl -column YXZ description
1086 .It M Ta modified file
1087 .It D Ta file was deleted
1088 .It A Ta new file was added
1089 .It m Ta modified file modes (executable bit only)
1090 .El
1091 .Pp
1092 Cannot be used with the
1093 .Fl s
1094 option.
1095 .It Fl p
1096 Display the patch of modifications made in each commit.
1097 If a
1098 .Ar path
1099 is specified, only show the patch of modifications at or within this path.
1100 Cannot be used with the
1101 .Fl s
1102 option.
1103 .It Fl R
1104 Determine a set of commits to display as usual, but display these commits
1105 in reverse order.
1106 .It Fl r Ar repository-path
1107 Use the repository at the specified path.
1108 If not specified, assume the repository is located at or above the current
1109 working directory.
1110 If this directory is a
1111 .Nm
1112 work tree, use the repository path associated with this work tree.
1113 .It Fl S Ar search-pattern
1114 If specified, show only commits with a log message, author name,
1115 committer name, or ID SHA1 hash matched by the extended regular
1116 expression
1117 .Ar search-pattern .
1118 Lines in committed patches will be matched if
1119 .Fl p
1120 is specified.
1121 File paths changed by a commit will be matched if
1122 .Fl P
1123 is specified.
1124 Regular expression syntax is documented in
1125 .Xr re_format 7 .
1126 .It Fl s
1127 Display a short one-line summary of each commit, instead of the default
1128 history format.
1129 Cannot be used together with the
1130 .Fl p
1132 .Fl P
1133 option.
1134 .It Fl t
1135 Display commits in topological order.
1136 This option has no effect without the
1137 .Fl b
1138 option because a linear history is sorted in topological order by definition.
1139 Topological sorting is disabled by default because the present implementation
1140 requires that commit history is fully traversed before any output can be shown.
1141 .It Fl x Ar commit
1142 Stop traversing commit history immediately after the specified
1143 .Ar commit
1144 has been traversed.
1145 Like
1146 .Fl c ,
1147 the expected
1148 .Ar commit
1149 argument is a commit ID SHA1 hash, or a reference name or a keyword
1150 which will be resolved to a commit ID.
1151 This option has no effect if the specified
1152 .Ar commit
1153 is never traversed.
1154 .El
1155 .Tg di
1156 .It Xo
1157 .Cm diff
1158 .Op Fl adPsw
1159 .Op Fl C Ar number
1160 .Op Fl c Ar commit
1161 .Op Fl r Ar repository-path
1162 .Op Ar object1 Ar object2 | Ar path ...
1163 .Xc
1164 .Dl Pq alias: Cm di
1165 When invoked within a work tree without any arguments, display all
1166 local changes in the work tree.
1167 If one or more
1168 .Ar path
1169 arguments are specified, only show changes within the specified paths.
1170 .Pp
1171 If two arguments are provided, treat each argument as a reference, a tag
1172 name, or an object ID SHA1 hash, and display differences between the
1173 corresponding objects.
1174 Both objects must be of the same type (blobs, trees, or commits).
1175 An abbreviated hash argument will be expanded to a full SHA1 hash
1176 automatically, provided the abbreviation is unique.
1177 If none of these interpretations produce a valid result or if the
1178 .Fl P
1179 option is used,
1180 and if
1181 .Cm got diff
1182 is running in a work tree, attempt to interpret the two arguments as paths.
1183 .Pp
1184 The options for
1185 .Cm got diff
1186 are as follows:
1187 .Bl -tag -width Ds
1188 .It Fl a
1189 Treat file contents as ASCII text even if binary data is detected.
1190 .It Fl C Ar number
1191 Set the number of context lines shown in the diff.
1192 By default, 3 lines of context are shown.
1193 .It Fl c Ar commit
1194 Show differences between commits in the repository.
1195 This option may be used up to two times.
1196 When used only once, show differences between the specified
1197 .Ar commit
1198 and its first parent commit.
1199 When used twice, show differences between the two specified commits.
1200 .Pp
1201 If the
1202 .Fl c
1203 option is used, all non-option arguments will be interpreted as paths.
1204 If one or more such
1205 .Ar path
1206 arguments are provided, only show differences for the specified paths.
1207 .Pp
1208 The expected
1209 .Ar commit
1210 argument is a commit ID SHA1 hash, or a reference name or a keyword
1211 which will be resolved to a commit ID.
1212 An abbreviated hash argument will be expanded to a full SHA1 hash
1213 automatically, provided the abbreviation is unique.
1214 The keywords
1215 .Qq :base
1216 and
1217 .Qq :head
1218 resolve to the work tree's base commit and branch head, respectively.
1219 The former is only valid if invoked in a work tree, while the latter will
1220 resolve to the tip of the work tree's current branch if invoked in a
1221 work tree, otherwise it will resolve to the repository's HEAD reference.
1222 Keywords and references may be appended with
1223 .Qq :+
1225 .Qq :-
1226 modifiers and an optional integer N to denote the
1227 Nth descendant or antecedent, respectively, by first parent traversal;
1228 for example,
1229 .Sy :head:-2
1230 denotes the HEAD reference's 2nd generation ancestor, and
1231 .Sy :base:+4
1232 denotes the 4th generation descendant of the work tree's base commit.
1233 Similarly,
1234 .Sy baz:+8
1235 will denote the 8th generation descendant of the commit resolved by the
1236 .Qq baz
1237 reference.
1238 If an integer does not follow the
1239 .Qq :+
1241 .Qq :-
1242 modifier, a
1243 .Qq 1
1244 is implicitly appended
1245 .Po e.g.,
1246 .Sy :head:-
1247 is equivalent to
1248 .Sy :head:-1
1249 .Pc .
1250 .Pp
1251 Cannot be used together with the
1252 .Fl P
1253 option.
1254 .It Fl d
1255 Display diffstat of changes before the actual diff by annotating each file path
1256 or blob hash being diffed with the total number of lines added and removed.
1257 A summary line will display the total number of changes across all files.
1258 .It Fl P
1259 Interpret all arguments as paths only.
1260 This option can be used to resolve ambiguity in cases where paths
1261 look like tag names, reference names, or object IDs.
1262 This option is only valid when
1263 .Cm got diff
1264 is invoked in a work tree.
1265 .It Fl r Ar repository-path
1266 Use the repository at the specified path.
1267 If not specified, assume the repository is located at or above the current
1268 working directory.
1269 If this directory is a
1270 .Nm
1271 work tree, use the repository path associated with this work tree.
1272 .It Fl s
1273 Show changes staged with
1274 .Cm got stage
1275 instead of showing local changes in the work tree.
1276 This option is only valid when
1277 .Cm got diff
1278 is invoked in a work tree.
1279 .It Fl w
1280 Ignore whitespace-only changes.
1281 .El
1282 .Tg bl
1283 .It Xo
1284 .Cm blame
1285 .Op Fl c Ar commit
1286 .Op Fl r Ar repository-path
1287 .Ar path
1288 .Xc
1289 .Dl Pq alias: Cm bl
1290 Display line-by-line history of a file at the specified path.
1291 .Pp
1292 The options for
1293 .Cm got blame
1294 are as follows:
1295 .Bl -tag -width Ds
1296 .It Fl c Ar commit
1297 Start traversing history at the specified
1298 .Ar commit .
1299 The expected argument is a commit ID SHA1 hash, or a reference name
1300 or a keyword which will be resolved to a commit ID.
1301 An abbreviated hash argument will be expanded to a full SHA1 hash
1302 automatically, provided the abbreviation is unique.
1303 The keywords
1304 .Qq :base
1305 and
1306 .Qq :head
1307 resolve to the work tree's base commit and branch head, respectively.
1308 The former is only valid if invoked in a work tree, while the latter will
1309 resolve to the tip of the work tree's current branch if invoked in a
1310 work tree, otherwise it will resolve to the repository's HEAD reference.
1311 Keywords and references may be appended with
1312 .Qq :+
1314 .Qq :-
1315 modifiers and an optional integer N to denote the
1316 Nth descendant or antecedent by first parent traversal, respectively;
1317 for example,
1318 .Sy :head:-2
1319 denotes the work tree branch head's 2nd generation ancestor, and
1320 .Sy :base:+4
1321 denotes the 4th generation descendant of the work tree's base commit.
1322 Similarly,
1323 .Sy xyz:-5
1324 will denote the 5th generation ancestor of the commit resolved by the
1325 .Qq xyz
1326 reference.
1328 .Qq :+
1330 .Qq :-
1331 modifier without a trailing integer has an implicit
1332 .Qq 1
1333 appended
1334 .Po e.g.,
1335 .Sy :base:+
1336 is equivalent to
1337 .Sy :base:+1
1338 .Pc .
1339 .It Fl r Ar repository-path
1340 Use the repository at the specified path.
1341 If not specified, assume the repository is located at or above the current
1342 working directory.
1343 If this directory is a
1344 .Nm
1345 work tree, use the repository path associated with this work tree.
1346 .El
1347 .Tg tr
1348 .It Xo
1349 .Cm tree
1350 .Op Fl iR
1351 .Op Fl c Ar commit
1352 .Op Fl r Ar repository-path
1353 .Op Ar path
1354 .Xc
1355 .Dl Pq alias: Cm tr
1356 Display a listing of files and directories at the specified
1357 directory path in the repository.
1358 Entries shown in this listing may carry one of the following trailing
1359 annotations:
1360 .Bl -column YXZ description
1361 .It @ Ta entry is a symbolic link
1362 .It / Ta entry is a directory
1363 .It * Ta entry is an executable file
1364 .It $ Ta entry is a Git submodule
1365 .El
1366 .Pp
1367 Symbolic link entries are also annotated with the target path of the link.
1368 .Pp
1369 If no
1370 .Ar path
1371 is specified, list the repository path corresponding to the current
1372 directory of the work tree, or the root directory of the repository
1373 if there is no work tree.
1374 .Pp
1375 The options for
1376 .Cm got tree
1377 are as follows:
1378 .Bl -tag -width Ds
1379 .It Fl c Ar commit
1380 List files and directories as they appear in the specified
1381 .Ar commit .
1382 .Pp
1383 The expected argument is a commit ID SHA1 hash, or a reference name
1384 or a keyword which will be resolved to a commit ID.
1385 An abbreviated hash argument will be expanded to a full SHA1 hash
1386 automatically, provided the abbreviation is unique.
1387 The keywords
1388 .Qq :base
1389 and
1390 .Qq :head
1391 resolve to the work tree's base commit and branch head, respectively.
1392 The former is only valid if invoked in a work tree, while the latter will
1393 resolve to the tip of the work tree's current branch if invoked in a
1394 work tree, otherwise it will resolve to the repository's HEAD reference.
1395 Keywords and references may be appended with
1396 .Qq :+
1398 .Qq :-
1399 modifiers and an optional integer N to denote the
1400 Nth descendant or antecedent by first parent traversal, respectively;
1401 for example,
1402 .Sy :head:-2
1403 denotes the work tree branch head's 2nd generation ancestor, and
1404 .Sy :base:+4
1405 denotes the 4th generation descendant of the work tree's base commit.
1406 Similarly,
1407 .Sy spam:-3
1408 will denote the 3rd generation ancestor of the commit resolved by the
1409 .Qq spam
1410 reference.
1412 .Qq :+
1414 .Qq :-
1415 modifier without a trailing integer has an implicit
1416 .Qq 1
1417 appended
1418 .Po e.g.,
1419 .Sy :base:+
1420 is equivalent to
1421 .Sy :base:+1
1422 .Pc .
1423 .It Fl i
1424 Show object IDs of files (blob objects) and directories (tree objects).
1425 .It Fl R
1426 Recurse into sub-directories in the repository.
1427 .It Fl r Ar repository-path
1428 Use the repository at the specified path.
1429 If not specified, assume the repository is located at or above the current
1430 working directory.
1431 If this directory is a
1432 .Nm
1433 work tree, use the repository path associated with this work tree.
1434 .El
1435 .It Xo
1436 .Cm ref
1437 .Op Fl dlt
1438 .Op Fl c Ar object
1439 .Op Fl r Ar repository-path
1440 .Op Fl s Ar reference
1441 .Op Ar name
1442 .Xc
1443 Manage references in a repository.
1444 .Pp
1445 References may be listed, created, deleted, and changed.
1446 When creating, deleting, or changing a reference the specified
1447 .Ar name
1448 must be an absolute reference name, i.e. it must begin with
1449 .Dq refs/ .
1450 .Pp
1451 The options for
1452 .Cm got ref
1453 are as follows:
1454 .Bl -tag -width Ds
1455 .It Fl c Ar object
1456 Create a reference or change an existing reference.
1457 The reference with the specified
1458 .Ar name
1459 will point at the specified
1460 .Ar object .
1461 .Pp
1462 The expected
1463 .Ar object
1464 argument is an ID SHA1 hash or an existing reference or tag name
1465 or a keyword which will be resolved to the ID of a corresponding commit,
1466 tree, tag, or blob object.
1467 An abbreviated hash argument will be expanded to a full SHA1 hash
1468 automatically, provided the abbreviation is unique.
1469 The keywords
1470 .Qq :base
1471 and
1472 .Qq :head
1473 resolve to the work tree's base commit and branch head, respectively.
1474 The former is only valid if invoked in a work tree, while the latter will
1475 resolve to the tip of the work tree's current branch if invoked in a
1476 work tree, otherwise it will resolve to the repository's HEAD reference.
1477 Keywords and reference names may be appended with
1478 .Qq :+
1480 .Qq :-
1481 modifiers and an optional integer N to denote the
1482 Nth descendant or antecedent by first parent traversal, respectively;
1483 for example,
1484 .Sy :head:-2
1485 denotes the work tree branch head's 2nd generation ancestor, and
1486 .Sy tagged:-3
1487 will denote the 3rd generation ancestor of the commit resolved by the
1488 .Qq tagged
1489 reference.
1490 If an integer does not follow the
1491 .Qq :+
1493 .Qq :-
1494 modifier, a
1495 .Qq 1
1496 is implicitly appended
1497 .Po e.g.,
1498 .Sy :head:-
1499 is equivalent to
1500 .Sy :head:-1
1501 .Pc .
1502 .Pp
1503 Cannot be used together with any other options except
1504 .Fl r .
1505 .It Fl d
1506 Delete the reference with the specified
1507 .Ar name
1508 from the repository.
1509 Any commit, tree, tag, and blob objects belonging to deleted references
1510 remain in the repository and may be removed separately with
1511 Git's garbage collector or
1512 .Cm gotadmin cleanup .
1513 Cannot be used together with any other options except
1514 .Fl r .
1515 .It Fl l
1516 List references in the repository.
1517 If no
1518 .Ar name
1519 is specified, list all existing references in the repository.
1521 .Ar name
1522 is a reference namespace, list all references in this namespace.
1523 Otherwise, show only the reference with the given
1524 .Ar name .
1525 Cannot be used together with any other options except
1526 .Fl r
1527 and
1528 .Fl t .
1529 .It Fl r Ar repository-path
1530 Use the repository at the specified path.
1531 If not specified, assume the repository is located at or above the current
1532 working directory.
1533 If this directory is a
1534 .Nm
1535 work tree, use the repository path associated with this work tree.
1536 .It Fl s Ar reference
1537 Create a symbolic reference, or change an existing symbolic reference.
1538 The symbolic reference with the specified
1539 .Ar name
1540 will point at the specified
1541 .Ar reference
1542 which must already exist in the repository.
1543 Care should be taken not to create loops between references when
1544 this option is used.
1545 Cannot be used together with any other options except
1546 .Fl r .
1547 .It Fl t
1548 Sort listed references by modification time (most recently modified first)
1549 instead of sorting by lexicographical order.
1550 Use of this option requires the
1551 .Fl l
1552 option to be used as well.
1553 .El
1554 .Tg br
1555 .It Xo
1556 .Cm branch
1557 .Op Fl lnt
1558 .Op Fl c Ar commit
1559 .Op Fl d Ar name
1560 .Op Fl r Ar repository-path
1561 .Op Ar name
1562 .Xc
1563 .Dl Pq alias: Cm br
1564 Create, list, or delete branches.
1565 .Pp
1566 Local branches are managed via references which live in the
1567 .Dq refs/heads/
1568 reference namespace.
1569 The
1570 .Cm got branch
1571 command creates references in this namespace only.
1572 .Pp
1573 When deleting branches, the specified
1574 .Ar name
1575 is searched in the
1576 .Dq refs/heads
1577 reference namespace first.
1578 If no corresponding branch is found, the
1579 .Dq refs/remotes
1580 namespace will be searched next.
1581 .Pp
1582 If invoked in a work tree without any arguments, print the name of the
1583 work tree's current branch.
1584 .Pp
1585 If a
1586 .Ar name
1587 argument is passed, attempt to create a branch reference with the given name.
1588 By default the new branch reference will point at the latest commit on the
1589 work tree's current branch if invoked in a work tree, and otherwise to a commit
1590 resolved via the repository's HEAD reference.
1591 .Pp
1592 If invoked in a work tree, once the branch was created successfully
1593 switch the work tree's head reference to the newly created branch and
1594 update files across the entire work tree, just like
1595 .Cm got update -b Ar name
1596 would do.
1597 Show the status of each affected file, using the following status codes:
1598 .Bl -column YXZ description
1599 .It U Ta file was updated and contained no local changes
1600 .It G Ta file was updated and local changes were merged cleanly
1601 .It C Ta file was updated and conflicts occurred during merge
1602 .It D Ta file was deleted
1603 .It A Ta new file was added
1604 .It \(a~ Ta versioned file is obstructed by a non-regular file
1605 .It ! Ta a missing versioned file was restored
1606 .El
1607 .Pp
1608 The options for
1609 .Cm got branch
1610 are as follows:
1611 .Bl -tag -width Ds
1612 .It Fl c Ar commit
1613 Make a newly created branch reference point at the specified
1614 .Ar commit .
1615 The expected argument is a commit ID SHA1 hash, or a reference name or keyword
1616 which will be resolved to a commit ID.
1617 An abbreviated hash argument will be expanded to a full SHA1 hash
1618 automatically, provided the abbreviation is unique.
1619 The keywords
1620 .Qq :base
1621 and
1622 .Qq :head
1623 resolve to the work tree's base commit and branch head, respectively.
1624 The former is only valid if invoked in a work tree, while the latter will
1625 resolve to the tip of the work tree's current branch if invoked in a
1626 work tree, otherwise it will resolve to the repository's HEAD reference.
1627 Keywords and references may be appended with
1628 .Qq :+
1630 .Qq :-
1631 modifiers and an optional integer N to denote the
1632 Nth descendant or antecedent by first parent traversal, respectively;
1633 for example,
1634 .Sy :head:-2
1635 denotes the work tree branch head's 2nd generation ancestor, and
1636 .Sy :base:+4
1637 denotes the 4th generation descendant of the work tree's base commit.
1638 Similarly,
1639 .Sy foobar:+3
1640 will denote the 3rd generation descendant of the commit resolved by the
1641 .Qq foobar
1642 reference.
1644 .Qq :+
1646 .Qq :-
1647 modifier without a trailing integer has an implicit
1648 .Qq 1
1649 appended
1650 .Po e.g.,
1651 .Sy :base:+
1652 is equivalent to
1653 .Sy :base:+1
1654 .Pc .
1655 .It Fl d Ar name
1656 Delete the branch with the specified
1657 .Ar name
1658 from the
1659 .Dq refs/heads
1661 .Dq refs/remotes
1662 reference namespace.
1663 .Pp
1664 Only the branch reference is deleted.
1665 Any commit, tree, and blob objects belonging to the branch
1666 remain in the repository and may be removed separately with
1667 Git's garbage collector or
1668 .Cm gotadmin cleanup .
1669 .It Fl l
1670 List all existing branches in the repository, including copies of remote
1671 repositories' branches in the
1672 .Dq refs/remotes/
1673 reference namespace.
1674 .Pp
1675 If invoked in a work tree, the work tree's current branch is shown
1676 with one of the following annotations:
1677 .Bl -column YXZ description
1678 .It * Ta work tree's base commit and the base commit of all tracked files
1679 matches the branch tip
1680 .It \(a~ Ta work tree comprises mixed commits or its base commit is out-of-date
1681 .El
1682 .It Fl n
1683 Do not switch and update the work tree after creating a new branch.
1684 .It Fl r Ar repository-path
1685 Use the repository at the specified path.
1686 If not specified, assume the repository is located at or above the current
1687 working directory.
1688 If this directory is a
1689 .Nm
1690 work tree, use the repository path associated with this work tree.
1691 .It Fl t
1692 Sort listed branches by modification time (most recently modified first)
1693 instead of sorting by lexicographical order.
1694 Branches in the
1695 .Dq refs/heads/
1696 reference namespace are listed before branches in
1697 .Dq refs/remotes/
1698 regardless.
1699 Use of this option requires the
1700 .Fl l
1701 option to be used as well.
1702 .El
1703 .It Xo
1704 .Cm tag
1705 .Op Fl lVv
1706 .Op Fl c Ar commit
1707 .Op Fl m Ar message
1708 .Op Fl r Ar repository-path
1709 .Op Fl s Ar signer-id
1710 .Ar name
1711 .Xc
1712 Manage tags in a repository.
1713 .Pp
1714 Tags are managed via references which live in the
1715 .Dq refs/tags/
1716 reference namespace.
1717 The
1718 .Cm got tag
1719 command operates on references in this namespace only.
1720 References in this namespace point at tag objects which contain a pointer
1721 to another object, a tag message, as well as author and timestamp information.
1722 .Pp
1723 Attempt to create a tag with the given
1724 .Ar name ,
1725 and make this tag point at the given
1726 .Ar commit .
1727 If no commit is specified, default to the latest commit on the work tree's
1728 current branch if invoked in a work tree, and to a commit resolved via
1729 the repository's HEAD reference otherwise.
1730 .Pp
1731 The options for
1732 .Cm got tag
1733 are as follows:
1734 .Bl -tag -width Ds
1735 .It Fl c Ar commit
1736 Make the newly created tag reference point at the specified
1737 .Ar commit .
1738 The expected
1739 .Ar commit
1740 argument is a commit ID SHA1 hash, or a reference or keyword
1741 which will be resolved to a commit ID.
1742 An abbreviated hash argument will be expanded to a full SHA1 hash
1743 automatically, provided the abbreviation is unique.
1744 The keywords
1745 .Qq :base
1746 and
1747 .Qq :head
1748 resolve to the work tree's base commit and branch head, respectively.
1749 The former is only valid if invoked in a work tree, while the latter will
1750 resolve to the tip of the work tree's current branch if invoked in a
1751 work tree, otherwise it will resolve to the repository's HEAD reference.
1752 Keywords and references may be appended with
1753 .Qq :+
1755 .Qq :-
1756 modifiers and an optional integer N to denote the
1757 Nth descendant or antecedent by first parent traversal, respectively;
1758 for example,
1759 .Sy :head:-2
1760 denotes the work tree branch head's 2nd generation ancestor, and
1761 .Sy :base:+4
1762 denotes the 4th generation descendant of the work tree's base commit.
1763 Similarly,
1764 .Sy eggs:-3
1765 will denote the 3rd generation ancestor of the commit resolved by the
1766 .Qq eggs
1767 reference.
1769 .Qq :+
1771 .Qq :-
1772 modifier without a trailing integer has an implicit
1773 .Qq 1
1774 appended
1775 .Po e.g.,
1776 .Sy :base:+
1777 is equivalent to
1778 .Sy :base:+1
1779 .Pc .
1780 .It Fl l
1781 List all existing tags in the repository instead of creating a new tag.
1782 If a
1783 .Ar name
1784 argument is passed, show only the tag with the given
1785 .Ar name .
1786 .It Fl m Ar message
1787 Use the specified tag message when creating the new tag.
1788 Without the
1789 .Fl m
1790 option,
1791 .Cm got tag
1792 opens a temporary file in an editor where a tag message can be written.
1793 Quitting the editor without saving the file will abort the tag operation.
1794 .It Fl r Ar repository-path
1795 Use the repository at the specified path.
1796 If not specified, assume the repository is located at or above the current
1797 working directory.
1798 If this directory is a
1799 .Nm
1800 work tree, use the repository path associated with this work tree.
1801 .It Fl s Ar signer-id
1802 While creating a new tag, sign this tag with the identity given in
1803 .Ar signer-id .
1804 .Pp
1805 For SSH-based signatures,
1806 .Ar signer-id
1807 is the path to a file which may refer to either a private SSH key,
1808 or a public SSH key with the private half available via
1809 .Xr ssh-agent 1 .
1810 .Cm got tag
1811 will sign the tag object by invoking
1812 .Xr ssh-keygen 1
1813 with the
1814 .Fl Y Cm sign
1815 command, using the signature namespace
1816 .Dq git
1817 for compatibility with
1818 .Xr git 1 .
1819 .It Fl V
1820 Verify tag object signatures.
1821 If a
1822 .Ar name
1823 is specified, show and verify the tag object with the provided name.
1824 Otherwise, list all tag objects and verify signatures where present.
1825 .Pp
1826 .Cm got tag
1827 verifies SSH-based signatures by invoking
1828 .Xr ssh-keygen 1
1829 with the options
1830 .Fl Y Cm verify Fl f Ar allowed_signers .
1831 A path to the
1832 .Ar allowed_signers
1833 file must be set in
1834 .Xr got.conf 5 ,
1835 otherwise verification is impossible.
1836 .It Fl v
1837 Verbose mode.
1838 During SSH signature creation and verification this option will be passed to
1839 .Xr ssh-keygen 1 .
1840 Multiple -v options increase the verbosity.
1841 The maximum is 3.
1842 .El
1843 .Pp
1844 By design, the
1845 .Cm got tag
1846 command will not delete tags or change existing tags.
1847 If a tag must be deleted, the
1848 .Cm got ref
1849 command may be used to delete a tag's reference.
1850 This should only be done if the tag has not already been copied to
1851 another repository.
1852 .It Xo
1853 .Cm add
1854 .Op Fl IR
1855 .Ar path ...
1856 .Xc
1857 Schedule unversioned files in a work tree for addition to the
1858 repository in the next commit.
1859 By default, files which match a
1860 .Cm got status
1861 ignore pattern will not be added.
1862 .Pp
1863 If a
1864 .Ar path
1865 mentioned in the command line is not an unversioned file then
1866 .Cm got add
1867 may raise an error.
1868 To avoid unnecessary errors from paths picked up by file globbing patterns
1869 in the shell, paths in the argument list will be silently ignored if they
1870 are not reported by
1871 .Cm got status
1872 at all, or if they are reported with one of the following status codes
1873 and do not have changes staged via
1874 .Cm got stage :
1875 .Bl -column YXZ description
1876 .It M Ta modified file
1877 .It A Ta file scheduled for addition in next commit
1878 .It C Ta modified or added file which contains merge conflicts
1879 .It m Ta modified file modes (executable bit only)
1880 .El
1881 .Pp
1882 The options for
1883 .Cm got add
1884 are as follows:
1885 .Bl -tag -width Ds
1886 .It Fl I
1887 Add files even if they match a
1888 .Cm got status
1889 ignore pattern.
1890 .It Fl R
1891 Permit recursion into directories.
1892 If this option is not specified,
1893 .Cm got add
1894 will refuse to run if a specified
1895 .Ar path
1896 is a directory.
1897 .El
1898 .Tg rm
1899 .It Xo
1900 .Cm remove
1901 .Op Fl fkR
1902 .Op Fl s Ar status-codes
1903 .Ar path ...
1904 .Xc
1905 .Dl Pq alias: Cm rm
1906 Remove versioned files from a work tree and schedule them for deletion
1907 from the repository in the next commit.
1908 .Pp
1909 The options for
1910 .Cm got remove
1911 are as follows:
1912 .Bl -tag -width Ds
1913 .It Fl f
1914 Perform the operation even if a file contains local modifications,
1915 and do not raise an error if a specified
1916 .Ar path
1917 does not exist on disk.
1918 .It Fl k
1919 Keep affected files on disk.
1920 .It Fl R
1921 Permit recursion into directories.
1922 If this option is not specified,
1923 .Cm got remove
1924 will refuse to run if a specified
1925 .Ar path
1926 is a directory.
1927 .It Fl s Ar status-codes
1928 Only delete files with a modification status matching one of the
1929 single-character status codes contained in the
1930 .Ar status-codes
1931 argument.
1932 The following status codes may be specified:
1933 .Bl -column YXZ description
1934 .It M Ta modified file (this implies the
1935 .Fl f
1936 option)
1937 .It ! Ta versioned file expected on disk but missing
1938 .El
1939 .El
1940 .Tg pa
1941 .It Xo
1942 .Cm patch
1943 .Op Fl nR
1944 .Op Fl c Ar commit
1945 .Op Fl p Ar strip-count
1946 .Op Ar patchfile
1947 .Xc
1948 .Dl Pq alias: Cm pa
1949 Apply changes from
1950 .Ar patchfile
1951 to files in a work tree.
1952 Files added or removed by a patch will be scheduled for addition or removal in
1953 the work tree.
1954 .Pp
1955 The patch must be in the unified diff format as produced by
1956 .Cm got diff ,
1957 .Xr git-diff 1 ,
1958 or by
1959 .Xr diff 1
1960 and
1961 .Xr cvs 1
1962 diff when invoked with their
1963 .Fl u
1964 options.
1965 If no
1966 .Ar patchfile
1967 argument is provided, read unified diff data from standard input instead.
1968 .Pp
1969 If the
1970 .Ar patchfile
1971 contains multiple patches, then attempt to apply each of them in sequence.
1972 .Pp
1973 Show the status of each affected file, using the following status codes:
1974 .Bl -column XYZ description
1975 .It M Ta file was modified
1976 .It G Ta file was merged using a merge-base found in the repository
1977 .It C Ta file was merged and conflicts occurred during merge
1978 .It D Ta file was deleted
1979 .It A Ta file was added
1980 .It # Ta failed to patch the file
1981 .El
1982 .Pp
1983 If a change does not match at its exact line number, attempt to
1984 apply it somewhere else in the file if a good spot can be found.
1985 Otherwise, the patch will fail to apply.
1986 .Pp
1987 .Nm
1988 .Cm patch
1989 will refuse to apply a patch if certain preconditions are not met.
1990 Files to be deleted must already be under version control, and must
1991 not have been scheduled for deletion already.
1992 Files to be added must not yet be under version control and must not
1993 already be present on disk.
1994 Files to be modified must already be under version control and may not
1995 contain conflict markers.
1996 .Pp
1997 If an error occurs, the
1998 .Cm patch
1999 operation will be aborted.
2000 Any changes made to the work tree up to this point will be left behind.
2001 Such changes can be viewed with
2002 .Cm got diff
2003 and can be reverted with
2004 .Cm got revert
2005 if needed.
2006 .Pp
2007 The options for
2008 .Cm got patch
2009 are as follows:
2010 .Bl -tag -width Ds
2011 .It Fl c Ar commit
2012 Attempt to locate files within the specified
2013 .Ar commit
2014 for use as a merge-base for 3-way merges.
2015 .Pp
2016 If the
2017 .Fl c
2018 option is not used then
2019 .Cm got patch
2020 will attempt to locate merge-bases via object IDs found in
2021 .Ar patchfile
2022 meta-data, such as produced by
2023 .Cm got diff
2025 .Xr git-diff 1 .
2026 Use of the
2027 .Fl c
2028 option is only recommended in the absence of such meta-data.
2029 .Pp
2030 Ideally, the specified
2031 .Ar commit
2032 should contain versions of files which the changes contained in the
2033 .Ar patchfile
2034 were based on.
2035 Files will be located by path, relative to the repository root.
2036 If the
2037 .Fl p
2038 option is used then leading path components will be stripped
2039 before paths are looked up in the repository.
2040 .Pp
2041 In case no merge-base is available for a file, changes will be applied
2042 without doing a 3-way merge.
2043 Changes which do not apply cleanly may then be rejected entirely, rather
2044 than producing merge conflicts in the patched target file.
2045 .Pp
2046 The expected
2047 .Ar commit
2048 argument is a commit ID SHA1 hash, or a reference name or a keyword
2049 which will be resolved to a commit ID.
2050 An abbreviated hash argument will be expanded to a full SHA1 hash
2051 automatically, provided the abbreviation is unique.
2052 The keywords
2053 .Qq :base
2054 and
2055 .Qq :head
2056 resolve to the work tree's base commit and branch head, respectively.
2057 Keywords and references may be appended with
2058 .Qq :+
2060 .Qq :-
2061 modifiers and an optional integer N to denote the
2062 Nth descendant or antecedent by first parent traversal, respectively;
2063 for example,
2064 .Sy :head:-2
2065 denotes the work tree branch head's 2nd generation ancestor, and
2066 .Sy :base:+4
2067 denotes the 4th generation descendant of the work tree's base commit.
2068 Similarly,
2069 .Sy flan:+3
2070 will denote the 3rd generation descendant of the commit resolved by the
2071 .Qq flan
2072 reference.
2074 .Qq :+
2076 .Qq :-
2077 modifier without a trailing integer has an implicit
2078 .Qq 1
2079 appended
2080 .Po e.g.,
2081 .Sy :base:+
2082 is equivalent to
2083 .Sy :base:+1
2084 .Pc .
2085 .It Fl n
2086 Do not make any modifications to the work tree.
2087 This can be used to check whether a patch would apply without issues.
2088 If the
2089 .Ar patchfile
2090 contains diffs that affect the same file multiple times, the results
2091 displayed may be incorrect.
2092 .It Fl p Ar strip-count
2093 Specify the number of leading path components to strip from paths
2094 parsed from
2095 .Ar patchfile .
2096 If the
2097 .Fl p
2098 option is not used,
2099 .Sq a/
2100 and
2101 .Sq b/
2102 path prefixes generated by
2103 .Xr git-diff 1
2104 will be recognized and stripped automatically.
2105 .It Fl R
2106 Reverse the patch before applying it.
2107 .El
2108 .Tg rv
2109 .It Xo
2110 .Cm revert
2111 .Op Fl pR
2112 .Op Fl F Ar response-script
2113 .Ar path ...
2114 .Xc
2115 .Dl Pq alias: Cm rv
2116 Revert any local changes in files at the specified paths in a work tree.
2117 File contents will be overwritten with those contained in the
2118 work tree's base commit.
2119 There is no way to bring discarded changes back after
2120 .Cm got revert !
2121 .Pp
2122 If a file was added with
2123 .Cm got add ,
2124 it will become an unversioned file again.
2125 If a file was deleted with
2126 .Cm got remove ,
2127 it will be restored.
2128 .Pp
2129 The options for
2130 .Cm got revert
2131 are as follows:
2132 .Bl -tag -width Ds
2133 .It Fl F Ar response-script
2134 With the
2135 .Fl p
2136 option, read
2137 .Dq y ,
2138 .Dq n ,
2139 and
2140 .Dq q
2141 responses line-by-line from the specified
2142 .Ar response-script
2143 file instead of prompting interactively.
2144 .It Fl p
2145 Instead of reverting all changes in files, interactively select or reject
2146 changes to revert based on
2147 .Dq y
2148 (revert change),
2149 .Dq n
2150 (keep change), and
2151 .Dq q
2152 (quit reverting this file) responses.
2153 If a file is in modified status, individual patches derived from the
2154 modified file content can be reverted.
2155 Files in added or deleted status may only be reverted in their entirety.
2156 .It Fl R
2157 Permit recursion into directories.
2158 If this option is not specified,
2159 .Cm got revert
2160 will refuse to run if a specified
2161 .Ar path
2162 is a directory.
2163 .El
2164 .Tg ci
2165 .It Xo
2166 .Cm commit
2167 .Op Fl CNnS
2168 .Op Fl A Ar author
2169 .Op Fl F Ar path
2170 .Op Fl m Ar message
2171 .Op Ar path ...
2172 .Xc
2173 .Dl Pq alias: Cm ci
2174 Create a new commit in the repository from changes in a work tree
2175 and use this commit as the new base commit for the work tree.
2176 If no
2177 .Ar path
2178 is specified, commit all changes in the work tree.
2179 Otherwise, commit changes at or within the specified paths.
2180 .Pp
2181 If changes have been explicitly staged for commit with
2182 .Cm got stage ,
2183 only commit staged changes and reject any specified paths which
2184 have not been staged.
2185 .Pp
2186 .Cm got commit
2187 opens a temporary file in an editor where a log message can be written
2188 unless the
2189 .Fl m
2190 option is used
2191 or the
2192 .Fl F
2193 and
2194 .Fl N
2195 options are used together.
2196 Quitting the editor without saving the file will abort the commit operation.
2197 .Pp
2198 Show the status of each affected file, using the following status codes:
2199 .Bl -column YXZ description
2200 .It M Ta modified file
2201 .It D Ta file was deleted
2202 .It A Ta new file was added
2203 .It m Ta modified file modes (executable bit only)
2204 .El
2205 .Pp
2206 Files which are not part of the new commit will retain their previously
2207 recorded base commit.
2208 Some
2209 .Nm
2210 commands may refuse to run while the work tree contains files from
2211 multiple base commits.
2212 The base commit of such a work tree can be made consistent by running
2213 .Cm got update
2214 across the entire work tree.
2215 .Pp
2216 The
2217 .Cm got commit
2218 command requires the
2219 .Ev GOT_AUTHOR
2220 environment variable to be set,
2221 unless an author has been configured in
2222 .Xr got.conf 5
2223 or Git's
2224 .Dv user.name
2225 and
2226 .Dv user.email
2227 configuration settings can be
2228 obtained from the repository's
2229 .Pa .git/config
2230 file or from Git's global
2231 .Pa ~/.gitconfig
2232 configuration file.
2233 .Pp
2234 The options for
2235 .Cm got commit
2236 are as follows:
2237 .Bl -tag -width Ds
2238 .It Fl A Ar author
2239 Set author information in the newly created commit to
2240 .Ar author .
2241 This is useful when committing changes on behalf of someone else.
2242 The
2243 .Ar author
2244 argument must use the same format as the
2245 .Ev GOT_AUTHOR
2246 environment variable.
2247 .Pp
2248 In addition to storing author information, the newly created commit
2249 object will retain
2250 .Dq committer
2251 information which is obtained, as usual, from the
2252 .Ev GOT_AUTHOR
2253 environment variable, or
2254 .Xr got.conf 5 ,
2255 or Git configuration settings.
2256 .It Fl C
2257 Allow committing files in conflicted status.
2258 .Pp
2259 Committing files with conflict markers should generally be avoided.
2260 Cases where conflict markers must be stored in the repository for
2261 some legitimate reason should be very rare.
2262 There are usually ways to avoid storing conflict markers verbatim by
2263 applying appropriate programming tricks.
2264 .It Fl F Ar path
2265 Use the prepared log message stored in the file found at
2266 .Ar path
2267 when creating the new commit.
2268 .Cm got commit
2269 opens a temporary file in an editor where the prepared log message can be
2270 reviewed and edited further if needed.
2271 Cannot be used together with the
2272 .Fl m
2273 option.
2274 .It Fl m Ar message
2275 Use the specified log message when creating the new commit.
2276 Cannot be used together with the
2277 .Fl F
2278 option.
2279 .It Fl N
2280 This option prevents
2281 .Cm got commit
2282 from opening the commit message in an editor.
2283 It has no effect unless it is used together with the
2284 .Fl F
2285 option and is intended for non-interactive use such as scripting.
2286 .It Fl n
2287 This option prevents
2288 .Cm got commit
2289 from generating a diff of the to-be-committed changes in a temporary file
2290 which can be viewed while editing a commit message.
2291 .It Fl S
2292 Allow the addition of symbolic links which point outside of the path space
2293 that is under version control.
2294 By default,
2295 .Cm got commit
2296 will reject such symbolic links due to safety concerns.
2297 As a precaution,
2298 .Nm
2299 may decide to represent such a symbolic link as a regular file which contains
2300 the link's target path, rather than creating an actual symbolic link which
2301 points outside of the work tree.
2302 Use of this option is discouraged because external mechanisms such as
2303 .Dq make obj
2304 are better suited for managing symbolic links to paths not under
2305 version control.
2306 .El
2307 .Pp
2308 .Cm got commit
2309 will refuse to run if certain preconditions are not met.
2310 If the work tree's current branch is not in the
2311 .Dq refs/heads/
2312 reference namespace, new commits may not be created on this branch.
2313 Local changes may only be committed if they are based on file content
2314 found in the most recent commit on the work tree's branch.
2315 If a path is found to be out of date,
2316 .Cm got update
2317 must be used first in order to merge local changes with changes made
2318 in the repository.
2319 .Tg se
2320 .It Xo
2321 .Cm send
2322 .Op Fl afqTv
2323 .Op Fl b Ar branch
2324 .Op Fl d Ar branch
2325 .Op Fl r Ar repository-path
2326 .Op Fl t Ar tag
2327 .Op Ar remote-repository
2328 .Xc
2329 .Dl Pq alias: Cm se
2330 Send new changes to a remote repository.
2331 If no
2332 .Ar remote-repository
2333 is specified,
2334 .Dq origin
2335 will be used.
2336 The remote repository's URL is obtained from the corresponding entry in
2337 .Xr got.conf 5
2338 or Git's
2339 .Pa config
2340 file of the local repository, as created by
2341 .Cm got clone .
2342 .Pp
2343 All objects corresponding to new changes will be written to a temporary
2344 pack file which is then uploaded to the server.
2345 Upon success, references in the
2346 .Dq refs/remotes/
2347 reference namespace of the local repository will be updated to point at
2348 the commits which have been sent.
2349 .Pp
2350 By default, changes will only be sent if they are based on up-to-date
2351 copies of relevant branches in the remote repository.
2352 If any changes to be sent are based on out-of-date copies or would
2353 otherwise break linear history of existing branches, new changes must
2354 be fetched from the server with
2355 .Cm got fetch
2356 and local branches must be rebased with
2357 .Cm got rebase
2358 before
2359 .Cm got send
2360 can succeed.
2361 The
2362 .Fl f
2363 option can be used to make exceptions to these requirements.
2364 .Pp
2365 The options for
2366 .Cm got send
2367 are as follows:
2368 .Bl -tag -width Ds
2369 .It Fl a
2370 Send all branches from the local repository's
2371 .Dq refs/heads/
2372 reference namespace.
2373 The
2374 .Fl a
2375 option is equivalent to listing all branches with multiple
2376 .Fl b
2377 options.
2378 Cannot be used together with the
2379 .Fl b
2380 option.
2381 .It Fl b Ar branch
2382 Send the specified
2383 .Ar branch
2384 from the local repository's
2385 .Dq refs/heads/
2386 reference namespace.
2387 This option may be specified multiple times to build a list of branches
2388 to send.
2389 If this option is not specified, default to the work tree's current branch
2390 if invoked in a work tree, or to the repository's HEAD reference.
2391 Cannot be used together with the
2392 .Fl a
2393 option.
2394 .It Fl d Ar branch
2395 Delete the specified
2396 .Ar branch
2397 from the remote repository's
2398 .Dq refs/heads/
2399 reference namespace.
2400 This option may be specified multiple times to build a list of branches
2401 to delete.
2402 .Pp
2403 Only references are deleted.
2404 Any commit, tree, tag, and blob objects belonging to deleted branches
2405 may become subject to deletion by Git's garbage collector running on
2406 the server.
2407 .Pp
2408 Requesting deletion of branches results in an error if the server
2409 does not support this feature or disallows the deletion of branches
2410 based on its configuration.
2411 .It Fl f
2412 Attempt to force the server to overwrite existing branches or tags
2413 in the remote repository, even when
2414 .Cm got fetch
2415 followed by
2416 .Cm got rebase
2418 .Cm got merge
2419 would usually be required before changes can be sent.
2420 The server may reject forced requests regardless, depending on its
2421 configuration.
2422 .Pp
2423 Any commit, tree, tag, and blob objects belonging to overwritten branches
2424 or tags may become subject to deletion by Git's garbage collector running
2425 on the server.
2426 .Pp
2427 The
2428 .Dq refs/tags
2429 reference namespace is globally shared between all repositories.
2430 Use of the
2431 .Fl f
2432 option to overwrite tags is discouraged because it can lead to
2433 inconsistencies between the tags present in different repositories.
2434 In general, creating a new tag with a different name is recommended
2435 instead of overwriting an existing tag.
2436 .Pp
2437 Use of the
2438 .Fl f
2439 option is particularly discouraged if changes being sent are based
2440 on an out-of-date copy of a branch in the remote repository.
2441 Instead of using the
2442 .Fl f
2443 option, new changes should
2444 be fetched with
2445 .Cm got fetch
2446 and local branches should be rebased with
2447 .Cm got rebase
2448 or merged with
2449 .Cm got merge ,
2450 followed by another attempt to send the changes.
2451 .Pp
2452 The
2453 .Fl f
2454 option should only be needed in situations where the remote repository's
2455 copy of a branch or tag is known to be out-of-date and is considered
2456 disposable.
2457 The risks of creating inconsistencies between different repositories
2458 should also be taken into account.
2459 .It Fl q
2460 Suppress progress reporting output.
2461 The same option will be passed to
2462 .Xr ssh 1
2463 if applicable.
2464 .It Fl r Ar repository-path
2465 Use the repository at the specified path.
2466 If not specified, assume the repository is located at or above the current
2467 working directory.
2468 If this directory is a
2469 .Nm
2470 work tree, use the repository path associated with this work tree.
2471 .It Fl T
2472 Attempt to send all tags from the local repository's
2473 .Dq refs/tags/
2474 reference namespace.
2475 The
2476 .Fl T
2477 option is equivalent to listing all tags with multiple
2478 .Fl t
2479 options.
2480 Cannot be used together with the
2481 .Fl t
2482 option.
2483 .It Fl t Ar tag
2484 Send the specified
2485 .Ar tag
2486 from the local repository's
2487 .Dq refs/tags/
2488 reference namespace, in addition to any branches that are being sent.
2489 The
2490 .Fl t
2491 option may be specified multiple times to build a list of tags to send.
2492 No tags will be sent if the
2493 .Fl t
2494 option is not used.
2495 .Pp
2496 Raise an error if the specified
2497 .Ar tag
2498 already exists in the remote repository, unless the
2499 .Fl f
2500 option is used to overwrite the server's copy of the tag.
2501 In general, creating a new tag with a different name is recommended
2502 instead of overwriting an existing tag.
2503 .Pp
2504 Cannot be used together with the
2505 .Fl T
2506 option.
2507 .It Fl v
2508 Verbose mode.
2509 Causes
2510 .Cm got send
2511 to print debugging messages to standard error output.
2512 The same option will be passed to
2513 .Xr ssh 1
2514 if applicable.
2515 Multiple -v options increase the verbosity.
2516 The maximum is 3.
2517 .El
2518 .Tg cy
2519 .It Xo
2520 .Cm cherrypick
2521 .Op Fl lX
2522 .Op Ar commit
2523 .Xc
2524 .Dl Pq alias: Cm cy
2525 Merge changes from a single
2526 .Ar commit
2527 into the work tree.
2528 The specified
2529 .Ar commit
2530 should be on a different branch than the work tree's base commit.
2531 .Pp
2532 The expected argument is a commit ID SHA1 hash, or a reference name or
2533 keyword which will be resolved to a commit ID.
2534 An abbreviated hash argument will be expanded to a full SHA1 hash
2535 automatically, provided the abbreviation is unique.
2536 The keywords
2537 .Qq :base
2538 and
2539 .Qq :head
2540 resolve to the work tree's base commit and branch head, respectively.
2541 Keywords and references may be appended with
2542 .Qq :+
2544 .Qq :-
2545 modifiers and an optional integer N to denote the
2546 Nth descendant or antecedent by first parent traversal, respectively;
2547 for example,
2548 .Sy :head:-2
2549 denotes the work tree branch head's 2nd generation ancestor, and
2550 .Sy :base:+4
2551 denotes the 4th generation descendant of the work tree's base commit.
2552 Similarly,
2553 .Sy barbaz:+3
2554 will denote the 3rd generation descendant of the commit resolved by the
2555 .Qq barbaz
2556 reference.
2558 .Qq :+
2560 .Qq :-
2561 modifier without a trailing integer has an implicit
2562 .Qq 1
2563 appended
2564 .Po e.g.,
2565 .Sy :base:+
2566 is equivalent to
2567 .Sy :base:+1
2568 .Pc .
2569 .Pp
2570 Show the status of each affected file, using the following status codes:
2571 .Bl -column YXZ description
2572 .It G Ta file was merged
2573 .It C Ta file was merged and conflicts occurred during merge
2574 .It ! Ta changes destined for a missing file were not merged
2575 .It D Ta file was deleted
2576 .It d Ta file's deletion was prevented by local modifications
2577 .It A Ta new file was added
2578 .It \(a~ Ta changes destined for a non-regular file were not merged
2579 .It ? Ta changes destined for an unversioned file were not merged
2580 .El
2581 .Pp
2582 The merged changes will appear as local changes in the work tree, which
2583 may be viewed with
2584 .Cm got diff ,
2585 amended manually or with further
2586 .Cm got cherrypick
2587 commands,
2588 committed with
2589 .Cm got commit .
2590 .Pp
2591 If invoked in a work tree where no
2592 .Cm rebase ,
2593 .Cm histedit ,
2595 .Cm merge
2596 operation is taking place,
2597 .Cm got cherrypick
2598 creates a record of commits which have been merged into the work tree.
2599 When a file changed by
2600 .Cm got cherrypick
2601 is committed with
2602 .Cm got commit ,
2603 the log messages of relevant merged commits will then appear in the editor,
2604 where the messages should be further adjusted to convey the reasons for
2605 cherrypicking the changes.
2606 Upon exiting the editor, if the time stamp of the log message file
2607 is unchanged or the log message is empty,
2608 .Cm got commit
2609 will fail with an unmodified or empty log message error.
2610 .Pp
2611 If all the changes in all files touched by a given commit are discarded,
2612 e.g. with
2613 .Cm got revert ,
2614 this commit's log message record will also disappear.
2615 .Pp
2616 .Cm got cherrypick
2617 will refuse to run if certain preconditions are not met.
2618 If the work tree contains multiple base commits, it must first be updated
2619 to a single base commit with
2620 .Cm got update .
2621 If any relevant files already contain merge conflicts, these
2622 conflicts must be resolved first.
2623 .Pp
2624 The options for
2625 .Nm
2626 .Cm cherrypick
2627 are as follows:
2628 .Bl -tag -width Ds
2629 .It Fl l
2630 Display a list of commit log messages recorded by cherrypick operations,
2631 represented by references in the
2632 .Dq refs/got/worktree
2633 reference namespace.
2634 If a
2635 .Ar commit
2636 is specified, only show the log message of the specified commit.
2637 .Pp
2638 If invoked in a work tree, only log messages recorded by cherrypick operations
2639 in the current work tree will be displayed.
2640 Otherwise, all commit log messages will be displayed irrespective of the
2641 work tree in which they were created.
2642 This option cannot be used with
2643 .Fl X .
2644 .It Fl X
2645 Delete log messages created by previous cherrypick operations, represented by
2646 references in the
2647 .Dq refs/got/worktree
2648 reference namespace.
2649 If a
2650 .Ar commit
2651 is specified, only delete the log message of the specified commit.
2652 .Pp
2653 If invoked in a work tree, only log messages recorded by cherrypick operations
2654 in the current work tree will be deleted.
2655 Otherwise, all commit log messages will be deleted irrespective of the
2656 work tree in which they were created.
2657 This option cannot be used with
2658 .Fl l .
2659 .El
2660 .Pp
2661 .Tg bo
2662 .It Xo
2663 .Cm backout
2664 .Op Fl lX
2665 .Op Ar commit
2666 .Xc
2667 .Dl Pq alias: Cm bo
2668 Reverse-merge changes from a single
2669 .Ar commit
2670 into the work tree.
2671 The specified
2672 .Ar commit
2673 should be on the same branch as the work tree's base commit.
2674 .Pp
2675 The expected argument is a commit ID SHA1 hash, or a reference name
2676 or keyword which will be resolved to a commit ID.
2677 An abbreviated hash argument will be expanded to a full SHA1 hash
2678 automatically, provided the abbreviation is unique.
2679 The keywords
2680 .Qq :base
2681 and
2682 .Qq :head
2683 resolve to the work tree's base commit and branch head, respectively.
2684 Keywords and references may be appended with
2685 .Qq :+
2687 .Qq :-
2688 modifiers and an optional integer N to denote the
2689 Nth descendant or antecedent by first parent traversal, respectively;
2690 for example,
2691 .Sy :head:-2
2692 denotes the work tree branch head's 2nd generation ancestor, and
2693 .Sy :base:+4
2694 denotes the 4th generation descendant of the work tree's base commit.
2695 Similarly,
2696 .Sy wip:+5
2697 will denote the 5th generation descendant of the commit resolved by the
2698 .Qq wip
2699 reference.
2701 .Qq :+
2703 .Qq :-
2704 modifier without a trailing integer has an implicit
2705 .Qq 1
2706 appended
2707 .Po e.g.,
2708 .Sy :base:+
2709 is equivalent to
2710 .Sy :base:+1
2711 .Pc .
2712 .Pp
2713 Show the status of each affected file, using the following status codes:
2714 .Bl -column YXZ description
2715 .It G Ta file was merged
2716 .It C Ta file was merged and conflicts occurred during merge
2717 .It ! Ta changes destined for a missing file were not merged
2718 .It D Ta file was deleted
2719 .It d Ta file's deletion was prevented by local modifications
2720 .It A Ta new file was added
2721 .It \(a~ Ta changes destined for a non-regular file were not merged
2722 .It ? Ta changes destined for an unversioned file were not merged
2723 .El
2724 .Pp
2725 The reverse-merged changes will appear as local changes in the work tree,
2726 which may be viewed with
2727 .Cm got diff ,
2728 amended manually or with further
2729 .Cm got backout
2730 commands,
2731 committed with
2732 .Cm got commit .
2733 .Pp
2734 If invoked in a work tree where no
2735 .Cm rebase ,
2736 .Cm histedit ,
2738 .Cm merge
2739 operation is taking place,
2740 .Cm got backout
2741 creates a record of commits which have been reverse-merged into the work tree.
2742 When a file changed by
2743 .Cm got backout
2744 is committed with
2745 .Cm got commit ,
2746 the log messages of relevant reverse-merged commits will then appear in
2747 the editor, where the messages should be further adjusted to convey the
2748 reasons for backing out the changes.
2749 Upon exiting the editor, if the time stamp of the log message file
2750 is unchanged or the log message is empty,
2751 .Cm got commit
2752 will fail with an unmodified or empty log message error.
2753 .Pp
2754 If all the changes in all files touched by a given commit are discarded,
2755 e.g. with
2756 .Cm got revert ,
2757 this commit's log message record will also disappear.
2758 .Pp
2759 .Cm got backout
2760 will refuse to run if certain preconditions are not met.
2761 If the work tree contains multiple base commits, it must first be updated
2762 to a single base commit with
2763 .Cm got update .
2764 If any relevant files already contain merge conflicts, these
2765 conflicts must be resolved first.
2766 .Pp
2767 The options for
2768 .Nm
2769 .Cm backout
2770 are as follows:
2771 .Bl -tag -width Ds
2772 .It Fl l
2773 Display a list of commit log messages recorded by backout operations,
2774 represented by references in the
2775 .Dq refs/got/worktree
2776 reference namespace.
2777 If a
2778 .Ar commit
2779 is specified, only show the log message of the specified commit.
2780 .Pp
2781 If invoked in a work tree, only log messages recorded by backout operations
2782 in the current work tree will be displayed.
2783 Otherwise, all commit log messages will be displayed irrespective of the
2784 work tree in which they were created.
2785 This option cannot be used with
2786 .Fl X .
2787 .It Fl X
2788 Delete log messages created by previous backout operations, represented by
2789 references in the
2790 .Dq refs/got/worktree
2791 reference namespace.
2792 If a
2793 .Ar commit
2794 is specified, only delete the log message of the specified commit.
2795 .Pp
2796 If invoked in a work tree, only log messages recorded by backout operations
2797 in the current work tree will be deleted.
2798 Otherwise, all commit log messages will be deleted irrespective of the
2799 work tree in which they were created.
2800 This option cannot be used with
2801 .Fl l .
2802 .El
2803 .Pp
2804 .Tg rb
2805 .It Xo
2806 .Cm rebase
2807 .Op Fl aCclX
2808 .Op Ar branch
2809 .Xc
2810 .Dl Pq alias: Cm rb
2811 Rebase commits on the specified
2812 .Ar branch
2813 onto the tip of the current branch of the work tree.
2814 The
2815 .Ar branch
2816 must share common ancestry with the work tree's current branch.
2817 Rebasing begins with the first descendant commit of the youngest
2818 common ancestor commit shared by the specified
2819 .Ar branch
2820 and the work tree's current branch, and stops once the tip commit
2821 of the specified
2822 .Ar branch
2823 has been rebased.
2824 .Pp
2825 When
2826 .Cm got rebase
2827 is used as intended, the specified
2828 .Ar branch
2829 represents a local commit history and may already contain changes
2830 that are not yet visible in any other repositories.
2831 The work tree's current branch, which must be set with
2832 .Cm got update -b
2833 before starting the
2834 .Cm rebase
2835 operation, represents a branch from a remote repository which shares
2836 a common history with the specified
2837 .Ar branch
2838 but has progressed, and perhaps diverged, due to commits added to the
2839 remote repository.
2840 .Pp
2841 Rebased commits are accumulated on a temporary branch which the work tree
2842 will remain switched to throughout the entire rebase operation.
2843 Commits on this branch represent the same changes with the same log
2844 messages as their counterparts on the original
2845 .Ar branch ,
2846 but with different commit IDs.
2847 Once rebasing has completed successfully, the temporary branch becomes
2848 the new version of the specified
2849 .Ar branch
2850 and the work tree is automatically switched to it.
2851 If author information is available via the
2852 .Ev GOT_AUTHOR
2853 environment variable,
2854 .Xr got.conf 5
2855 or Git's
2856 .Dv user.name
2857 and
2858 .Dv user.email
2859 configuration settings, this author information will be used to identify
2860 the
2861 .Dq committer
2862 of rebased commits.
2863 .Pp
2864 Old commits in their pre-rebase state are automatically backed up in the
2865 .Dq refs/got/backup/rebase
2866 reference namespace.
2867 As long as these references are not removed older versions of rebased
2868 commits will remain in the repository and can be viewed with the
2869 .Cm got rebase -l
2870 command.
2871 Removal of these references makes objects which become unreachable via
2872 any reference subject to removal by Git's garbage collector or
2873 .Cm gotadmin cleanup .
2874 .Pp
2875 While rebasing commits, show the status of each affected file,
2876 using the following status codes:
2877 .Bl -column YXZ description
2878 .It G Ta file was merged
2879 .It C Ta file was merged and conflicts occurred during merge
2880 .It ! Ta changes destined for a missing file were not merged
2881 .It D Ta file was deleted
2882 .It d Ta file's deletion was prevented by local modifications
2883 .It A Ta new file was added
2884 .It \(a~ Ta changes destined for a non-regular file were not merged
2885 .It ? Ta changes destined for an unversioned file were not merged
2886 .El
2887 .Pp
2888 If merge conflicts occur, the rebase operation is interrupted and may
2889 be continued once conflicts have been resolved.
2890 If any files with destined changes are found to be missing or unversioned,
2891 or if files could not be deleted due to differences in deleted content,
2892 the rebase operation will be interrupted to prevent potentially incomplete
2893 changes from being committed to the repository without user intervention.
2894 The work tree may be modified as desired and the rebase operation can be
2895 continued once the changes present in the work tree are considered complete.
2896 Alternatively, the rebase operation may be aborted which will leave
2897 .Ar branch
2898 unmodified and the work tree switched back to its original branch.
2899 .Pp
2900 If a merge conflict is resolved in a way which renders the merged
2901 change into a no-op change, the corresponding commit will be elided
2902 when the rebase operation continues.
2903 .Pp
2904 .Cm got rebase
2905 will refuse to run if certain preconditions are not met.
2906 If the
2907 .Ar branch
2908 is not in the
2909 .Dq refs/heads/
2910 reference namespace, the branch may not be rebased.
2911 If the work tree is not yet fully updated to the tip commit of its
2912 branch, then the work tree must first be updated with
2913 .Cm got update .
2914 If changes have been staged with
2915 .Cm got stage ,
2916 these changes must first be committed with
2917 .Cm got commit
2918 or unstaged with
2919 .Cm got unstage .
2920 If the work tree contains local changes, these changes must first be
2921 committed with
2922 .Cm got commit
2923 or reverted with
2924 .Cm got revert .
2925 If the
2926 .Ar branch
2927 contains changes to files outside of the work tree's path prefix,
2928 the work tree cannot be used to rebase this branch.
2929 .Pp
2930 The
2931 .Cm got update ,
2932 .Cm got integrate ,
2933 .Cm got merge ,
2934 .Cm got commit ,
2935 and
2936 .Cm got histedit
2937 commands will refuse to run while a rebase operation is in progress.
2938 Other commands which manipulate the work tree may be used for
2939 conflict resolution purposes.
2940 .Pp
2941 If the specified
2942 .Ar branch
2943 is already based on the work tree's current branch, then no commits
2944 need to be rebased and
2945 .Cm got rebase
2946 will simply switch the work tree to the specified
2947 .Ar branch
2948 and update files in the work tree accordingly.
2949 .Pp
2950 The options for
2951 .Cm got rebase
2952 are as follows:
2953 .Bl -tag -width Ds
2954 .It Fl a
2955 Abort an interrupted rebase operation.
2956 If this option is used, no other command-line arguments are allowed.
2957 .It Fl C
2958 Allow a rebase operation to continue with files in conflicted status.
2959 This option should generally be avoided, and can only be used with the
2960 .Fl c
2961 option.
2962 .It Fl c
2963 Continue an interrupted rebase operation.
2964 If this option is used, no other command-line arguments are allowed except
2965 .Fl C .
2966 .It Fl l
2967 Show a list of past rebase operations, represented by references in the
2968 .Dq refs/got/backup/rebase
2969 reference namespace.
2970 .Pp
2971 Display the author, date, and log message of each backed up commit,
2972 the object ID of the corresponding post-rebase commit, and
2973 the object ID of their common ancestor commit.
2974 Given these object IDs,
2975 the
2976 .Cm got log
2977 command with the
2978 .Fl c
2979 and
2980 .Fl x
2981 options can be used to examine the history of either version of the branch,
2982 and the
2983 .Cm got branch
2984 command with the
2985 .Fl c
2986 option can be used to create a new branch from a pre-rebase state if desired.
2987 .Pp
2988 If a
2989 .Ar branch
2990 is specified, only show commits which at some point in time represented this
2991 branch.
2992 Otherwise, list all backed up commits for any branches.
2993 .Pp
2994 If this option is used,
2995 .Cm got rebase
2996 does not require a work tree.
2997 None of the other options can be used together with
2998 .Fl l .
2999 .It Fl X
3000 Delete backups created by past rebase operations, represented by references
3001 in the
3002 .Dq refs/got/backup/rebase
3003 reference namespace.
3004 .Pp
3005 If a
3006 .Ar branch
3007 is specified, only delete backups which at some point in time represented
3008 this branch.
3009 Otherwise, delete all references found within
3010 .Dq refs/got/backup/rebase .
3011 .Pp
3012 Any commit, tree, tag, and blob objects belonging to deleted backups
3013 remain in the repository and may be removed separately with
3014 Git's garbage collector or
3015 .Cm gotadmin cleanup .
3016 .Pp
3017 If this option is used,
3018 .Cm got rebase
3019 does not require a work tree.
3020 None of the other options can be used together with
3021 .Fl X .
3022 .El
3023 .Tg he
3024 .It Xo
3025 .Cm histedit
3026 .Op Fl aCcdeflmX
3027 .Op Fl F Ar histedit-script
3028 .Op Ar branch
3029 .Xc
3030 .Dl Pq alias: Cm he
3031 Edit commit history between the work tree's current base commit and
3032 the tip commit of the work tree's current branch.
3033 .Pp
3034 The
3035 .Cm got histedit
3036 command requires the
3037 .Ev GOT_AUTHOR
3038 environment variable to be set,
3039 unless an author has been configured in
3040 .Xr got.conf 5
3041 or Git's
3042 .Dv user.name
3043 and
3044 .Dv user.email
3045 configuration settings can be obtained from the repository's
3046 .Pa .git/config
3047 file or from Git's global
3048 .Pa ~/.gitconfig
3049 configuration file.
3050 .Pp
3051 Before starting a
3052 .Cm histedit
3053 operation, the work tree's current branch must be set with
3054 .Cm got update -b
3055 to the branch which should be edited, unless this branch is already the
3056 current branch of the work tree.
3057 The tip of this branch represents the upper bound (inclusive) of commits
3058 touched by the
3059 .Cm histedit
3060 operation.
3061 .Pp
3062 Furthermore, the work tree's base commit
3063 must be set with
3064 .Cm got update -c
3065 to a point in this branch's commit history where editing should begin.
3066 This commit represents the lower bound (non-inclusive) of commits touched
3067 by the
3068 .Cm histedit
3069 operation.
3070 .Pp
3071 Editing of commit history is controlled via a
3072 .Ar histedit script
3073 which can be written in an editor based on a template, passed on the
3074 command line, or generated with the
3075 .Fl d ,
3076 .Fl e ,
3077 .Fl f ,
3079 .Fl m
3080 options.
3081 Quitting the editor without saving the file will abort the histedit operation.
3082 .Pp
3083 The format of the histedit script is line-based.
3084 Each line in the script begins with a command name, followed by
3085 whitespace and an argument.
3086 For most commands, the expected argument is a commit ID SHA1 hash.
3087 Any remaining text on the line is ignored.
3088 Lines which begin with the
3089 .Sq #
3090 character are ignored entirely.
3091 .Pp
3092 The available histedit script commands are as follows:
3093 .Bl -column YXZ pick-commit
3094 .It Cm pick Ar commit Ta Use the specified commit as it is.
3095 .It Cm edit Ar commit Ta Apply the changes from the specified commit, but
3096 then interrupt the histedit operation for amending, without creating a commit.
3097 While the histedit operation is interrupted arbitrary files may be edited,
3098 and commands which manipulate the work tree can be used freely.
3099 The
3100 .Cm got add
3101 and
3102 .Cm got remove
3103 commands can be used to add new files or remove existing ones.
3104 The
3105 .Cm got revert -p
3106 command can be used to eliminate arbitrary changes from files in the work tree.
3107 The
3108 .Cm got stage -p
3109 command may be used to prepare a subset of changes for inclusion in the
3110 next commit.
3111 Finally, the
3112 .Cm got commit
3113 command can be used to insert arbitrary commits into the edited history.
3114 Regular editing of history must eventually be resumed by running
3115 .Cm got histedit -c .
3116 .It Cm fold Ar commit Ta Combine the specified commit with the next commit
3117 listed further below that will be used.
3118 .It Cm drop Ar commit Ta Remove this commit from the edited history.
3119 .It Cm mesg Ar commit Ta Open an editor to create a new log message for this
3120 commit.
3121 .El
3122 .Pp
3123 Every commit in the history being edited must be mentioned in the script.
3124 Lines may be re-ordered to change the order of commits in the edited history.
3125 No commit may be listed more than once.
3126 .Pp
3127 Edited commits are accumulated on a temporary branch which the work tree
3128 will remain switched to throughout the entire histedit operation.
3129 Once history editing has completed successfully, the temporary branch becomes
3130 the new version of the work tree's branch and the work tree is automatically
3131 switched to it.
3132 .Pp
3133 Old commits in their pre-histedit state are automatically backed up in the
3134 .Dq refs/got/backup/histedit
3135 reference namespace.
3136 As long as these references are not removed older versions of edited
3137 commits will remain in the repository and can be viewed with the
3138 .Cm got histedit -l
3139 command.
3140 Removal of these references makes objects which become unreachable via
3141 any reference subject to removal by Git's garbage collector or
3142 .Cm gotadmin cleanup .
3143 .Pp
3144 While merging commits, show the status of each affected file,
3145 using the following status codes:
3146 .Bl -column YXZ description
3147 .It G Ta file was merged
3148 .It C Ta file was merged and conflicts occurred during merge
3149 .It ! Ta changes destined for a missing file were not merged
3150 .It D Ta file was deleted
3151 .It d Ta file's deletion was prevented by local modifications
3152 .It A Ta new file was added
3153 .It \(a~ Ta changes destined for a non-regular file were not merged
3154 .It ? Ta changes destined for an unversioned file were not merged
3155 .El
3156 .Pp
3157 If merge conflicts occur, the histedit operation is interrupted and may
3158 be continued once conflicts have been resolved.
3159 If any files with destined changes are found to be missing or unversioned,
3160 or if files could not be deleted due to differences in deleted content,
3161 the histedit operation will be interrupted to prevent potentially incomplete
3162 changes from being committed to the repository without user intervention.
3163 The work tree may be modified as desired and the histedit operation can be
3164 continued once the changes present in the work tree are considered complete.
3165 Alternatively, the histedit operation may be aborted which will leave
3166 the work tree switched back to its original branch.
3167 .Pp
3168 If a merge conflict is resolved in a way which renders the merged
3169 change into a no-op change, the corresponding commit will be elided
3170 when the histedit operation continues.
3171 .Pp
3172 .Cm got histedit
3173 will refuse to run if certain preconditions are not met.
3174 If the work tree's current branch is not in the
3175 .Dq refs/heads/
3176 reference namespace, the history of the branch may not be edited.
3177 If the work tree contains multiple base commits, it must first be updated
3178 to a single base commit with
3179 .Cm got update .
3180 If changes have been staged with
3181 .Cm got stage ,
3182 these changes must first be committed with
3183 .Cm got commit
3184 or unstaged with
3185 .Cm got unstage .
3186 If the work tree contains local changes, these changes must first be
3187 committed with
3188 .Cm got commit
3189 or reverted with
3190 .Cm got revert .
3191 If the edited history contains changes to files outside of the work tree's
3192 path prefix, the work tree cannot be used to edit the history of this branch.
3193 .Pp
3194 The
3195 .Cm got update ,
3196 .Cm got rebase ,
3197 .Cm got merge ,
3198 and
3199 .Cm got integrate
3200 commands will refuse to run while a histedit operation is in progress.
3201 Other commands which manipulate the work tree may be used, and the
3202 .Cm got commit
3203 command may be used to commit arbitrary changes to the temporary branch
3204 while the histedit operation is interrupted.
3205 .Pp
3206 The options for
3207 .Cm got histedit
3208 are as follows:
3209 .Bl -tag -width Ds
3210 .It Fl a
3211 Abort an interrupted histedit operation.
3212 If this option is used, no other command-line arguments are allowed.
3213 .It Fl C
3214 Allow a histedit operation to continue with files in conflicted status.
3215 This option should generally be avoided, and can only be used with the
3216 .Fl c
3217 option.
3218 .It Fl c
3219 Continue an interrupted histedit operation.
3220 If this option is used, no other command-line arguments are allowed except
3221 .Fl C .
3222 .It Fl d
3223 Drop all commits.
3224 This option is a quick equivalent to a histedit script which drops all
3225 commits.
3226 The
3227 .Fl d
3228 option can only be used when starting a new histedit operation.
3229 If this option is used, no other command-line arguments are allowed.
3230 .It Fl e
3231 Interrupt the histedit operation for editing after merging each commit.
3232 This option is a quick equivalent to a histedit script which uses the
3233 .Cm edit
3234 command for all commits.
3235 The
3236 .Fl e
3237 option can only be used when starting a new histedit operation.
3238 If this option is used, no other command-line arguments are allowed.
3239 .It Fl F Ar histedit-script
3240 Use the specified
3241 .Ar histedit-script
3242 instead of opening a temporary file in an editor where a histedit script
3243 can be written.
3244 .It Fl f
3245 Fold all commits into a single commit.
3246 This option is a quick equivalent to a histedit script which folds all
3247 commits, combining them all into one commit.
3248 The
3249 .Fl f
3250 option can only be used when starting a new histedit operation.
3251 If this option is used, no other command-line arguments are allowed.
3252 .It Fl l
3253 Show a list of past histedit operations, represented by references in the
3254 .Dq refs/got/backup/histedit
3255 reference namespace.
3256 .Pp
3257 Display the author, date, and log message of each backed up commit,
3258 the object ID of the corresponding post-histedit commit, and
3259 the object ID of their common ancestor commit.
3260 Given these object IDs,
3261 the
3262 .Cm got log
3263 command with the
3264 .Fl c
3265 and
3266 .Fl x
3267 options can be used to examine the history of either version of the branch,
3268 and the
3269 .Cm got branch
3270 command with the
3271 .Fl c
3272 option can be used to create a new branch from a pre-histedit state if desired.
3273 .Pp
3274 If a
3275 .Ar branch
3276 is specified, only show commits which at some point in time represented this
3277 branch.
3278 Otherwise, list all backed up commits for any branches.
3279 .Pp
3280 If this option is used,
3281 .Cm got histedit
3282 does not require a work tree.
3283 None of the other options can be used together with
3284 .Fl l .
3285 .It Fl m
3286 Edit log messages only.
3287 This option is a quick equivalent to a histedit script which edits
3288 only log messages but otherwise leaves every picked commit as-is.
3289 The
3290 .Fl m
3291 option can only be used when starting a new histedit operation.
3292 If this option is used, no other command-line arguments are allowed.
3293 .It Fl X
3294 Delete backups created by past histedit operations, represented by references
3295 in the
3296 .Dq refs/got/backup/histedit
3297 reference namespace.
3298 .Pp
3299 If a
3300 .Ar branch
3301 is specified, only delete backups which at some point in time represented
3302 this branch.
3303 Otherwise, delete all references found within
3304 .Dq refs/got/backup/histedit .
3305 .Pp
3306 Any commit, tree, tag, and blob objects belonging to deleted backups
3307 remain in the repository and may be removed separately with
3308 Git's garbage collector or
3309 .Cm gotadmin cleanup .
3310 .Pp
3311 If this option is used,
3312 .Cm got histedit
3313 does not require a work tree.
3314 None of the other options can be used together with
3315 .Fl X .
3316 .El
3317 .Tg ig
3318 .It Cm integrate Ar branch
3319 .Dl Pq alias: Cm ig
3320 Integrate the specified
3321 .Ar branch
3322 into the work tree's current branch.
3323 Files in the work tree are updated to match the contents on the integrated
3324 .Ar branch ,
3325 and the reference of the work tree's branch is changed to point at the
3326 head commit of the integrated
3327 .Ar branch .
3328 .Pp
3329 Both branches can be considered equivalent after integration since they
3330 will be pointing at the same commit.
3331 Both branches remain available for future work, if desired.
3332 In case the integrated
3333 .Ar branch
3334 is no longer needed it may be deleted with
3335 .Cm got branch -d .
3336 .Pp
3337 Show the status of each affected file, using the following status codes:
3338 .Bl -column YXZ description
3339 .It U Ta file was updated
3340 .It D Ta file was deleted
3341 .It A Ta new file was added
3342 .It \(a~ Ta versioned file is obstructed by a non-regular file
3343 .It ! Ta a missing versioned file was restored
3344 .El
3345 .Pp
3346 .Cm got integrate
3347 will refuse to run if certain preconditions are not met.
3348 Most importantly, the
3349 .Ar branch
3350 must have been rebased onto the work tree's current branch with
3351 .Cm got rebase
3352 before it can be integrated, in order to linearize commit history and
3353 resolve merge conflicts.
3354 If the work tree contains multiple base commits, it must first be updated
3355 to a single base commit with
3356 .Cm got update .
3357 If changes have been staged with
3358 .Cm got stage ,
3359 these changes must first be committed with
3360 .Cm got commit
3361 or unstaged with
3362 .Cm got unstage .
3363 If the work tree contains local changes, these changes must first be
3364 committed with
3365 .Cm got commit
3366 or reverted with
3367 .Cm got revert .
3368 .Tg mg
3369 .It Xo
3370 .Cm merge
3371 .Op Fl aCcMn
3372 .Op Ar branch
3373 .Xc
3374 .Dl Pq alias: Cm mg
3375 Merge the specified
3376 .Ar branch
3377 into the current branch of the work tree.
3378 If the branches have diverged, merge changes into the work tree
3379 and create a merge commit.
3380 Otherwise, if the specified
3381 .Ar branch
3382 is already based on the work tree's current branch, make the work tree's
3383 current branch equivalent to the specified
3384 .Ar branch
3385 and update files in the work tree accordingly.
3386 .Pp
3387 Merge commits are commits based on multiple parent commits.
3388 The tip commit of the work tree's current branch will be used as the
3389 first parent.
3390 The tip commit of the specified
3391 .Ar branch
3392 will be used as the second parent.
3393 The work tree's current branch
3394 must be in the
3395 .Dq refs/heads/
3396 reference namespace and can be set with
3397 .Cm got update -b
3398 before starting the
3399 .Cm merge
3400 operation.
3401 .Pp
3402 No ancestral relationship between the two branches is required.
3403 If the two branches have already been merged previously, only new changes
3404 will be merged.
3405 .Pp
3406 It is not possible to create merge commits with more than two parents.
3407 If more than one branch needs to be merged, then multiple merge commits
3408 with two parents each can be created in sequence.
3409 .Pp
3410 If a linear project history is desired, then use of
3411 .Cm got rebase
3412 should generally be preferred over
3413 .Cm got merge .
3414 However, even strictly linear projects may require occasional merge commits,
3415 for example in order to merge in new versions of third-party code stored
3417 .Dq vendor
3418 branches created with
3419 .Cm got import .
3420 .Pp
3421 While merging changes found on the
3422 .Ar branch
3423 into the work tree, show the status of each affected file,
3424 using the following status codes:
3425 .Bl -column YXZ description
3426 .It G Ta file was merged
3427 .It C Ta file was merged and conflicts occurred during merge
3428 .It ! Ta changes destined for a missing file were not merged
3429 .It D Ta file was deleted
3430 .It d Ta file's deletion was prevented by local modifications
3431 .It A Ta new file was added
3432 .It \(a~ Ta changes destined for a non-regular file were not merged
3433 .It ? Ta changes destined for an unversioned file were not merged
3434 .El
3435 .Pp
3436 If merge conflicts occur, the merge operation is interrupted and conflicts
3437 must be resolved before the merge operation can continue.
3438 If any files with destined changes are found to be missing or unversioned,
3439 or if files could not be deleted due to differences in deleted content,
3440 the merge operation will be interrupted to prevent potentially incomplete
3441 changes from being committed to the repository without user intervention.
3442 The work tree may be modified as desired and the merge can be continued
3443 once the changes present in the work tree are considered complete.
3444 Alternatively, the merge operation may be aborted which will leave
3445 the work tree's current branch unmodified.
3446 .Pp
3447 .Cm got merge
3448 will refuse to run if certain preconditions are not met.
3449 If the work tree's current branch is not in the
3450 .Dq refs/heads/
3451 reference namespace then the work tree must first be switched to a
3452 branch in the
3453 .Dq refs/heads/
3454 namespace with
3455 .Cm got update -b .
3456 If the work tree is not yet fully updated to the tip commit of its
3457 branch, then the work tree must first be updated with
3458 .Cm got update .
3459 If the work tree contains multiple base commits, it must first be updated
3460 to a single base commit with
3461 .Cm got update .
3462 If changes have been staged with
3463 .Cm got stage ,
3464 these changes must first be committed with
3465 .Cm got commit
3466 or unstaged with
3467 .Cm got unstage .
3468 If the work tree contains local changes, these changes must first be
3469 committed with
3470 .Cm got commit
3471 or reverted with
3472 .Cm got revert .
3473 If the
3474 .Ar branch
3475 contains changes to files outside of the work tree's path prefix,
3476 the work tree cannot be used to merge this branch.
3477 .Pp
3478 The
3479 .Cm got update ,
3480 .Cm got commit ,
3481 .Cm got rebase ,
3482 .Cm got histedit ,
3483 .Cm got integrate ,
3484 and
3485 .Cm got stage
3486 commands will refuse to run while a merge operation is in progress.
3487 Other commands which manipulate the work tree may be used for
3488 conflict resolution purposes.
3489 .Pp
3490 The options for
3491 .Cm got merge
3492 are as follows:
3493 .Bl -tag -width Ds
3494 .It Fl a
3495 Abort an interrupted merge operation.
3496 If this option is used, no other command-line arguments are allowed.
3497 .It Fl C
3498 Allow a merge operation to continue with files in conflicted status.
3499 This option should generally be avoided, and can only be used with the
3500 .Fl c
3501 option.
3502 .It Fl c
3503 Continue an interrupted merge operation.
3504 If this option is used, no other command-line arguments are allowed except
3505 .Fl C .
3506 .It Fl M
3507 Create a merge commit even if the branches have not diverged.
3508 .It Fl n
3509 Merge changes into the work tree as usual but do not create a merge
3510 commit immediately.
3511 The merge result can be adjusted as desired before a merge commit is
3512 created with
3513 .Cm got merge -c .
3514 Alternatively, the merge may be aborted with
3515 .Cm got merge -a .
3516 .El
3517 .Tg sg
3518 .It Xo
3519 .Cm stage
3520 .Op Fl lpS
3521 .Op Fl F Ar response-script
3522 .Op Ar path ...
3523 .Xc
3524 .Dl Pq alias: Cm sg
3525 Stage local changes for inclusion in the next commit.
3526 If no
3527 .Ar path
3528 is specified, stage all changes in the work tree.
3529 Otherwise, stage changes at or within the specified paths.
3530 Paths may be staged if they are added, modified, or deleted according to
3531 .Cm got status .
3532 .Pp
3533 Show the status of each affected file, using the following status codes:
3534 .Bl -column YXZ description
3535 .It A Ta file addition has been staged
3536 .It M Ta file modification has been staged
3537 .It D Ta file deletion has been staged
3538 .El
3539 .Pp
3540 Staged file contents are saved in newly created blob objects in the repository.
3541 These blobs will be referred to by tree objects once staged changes have been
3542 committed.
3543 .Pp
3544 Staged changes affect the behaviour of
3545 .Cm got commit ,
3546 .Cm got status ,
3547 and
3548 .Cm got diff .
3549 While paths with staged changes exist, the
3550 .Cm got commit
3551 command will refuse to commit any paths which do not have staged changes.
3552 Local changes created on top of staged changes can only be committed if
3553 the path is staged again, or if the staged changes are committed first.
3554 The
3555 .Cm got status
3556 command will show both local changes and staged changes.
3557 The
3558 .Cm got diff
3559 command is able to display local changes relative to staged changes,
3560 and to display staged changes relative to the repository.
3561 The
3562 .Cm got revert
3563 command cannot revert staged changes but may be used to revert
3564 local changes created on top of staged changes.
3565 .Pp
3566 The options for
3567 .Cm got stage
3568 are as follows:
3569 .Bl -tag -width Ds
3570 .It Fl F Ar response-script
3571 With the
3572 .Fl p
3573 option, read
3574 .Dq y ,
3575 .Dq n ,
3576 and
3577 .Dq q
3578 responses line-by-line from the specified
3579 .Ar response-script
3580 file instead of prompting interactively.
3581 .It Fl l
3582 Instead of staging new changes, list paths which are already staged,
3583 along with the IDs of staged blob objects and stage status codes.
3584 If paths were provided on the command line, show the staged paths
3585 among the specified paths.
3586 Otherwise, show all staged paths.
3587 .It Fl p
3588 Instead of staging the entire content of a changed file, interactively
3589 select or reject changes for staging based on
3590 .Dq y
3591 (stage change),
3592 .Dq n
3593 (reject change), and
3594 .Dq q
3595 (quit staging this file) responses.
3596 If a file is in modified status, individual patches derived from the
3597 modified file content can be staged.
3598 Files in added or deleted status may only be staged or rejected in
3599 their entirety.
3600 .It Fl S
3601 Allow staging of symbolic links which point outside of the path space
3602 that is under version control.
3603 By default,
3604 .Cm got stage
3605 will reject such symbolic links due to safety concerns.
3606 As a precaution,
3607 .Nm
3608 may decide to represent such a symbolic link as a regular file which contains
3609 the link's target path, rather than creating an actual symbolic link which
3610 points outside of the work tree.
3611 Use of this option is discouraged because external mechanisms such as
3612 .Dq make obj
3613 are better suited for managing symbolic links to paths not under
3614 version control.
3615 .El
3616 .Pp
3617 .Cm got stage
3618 will refuse to run if certain preconditions are not met.
3619 If a file contains merge conflicts, these conflicts must be resolved first.
3620 If a file is found to be out of date relative to the head commit on the
3621 work tree's current branch, the file must be updated with
3622 .Cm got update
3623 before it can be staged (however, this does not prevent the file from
3624 becoming out-of-date at some point after having been staged).
3625 .Pp
3626 The
3627 .Cm got update ,
3628 .Cm got rebase ,
3629 .Cm got merge ,
3630 and
3631 .Cm got histedit
3632 commands will refuse to run while staged changes exist.
3633 If staged changes cannot be committed because a staged path
3634 is out of date, the path must be unstaged with
3635 .Cm got unstage
3636 before it can be updated with
3637 .Cm got update ,
3638 and may then be staged again if necessary.
3639 .Tg ug
3640 .It Xo
3641 .Cm unstage
3642 .Op Fl p
3643 .Op Fl F Ar response-script
3644 .Op Ar path ...
3645 .Xc
3646 .Dl Pq alias: Cm ug
3647 Merge staged changes back into the work tree and put affected paths
3648 back into non-staged status.
3649 If no
3650 .Ar path
3651 is specified, unstage all staged changes across the entire work tree.
3652 Otherwise, unstage changes at or within the specified paths.
3653 .Pp
3654 Show the status of each affected file, using the following status codes:
3655 .Bl -column YXZ description
3656 .It G Ta file was unstaged
3657 .It C Ta file was unstaged and conflicts occurred during merge
3658 .It ! Ta changes destined for a missing file were not merged
3659 .It D Ta file was staged as deleted and still is deleted
3660 .It d Ta file's deletion was prevented by local modifications
3661 .It \(a~ Ta changes destined for a non-regular file were not merged
3662 .El
3663 .Pp
3664 The options for
3665 .Cm got unstage
3666 are as follows:
3667 .Bl -tag -width Ds
3668 .It Fl F Ar response-script
3669 With the
3670 .Fl p
3671 option, read
3672 .Dq y ,
3673 .Dq n ,
3674 and
3675 .Dq q
3676 responses line-by-line from the specified
3677 .Ar response-script
3678 file instead of prompting interactively.
3679 .It Fl p
3680 Instead of unstaging the entire content of a changed file, interactively
3681 select or reject changes for unstaging based on
3682 .Dq y
3683 (unstage change),
3684 .Dq n
3685 (keep change staged), and
3686 .Dq q
3687 (quit unstaging this file) responses.
3688 If a file is staged in modified status, individual patches derived from the
3689 staged file content can be unstaged.
3690 Files staged in added or deleted status may only be unstaged in their entirety.
3691 .El
3692 .It Xo
3693 .Cm cat
3694 .Op Fl P
3695 .Op Fl c Ar commit
3696 .Op Fl r Ar repository-path
3697 .Ar arg ...
3698 .Xc
3699 Parse and print contents of objects to standard output in a line-based
3700 text format.
3701 Content of commit, tree, and tag objects is printed in a way similar
3702 to the actual content stored in such objects.
3703 Blob object contents are printed as they would appear in files on disk.
3704 .Pp
3705 Attempt to interpret each argument as a reference, a tag name, or
3706 an object ID SHA1 hash.
3707 References will be resolved to an object ID.
3708 Tag names will resolved to a tag object.
3709 An abbreviated hash argument will be expanded to a full SHA1 hash
3710 automatically, provided the abbreviation is unique.
3711 .Pp
3712 If none of the above interpretations produce a valid result, or if the
3713 .Fl P
3714 option is used, attempt to interpret the argument as a path which will
3715 be resolved to the ID of an object found at this path in the repository.
3716 .Pp
3717 The options for
3718 .Cm got cat
3719 are as follows:
3720 .Bl -tag -width Ds
3721 .It Fl c Ar commit
3722 Look up paths in the specified
3723 .Ar commit .
3724 If this option is not used, paths are looked up in the commit resolved
3725 via the repository's HEAD reference.
3726 .Pp
3727 The expected argument is a commit ID SHA1 hash, or a reference name
3728 or keyword which will be resolved to a commit ID.
3729 An abbreviated hash argument will be expanded to a full SHA1 hash
3730 automatically, provided the abbreviation is unique.
3731 The keywords
3732 .Qq :base
3733 and
3734 .Qq :head
3735 resolve to the work tree's base commit and branch head, respectively.
3736 The former is only valid if invoked in a work tree, while the latter will
3737 resolve to the tip of the work tree's current branch if invoked in a
3738 work tree, otherwise it will resolve to the repository's HEAD reference.
3739 Keywords and references may be appended with
3740 .Qq :+
3742 .Qq :-
3743 modifiers and an optional integer N to denote the
3744 Nth descendant or antecedent by first parent traversal, respectively;
3745 for example,
3746 .Sy :head:-2
3747 denotes the work tree branch head's 2nd generation ancestor, and
3748 .Sy :base:+4
3749 denotes the 4th generation descendant of the work tree's base commit.
3750 Similarly,
3751 .Sy quux:-8
3752 will denote the 8th generation ancestor of the commit resolved by the
3753 .Qq quux
3754 reference.
3756 .Qq :+
3758 .Qq :-
3759 modifier without a trailing integer has an implicit
3760 .Qq 1
3761 appended
3762 .Po e.g.,
3763 .Sy :base:+
3764 is equivalent to
3765 .Sy :base:+1
3766 .Pc .
3767 .It Fl P
3768 Interpret all arguments as paths only.
3769 This option can be used to resolve ambiguity in cases where paths
3770 look like tag names, reference names, or object IDs.
3771 .It Fl r Ar repository-path
3772 Use the repository at the specified path.
3773 If not specified, assume the repository is located at or above the current
3774 working directory.
3775 If this directory is a
3776 .Nm
3777 work tree, use the repository path associated with this work tree.
3778 .El
3779 .It Cm info Op Ar path ...
3780 Display meta-data stored in a work tree.
3781 See
3782 .Xr got-worktree 5
3783 for details.
3784 .Pp
3785 The work tree to use is resolved implicitly by walking upwards from the
3786 current working directory.
3787 .Pp
3788 If one or more
3789 .Ar path
3790 arguments are specified, show additional per-file information for tracked
3791 files located at or within these paths.
3792 If a
3793 .Ar path
3794 argument corresponds to the work tree's root directory, display information
3795 for all tracked files.
3796 .El
3797 .Sh ENVIRONMENT
3798 .Bl -tag -width GOT_IGNORE_GITCONFIG
3799 .It Ev GOT_AUTHOR
3800 The author's name and email address, such as
3801 .Qq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
3802 Used by the
3803 .Cm got commit ,
3804 .Cm got import ,
3805 .Cm got rebase ,
3806 .Cm got merge ,
3807 and
3808 .Cm got histedit
3809 commands.
3810 Because
3811 .Xr git 1
3812 may fail to parse commits without an email address in author data,
3813 .Nm
3814 attempts to reject
3815 .Ev GOT_AUTHOR
3816 environment variables with a missing email address.
3817 .Pp
3818 .Ev GOT_AUTHOR will be overridden by configuration settings in
3819 .Xr got.conf 5
3820 or by Git's
3821 .Dv user.name
3822 and
3823 .Dv user.email
3824 configuration settings in the repository's
3825 .Pa .git/config
3826 file.
3827 The
3828 .Dv user.name
3829 and
3830 .Dv user.email
3831 configuration settings contained in Git's global
3832 .Pa ~/.gitconfig
3833 configuration file will only be used if neither
3834 .Xr got.conf 5
3835 nor the
3836 .Ev GOT_AUTHOR
3837 environment variable provide author information.
3838 .It Ev GOT_IGNORE_GITCONFIG
3839 If this variable is set then any remote repository definitions or author
3840 information found in Git configuration files will be ignored.
3841 .It Ev GOT_LOG_DEFAULT_LIMIT
3842 The default limit on the number of commits traversed by
3843 .Cm got log .
3844 If set to zero, the limit is unbounded.
3845 This variable will be silently ignored if it is set to a non-numeric value.
3846 .It Ev VISUAL , EDITOR
3847 The editor spawned by
3848 .Cm got commit ,
3849 .Cm got histedit ,
3850 .Cm got import ,
3852 .Cm got tag .
3853 If not set, the
3854 .Xr vi 1
3855 text editor will be spawned.
3856 .El
3857 .Sh FILES
3858 .Bl -tag -width packed-refs -compact
3859 .It Pa got.conf
3860 Repository-wide configuration settings for
3861 .Nm .
3862 If present, a
3863 .Xr got.conf 5
3864 configuration file located in the root directory of a Git repository
3865 supersedes any relevant settings in Git's
3866 .Pa config
3867 file.
3868 .Pp
3869 .It Pa .got/got.conf
3870 Worktree-specific configuration settings for
3871 .Nm .
3872 If present, a
3873 .Xr got.conf 5
3874 configuration file in the
3875 .Pa .got
3876 meta-data directory of a work tree supersedes any relevant settings in
3877 the repository's
3878 .Xr got.conf 5
3879 configuration file and Git's
3880 .Pa config
3881 file.
3882 .El
3883 .Sh EXIT STATUS
3884 .Ex -std got
3885 .Sh EXAMPLES
3886 Enable tab-completion of
3887 .Nm
3888 command names in
3889 .Xr ksh 1 :
3890 .Pp
3891 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
3892 .Pp
3893 Clone an existing Git repository for use with
3894 .Nm :
3895 .Pp
3896 .Dl $ cd /var/git/
3897 .Dl $ got clone ssh://git@github.com/openbsd/src.git
3898 .Pp
3899 Unfortunately, many of the popular Git hosting sites do not offer anonymous
3900 access via SSH.
3901 Such sites will require an account to be created, and a public SSH key to be
3902 uploaded to this account, before repository access via ssh:// URLs will work.
3903 .Pp
3904 Most sites offer anonymous repository access via HTTPS:
3905 .Pp
3906 .Dl $ cd /var/git/
3907 .Dl $ got clone https://github.com/openbsd/src.git
3908 .Pp
3909 Alternatively, for quick and dirty local testing of
3910 .Nm
3911 a new Git repository could be created and populated with files,
3912 e.g. from a temporary CVS checkout located at
3913 .Pa /tmp/src :
3914 .Pp
3915 .Dl $ got init /var/git/src.git
3916 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
3917 .Pp
3918 Check out a work tree from the Git repository to /usr/src:
3919 .Pp
3920 .Dl $ got checkout /var/git/src.git /usr/src
3921 .Pp
3922 View local changes in a work tree directory:
3923 .Pp
3924 .Dl $ got diff | less
3925 .Pp
3926 In a work tree, display files in a potentially problematic state:
3927 .Pp
3928 .Dl $ got status -s 'C!~?'
3929 .Pp
3930 Interactively revert selected local changes in a work tree directory:
3931 .Pp
3932 .Dl $ got revert -p -R\ .
3933 .Pp
3934 In a work tree or a git repository directory, list all branch references:
3935 .Pp
3936 .Dl $ got branch -l
3937 .Pp
3938 As above, but list the most recently modified branches only:
3939 .Pp
3940 .Dl $ got branch -lt | head
3941 .Pp
3942 In a work tree or a git repository directory, create a new branch called
3943 .Dq unified-buffer-cache
3944 which is forked off the
3945 .Dq master
3946 branch:
3947 .Pp
3948 .Dl $ got branch -c master unified-buffer-cache
3949 .Pp
3950 Switch an existing work tree to the branch
3951 .Dq unified-buffer-cache .
3952 Local changes in the work tree will be preserved and merged if necessary:
3953 .Pp
3954 .Dl $ got update -b unified-buffer-cache
3955 .Pp
3956 Create a new commit from local changes in a work tree directory.
3957 This new commit will become the head commit of the work tree's current branch:
3958 .Pp
3959 .Dl $ got commit
3960 .Pp
3961 In a work tree or a git repository directory, view changes committed in
3962 the 3 most recent commits to the work tree's branch, or the branch resolved
3963 via the repository's HEAD reference, respectively:
3964 .Pp
3965 .Dl $ got log -p -l 3
3966 .Pp
3967 As above, but display changes in the order in which
3968 .Xr patch 1
3969 could apply them in sequence:
3970 .Pp
3971 .Dl $ got log -p -l 3 -R
3972 .Pp
3973 In a work tree or a git repository directory, log the history of a subdirectory:
3974 .Pp
3975 .Dl $ got log sys/uvm
3976 .Pp
3977 While operating inside a work tree, paths are specified relative to the current
3978 working directory, so this command will log the subdirectory
3979 .Pa sys/uvm :
3980 .Pp
3981 .Dl $ cd sys/uvm && got log\ .
3982 .Pp
3983 And this command has the same effect:
3984 .Pp
3985 .Dl $ cd sys/dev/usb && got log ../../uvm
3986 .Pp
3987 And this command displays work tree meta-data about all tracked files:
3988 .Pp
3989 .Dl $ cd /usr/src
3990 .Dl $ got info\ . | less
3991 .Pp
3992 Add new files and remove obsolete files in a work tree directory:
3993 .Pp
3994 .Dl $ got add sys/uvm/uvm_ubc.c
3995 .Dl $ got remove sys/uvm/uvm_vnode.c
3996 .Pp
3997 A file can be renamed or moved by removing it from its old location
3998 and adding it at the new location:
3999 .Pp
4000 .Dl $ cp oldfile.c newfile.c
4001 .Dl $ got remove oldfile.c
4002 .Dl $ got add newfile.c
4003 .Pp
4004 .Nm
4005 does not yet follow file history across renames, but
4006 .Xr git 1
4007 will be able to do so regardless.
4008 .Pp
4009 Create a new commit from local changes in a work tree directory
4010 with a pre-defined log message.
4011 .Pp
4012 .Dl $ got commit -m 'unify the buffer cache'
4013 .Pp
4014 Alternatively, create a new commit from local changes in a work tree
4015 directory with a log message that has been prepared in the file
4016 .Pa /tmp/msg :
4017 .Pp
4018 .Dl $ got commit -F /tmp/msg
4019 .Pp
4020 Update any work tree checked out from the
4021 .Dq unified-buffer-cache
4022 branch to the latest commit on this branch:
4023 .Pp
4024 .Dl $ got update
4025 .Pp
4026 Roll file content on the unified-buffer-cache branch back by one commit,
4027 and then fetch the rolled-back change into the work tree as a local change
4028 to be amended and perhaps committed again:
4029 .Pp
4030 .Dl $ got backout unified-buffer-cache
4031 .Dl $ got commit -m 'roll back previous'
4032 .Dl $ # now back out the previous backout :-)
4033 .Dl $ got backout unified-buffer-cache
4034 .Pp
4035 Fetch new changes on the remote repository's
4036 .Dq master
4037 branch, making them visible on the local repository's
4038 .Dq origin/master
4039 branch:
4040 .Pp
4041 .Dl $ cd /usr/src
4042 .Dl $ got fetch
4043 .Pp
4044 Rebase the local
4045 .Dq master
4046 branch to merge the new changes that are now visible on the
4047 .Dq origin/master
4048 branch:
4049 .Pp
4050 .Dl $ cd /usr/src
4051 .Dl $ got update -b origin/master
4052 .Dl $ got rebase master
4053 .Pp
4054 Rebase the
4055 .Dq unified-buffer-cache
4056 branch on top of the new head commit of the
4057 .Dq master
4058 branch.
4059 .Pp
4060 .Dl $ got update -b master
4061 .Dl $ got rebase unified-buffer-cache
4062 .Pp
4063 Create a patch from all changes on the unified-buffer-cache branch.
4064 The patch can be mailed out for review and applied to
4065 .Ox Ns 's
4066 CVS tree:
4067 .Pp
4068 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
4069 .Pp
4070 Edit the entire commit history of the
4071 .Dq unified-buffer-cache
4072 branch:
4073 .Pp
4074 .Dl $ got update -b unified-buffer-cache
4075 .Dl $ got update -c master
4076 .Dl $ got histedit
4077 .Pp
4078 Before working against existing branches in a repository cloned with
4079 .Cm git clone --bare
4080 instead of
4081 .Cm got clone ,
4082 a Git
4083 .Dq refspec
4084 must be configured to map all references in the remote repository
4085 into the
4086 .Dq refs/remotes
4087 namespace of the local repository.
4088 This can be achieved by setting Git's
4089 .Pa remote.origin.fetch
4090 configuration variable to the value
4091 .Dq +refs/heads/*:refs/remotes/origin/*
4092 with the
4093 .Cm git config
4094 command:
4095 .Pp
4096 .Dl $ cd /var/git/repo
4097 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
4098 .Pp
4099 Additionally, the
4100 .Dq mirror
4101 option must be disabled:
4102 .Pp
4103 .Dl $ cd /var/git/repo
4104 .Dl $ git config remote.origin.mirror false
4105 .Pp
4106 Alternatively, the following
4107 .Xr git-fetch 1
4108 configuration item can be added manually to the Git repository's
4109 .Pa config
4110 file:
4111 .Pp
4112 .Dl [remote \&"origin\&"]
4113 .Dl url = ...
4114 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
4115 .Dl mirror = false
4116 .Pp
4117 This configuration leaves the local repository's
4118 .Dq refs/heads
4119 namespace free for use by local branches checked out with
4120 .Cm got checkout
4121 and, if needed, created with
4122 .Cm got branch .
4123 Branches in the
4124 .Dq refs/remotes/origin
4125 namespace can now be updated with incoming changes from the remote
4126 repository with
4127 .Cm got fetch
4129 .Xr git-fetch 1
4130 without extra command line arguments.
4131 Newly fetched changes can be examined with
4132 .Cm got log .
4133 .Pp
4134 Display changes on the remote repository's version of the
4135 .Dq master
4136 branch, as of the last time
4137 .Cm got fetch
4138 was run:
4139 .Pp
4140 .Dl $ got log -c origin/master | less
4141 .Pp
4142 As shown here, most commands accept abbreviated reference names such as
4143 .Dq origin/master
4144 instead of
4145 .Dq refs/remotes/origin/master .
4146 The latter is only needed in case of ambiguity.
4147 .Pp
4148 .Cm got rebase
4149 can be used to merge changes which are visible on the
4150 .Dq origin/master
4151 branch into the
4152 .Dq master
4153 branch.
4154 This will also merge local changes, if any, with the incoming changes:
4155 .Pp
4156 .Dl $ got update -b origin/master
4157 .Dl $ got rebase master
4158 .Pp
4159 In order to make changes committed to the
4160 .Dq unified-buffer-cache
4161 visible on the
4162 .Dq master
4163 branch, the
4164 .Dq unified-buffer-cache
4165 branch can be rebased onto the
4166 .Dq master
4167 branch:
4168 .Pp
4169 .Dl $ got update -b master
4170 .Dl $ got rebase unified-buffer-cache
4171 .Pp
4172 Changes on the
4173 .Dq unified-buffer-cache
4174 branch can now be made visible on the
4175 .Dq master
4176 branch with
4177 .Cm got integrate .
4178 Because the rebase operation switched the work tree to the
4179 .Dq unified-buffer-cache
4180 branch, the work tree must be switched back to the
4181 .Dq master
4182 branch first:
4183 .Pp
4184 .Dl $ got update -b master
4185 .Dl $ got integrate unified-buffer-cache
4186 .Pp
4187 On the
4188 .Dq master
4189 branch, log messages for local changes can now be amended with
4190 .Dq OK
4191 by other developers and any other important new information:
4192 .Pp
4193 .Dl $ got update -c origin/master
4194 .Dl $ got histedit -m
4195 .Pp
4196 If the remote repository offers write access, local changes on the
4197 .Dq master
4198 branch can be sent to the remote repository with
4199 .Cm got send .
4200 Usually,
4201 .Cm got send
4202 can be run without further arguments.
4203 The arguments shown here match defaults, provided the work tree's
4204 current branch is the
4205 .Dq master
4206 branch:
4207 .Pp
4208 .Dl $ got send -b master origin
4209 .Pp
4210 If the remote repository requires the HTTPS protocol, the
4211 .Xr git-push 1
4212 command must be used instead:
4213 .Pp
4214 .Dl $ cd /var/git/src.git
4215 .Dl $ git push origin master
4216 .Pp
4217 When making contributions to projects which use the
4218 .Dq pull request
4219 workflow, SSH protocol repository access needs to be set up first.
4220 Once an account has been created on a Git hosting site it should
4221 be possible to upload a public SSH key for repository access
4222 authentication.
4223 .Pp
4224 The
4225 .Dq pull request
4226 workflow will usually involve two remote repositories.
4227 In the real-life example below, the
4228 .Dq origin
4229 repository was forked from the
4230 .Dq upstream
4231 repository by using the Git hosting site's web interface.
4232 The
4233 .Xr got.conf 5
4234 file in the local repository describes both remote repositories:
4235 .Bd -literal -offset indent
4236 # Jelmers's repository, which accepts pull requests
4237 remote "upstream" {
4238 server git@github.com
4239 protocol ssh
4240 repository "/jelmer/dulwich"
4241 branch { "master" }
4244 # Stefan's fork, used as the default remote repository
4245 remote "origin" {
4246 server git@github.com
4247 protocol ssh
4248 repository "/stspdotname/dulwich"
4249 branch { "master" }
4251 .Ed
4252 .Pp
4253 With this configuration, Stefan can create commits on
4254 .Dq refs/heads/master
4255 and send them to the
4256 .Dq origin
4257 repository by running:
4258 .Pp
4259 .Dl $ got send -b master origin
4260 .Pp
4261 The changes can now be proposed to Jelmer by opening a pull request
4262 via the Git hosting site's web interface.
4263 If Jelmer requests further changes to be made, additional commits
4264 can be created on the
4265 .Dq master
4266 branch and be added to the pull request by running
4267 .Cd got send
4268 again.
4269 .Pp
4270 If Jelmer prefers additional commits to be
4271 .Dq squashed
4272 then the following commands can be used to achieve this:
4273 .Pp
4274 .Dl $ got update -b master
4275 .Dl $ got update -c origin/master
4276 .Dl $ got histedit -f
4277 .Dl $ got send -f -b master origin
4278 .Pp
4279 In addition to reviewing the pull request in the web user interface,
4280 Jelmer can fetch the pull request's branch into his local repository
4281 and create a local branch which contains the proposed changes:
4282 .Pp
4283 .Dl $ got fetch -R refs/pull/1046/head origin
4284 .Dl $ got branch -c refs/remotes/origin/pull/1046/head pr1046
4285 .Pp
4286 Once Jelmer has accepted the pull request, Stefan can fetch the
4287 merged changes, and possibly several other new changes, by running:
4288 .Pp
4289 .Dl $ got fetch upstream
4290 .Pp
4291 The merged changes will now be visible under the reference
4292 .Dq refs/remotes/upstream/master .
4293 The local
4294 .Dq master
4295 branch can now be rebased on top of the latest changes
4296 from upstream:
4297 .Pp
4298 .Dl $ got update -b upstream/master
4299 .Dl $ got rebase master
4300 .Pp
4301 As an alternative to
4302 .Cm got rebase ,
4303 branches can be merged with
4304 .Cm got merge :
4305 .Pp
4306 .Dl $ got update -b master
4307 .Dl $ got merge upstream/master
4308 .Pp
4309 The question of whether to rebase or merge branches is philosophical.
4310 When in doubt, refer to the software project's policies set by project
4311 maintainers.
4312 .Pp
4313 As a final step, the forked repository's copy of the master branch needs
4314 to be kept in sync by sending the new changes there:
4315 .Pp
4316 .Dl $ got send -f -b master origin
4317 .Pp
4318 If multiple pull requests need to be managed in parallel, a separate branch
4319 must be created for each pull request with
4320 .Cm got branch .
4321 Each such branch can then be used as above, in place of
4322 .Dq refs/heads/master .
4323 Changes for any accepted pull requests will still appear under
4324 .Dq refs/remotes/upstream/master,
4325 regardless of which branch was used in the forked repository to
4326 create a pull request.
4327 .Sh SEE ALSO
4328 .Xr gotadmin 1 ,
4329 .Xr tog 1 ,
4330 .Xr git-repository 5 ,
4331 .Xr got-worktree 5 ,
4332 .Xr got.conf 5 ,
4333 .Xr gotwebd 8
4334 .Sh AUTHORS
4335 .An Anthony J. Bentley Aq Mt bentley@openbsd.org
4336 .An Christian Weisgerber Aq Mt naddy@openbsd.org
4337 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
4338 .An Josh Rickmar Aq Mt jrick@zettaport.com
4339 .An Joshua Stein Aq Mt jcs@openbsd.org
4340 .An Klemens Nanni Aq Mt kn@openbsd.org
4341 .An Martin Pieuchot Aq Mt mpi@openbsd.org
4342 .An Neels Hofmeyr Aq Mt neels@hofmeyr.de
4343 .An Omar Polo Aq Mt op@openbsd.org
4344 .An Ori Bernstein Aq Mt ori@openbsd.org
4345 .An Sebastien Marie Aq Mt semarie@openbsd.org
4346 .An Stefan Sperling Aq Mt stsp@openbsd.org
4347 .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au
4348 .An Theo Buehler Aq Mt tb@openbsd.org
4349 .An Thomas Adam Aq Mt thomas@xteddy.org
4350 .An Tracey Emery Aq Mt tracey@traceyemery.net
4351 .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org
4352 .Pp
4353 Parts of
4354 .Nm ,
4355 .Xr tog 1 ,
4356 and
4357 .Xr gotwebd 8
4358 were derived from code under copyright by:
4359 .Pp
4360 .An Caldera International
4361 .An Daniel Hartmeier
4362 .An Esben Norby
4363 .An Henning Brauer
4364 .An HÃ¥kan Olsson
4365 .An Ingo Schwarze
4366 .An Jean-Francois Brousseau
4367 .An Joris Vink
4368 .An Jyri J. Virkki
4369 .An Larry Wall
4370 .An Markus Friedl
4371 .An Niall O'Higgins
4372 .An Niklas Hallqvist
4373 .An Ray Lai
4374 .An Ryan McBride
4375 .An Theo de Raadt
4376 .An Todd C. Miller
4377 .An Xavier Santolaria
4378 .Pp
4379 .Nm
4380 contains code contributed to the public domain by
4381 .An Austin Appleby .
4382 .Sh CAVEATS
4383 .Nm
4384 is a work-in-progress and some features remain to be implemented.
4385 .Pp
4386 At present, the user has to fall back on
4387 .Xr git 1
4388 to perform some tasks.
4389 In particular:
4390 .Bl -bullet
4391 .It
4392 Writing to remote repositories over HTTP or HTTPS protocols requires
4393 .Xr git-push 1 .
4394 .It
4395 The creation of merge commits with more than two parent commits requires
4396 .Xr git-merge 1 .
4397 .It
4398 In situations where files or directories were moved around
4399 .Cm got
4400 will not automatically merge changes to new locations and
4401 .Xr git 1
4402 will usually produce better results.
4403 .El