Blob


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