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