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