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