Blob


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