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 .Tg im
66 .It Cm import Oo Fl b Ar branch Oc Oo Fl I Ar pattern Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Ar directory
67 .Dl Pq alias: Cm im
68 Create an initial commit in a repository from the file hierarchy
69 within the specified
70 .Ar directory .
71 The created commit will not have any parent commits, i.e. it will be a
72 root commit.
73 Also create a new reference which provides a branch name for the newly
74 created commit.
75 Show the path of each imported file to indicate progress.
76 .Pp
77 The
78 .Cm got import
79 command requires the
80 .Ev GOT_AUTHOR
81 environment variable to be set,
82 unless an author has been configured in
83 .Xr got.conf 5
84 or Git's
85 .Dv user.name
86 and
87 .Dv user.email
88 configuration settings can be obtained from the repository's
89 .Pa .git/config
90 file or from Git's global
91 .Pa ~/.gitconfig
92 configuration file.
93 .Pp
94 The options for
95 .Cm got import
96 are as follows:
97 .Bl -tag -width Ds
98 .It Fl b Ar branch
99 Create the specified
100 .Ar branch
101 instead of creating the default branch
102 .Dq main .
103 Use of this option is required if the
104 .Dq main
105 branch already exists.
106 .It Fl I Ar pattern
107 Ignore files or directories with a name which matches the specified
108 .Ar pattern .
109 This option may be specified multiple times to build a list of ignore patterns.
110 The
111 .Ar pattern
112 follows the globbing rules documented in
113 .Xr glob 7 .
114 .It Fl m Ar message
115 Use the specified log message when creating the new commit.
116 Without the
117 .Fl m
118 option,
119 .Cm got import
120 opens a temporary file in an editor where a log message can be written.
121 .It Fl r Ar repository-path
122 Use the repository at the specified path.
123 If not specified, assume the repository is located at or above the current
124 working directory.
125 .El
126 .Tg cl
127 .It Cm clone Oo Fl almqv Oc Oo Fl b Ar branch Oc Oo Fl R Ar reference Oc Ar repository-URL Op Ar directory
128 .Dl Pq alias: Cm cl
129 Clone a Git repository at the specified
130 .Ar repository-URL
131 into the specified
132 .Ar directory .
133 If no
134 .Ar directory
135 is specified, the directory name will be derived from the name of the
136 cloned repository.
137 .Cm got clone
138 will refuse to run if the
139 .Ar directory
140 already exists.
141 .Pp
142 The
143 .Ar repository-URL
144 specifies a protocol scheme, a server hostname, an optional port number
145 separated from the hostname by a colon, and a path to the repository on
146 the server:
147 .Lk scheme://hostname:port/path/to/repository
148 .Pp
149 The following protocol schemes are supported:
150 .Bl -tag -width git+ssh
151 .It git
152 The Git protocol as implemented by the
153 .Xr git-daemon 1
154 server.
155 Use of this protocol is discouraged since it supports neither authentication
156 nor encryption.
157 .It git+ssh
158 The Git protocol wrapped in an authenticated and encrypted
159 .Xr ssh 1
160 tunnel.
161 With this protocol the hostname may contain an embedded username for
162 .Xr ssh 1
163 to use:
164 .Mt user@hostname
165 .It ssh
166 Short alias for git+ssh.
167 .El
168 .Pp
169 Objects in the cloned repository are stored in a pack file which is downloaded
170 from the server.
171 This pack file will then be indexed to facilitate access to the objects stored
172 within.
173 If any objects in the pack file are stored in deltified form, all deltas will
174 be fully resolved in order to compute the ID of such objects.
175 This can take some time.
176 More details about the pack file format are documented in
177 .Xr git-repository 5 .
178 .Pp
179 .Cm got clone
180 creates a remote repository entry in the
181 .Xr got.conf 5
182 and
183 .Pa config
184 files of the cloned repository to store the
185 .Ar repository-url
186 and any
187 .Ar branch
188 or
189 .Ar reference
190 arguments for future use by
191 .Cm got fetch
192 or
193 .Xr git-fetch 1 .
194 .Pp
195 The options for
196 .Cm got clone
197 are as follows:
198 .Bl -tag -width Ds
199 .It Fl a
200 Fetch all branches from the remote repository's
201 .Dq refs/heads/
202 reference namespace and set
203 .Cm fetch_all_branches
204 in the cloned repository's
205 .Xr got.conf 5
206 file for future use by
207 .Cm got fetch .
208 If this option is not specified, a branch resolved via the remote
209 repository's HEAD reference will be fetched.
210 Cannot be used together with the
211 .Fl b
212 option.
213 .It Fl b Ar branch
214 Fetch the specified
215 .Ar branch
216 from the remote repository's
217 .Dq refs/heads/
218 reference namespace.
219 This option may be specified multiple times to build a list of branches
220 to fetch.
221 If the branch corresponding to the remote repository's HEAD reference is not
222 in this list, the cloned repository's HEAD reference will be set to the first
223 branch which was fetched.
224 If this option is not specified, a branch resolved via the remote
225 repository's HEAD reference will be fetched.
226 Cannot be used together with the
227 .Fl a
228 option.
229 .It Fl l
230 List branches and tags available for fetching from the remote repository
231 and exit immediately.
232 Cannot be used together with any of the other options except
233 .Fl q
234 and
235 .Fl v .
236 .It Fl m
237 Create the cloned repository as a mirror of the original repository.
238 This is useful if the cloned repository will not be used to store
239 locally created commits.
240 .Pp
241 The repository's
242 .Xr got.conf 5
243 and
244 .Pa config
245 files will be set up with the
246 .Dq mirror
247 option enabled, such that
248 .Cm got fetch
249 or
250 .Xr git-fetch 1
251 will write incoming changes directly to branches in the
252 .Dq refs/heads/
253 reference namespace, rather than to branches in the
254 .Dq refs/remotes/
255 namespace.
256 This avoids the usual requirement of having to run
257 .Cm got rebase
258 after
259 .Cm got fetch
260 in order to make incoming changes appear on branches in the
261 .Dq refs/heads/
262 namespace.
263 But maintaining custom changes in the cloned repository becomes difficult
264 since such changes will be at risk of being discarded whenever incoming
265 changes are fetched.
266 .It Fl q
267 Suppress progress reporting output.
268 The same option will be passed to
269 .Xr ssh 1
270 if applicable.
271 .It Fl R Ar reference
272 In addition to the branches and tags that will be fetched, fetch an arbitrary
273 .Ar reference
274 from the remote repository's
275 .Dq refs/
276 namespace.
277 This option may be specified multiple times to build a list of additional
278 references to fetch.
279 The specified
280 .Ar reference
281 may either be a path to a specific reference, or a reference namespace
282 which will cause all references in this namespace to be fetched.
283 .Pp
284 Each reference will be mapped into the cloned repository's
285 .Dq refs/remotes/
286 namespace, unless the
287 .Fl m
288 option is used to mirror references directly into the cloned repository's
289 .Dq refs/
290 namespace.
291 .Pp
292 .Cm got clone
293 will refuse to fetch references from the remote repository's
294 .Dq refs/remotes/
295 or
296 .Dq refs/got/
297 namespace.
298 .It Fl v
299 Verbose mode.
300 Causes
301 .Cm got clone
302 to print debugging messages to standard error output.
303 This option will be passed to
304 .Xr ssh 1
305 if applicable.
306 Multiple -v options increase the verbosity.
307 The maximum is 3.
308 .El
309 .Tg fe
310 .It Cm fetch Oo Fl adlqtvX Oc Oo Fl b Ar branch Oc Oo Fl R Ar reference Oc Oo Fl r Ar repository-path Oc Op Ar remote-repository
311 .Dl Pq alias: Cm fe
312 Fetch new changes from a remote repository.
313 If no
314 .Ar remote-repository
315 is specified,
316 .Dq origin
317 will be used.
318 The remote repository's URL is obtained from the corresponding entry in
319 .Xr got.conf 5
320 or Git's
321 .Pa config
322 file of the local repository, as created by
323 .Cm got clone .
324 .Pp
325 New changes will be stored in a separate pack file downloaded from the server.
326 Optionally, separate pack files stored in the repository can be combined with
327 .Xr git-repack 1 .
328 .Pp
329 By default, branch references in the
330 .Dq refs/remotes/
331 reference namespace will be updated to point at the newly fetched commits.
332 The
333 .Cm got rebase
334 command can then be used to make new changes visible on branches in the
335 .Dq refs/heads/
336 namespace, merging incoming changes with the changes on those branches
337 as necessary.
338 .Pp
339 If the repository was created as a mirror with
340 .Cm got clone -m ,
341 then all branches in the
342 .Dq refs/heads/
343 namespace will be updated directly to match the corresponding branches in
344 the remote repository.
345 If those branches contained local commits, these commits will no longer be
346 reachable via a reference and will therefore be at risk of being discarded
347 by Git's garbage collector or
348 .Cm gotadmin cleanup .
349 Maintaining custom changes in a mirror repository is therefore discouraged.
350 .Pp
351 In any case, references in the
352 .Dq refs/tags/
353 namespace will always be fetched and mapped directly to local references
354 in the same namespace.
355 .Pp
356 The options for
357 .Cm got fetch
358 are as follows:
359 .Bl -tag -width Ds
360 .It Fl a
361 Fetch all branches from the remote repository's
362 .Dq refs/heads/
363 reference namespace.
364 This option can be enabled by default for specific repositories in
365 .Xr got.conf 5 .
366 If this option is not specified, a branch resolved via the remote
367 repository's HEAD reference will be fetched.
368 Cannot be used together with the
369 .Fl b
370 option.
371 .It Fl b Ar branch
372 Fetch the specified
373 .Ar branch
374 from the remote repository's
375 .Dq refs/heads/
376 reference namespace.
377 This option may be specified multiple times to build a list of branches
378 to fetch.
379 If this option is not specified, a branch resolved via the remote
380 repository's HEAD reference will be fetched.
381 Cannot be used together with the
382 .Fl a
383 option.
384 .It Fl d
385 Delete branches and tags from the local repository which are no longer
386 present in the remote repository.
387 Only references are deleted.
388 Any commit, tree, tag, and blob objects belonging to deleted branches or
389 tags remain in the repository and may be removed separately with
390 Git's garbage collector or
391 .Cm gotadmin cleanup .
392 .It Fl l
393 List branches and tags available for fetching from the remote repository
394 and exit immediately.
395 Cannot be used together with any of the other options except
396 .Fl v ,
397 .Fl q ,
398 and
399 .Fl r .
400 .It Fl q
401 Suppress progress reporting output.
402 The same option will be passed to
403 .Xr ssh 1
404 if applicable.
405 .It Fl R Ar reference
406 In addition to the branches and tags that will be fetched, fetch an arbitrary
407 .Ar reference
408 from the remote repository's
409 .Dq refs/
410 namespace.
411 This option may be specified multiple times to build a list of additional
412 references to fetch.
413 The specified
414 .Ar reference
415 may either be a path to a specific reference, or a reference namespace
416 which will cause all references in this namespace to be fetched.
417 .Pp
418 Each reference will be mapped into the local repository's
419 .Dq refs/remotes/
420 namespace, unless the local repository was created as a mirror with
421 .Cm got clone -m
422 in which case references will be mapped directly into the local repository's
423 .Dq refs/
424 namespace.
425 .Pp
426 Once a reference has been fetched, a branch based on it can be created with
427 .Cm got branch
428 if needed.
429 .Pp
430 .Cm got fetch
431 will refuse to fetch references from the remote repository's
432 .Dq refs/remotes/
433 or
434 .Dq refs/got/
435 namespace.
436 .It Fl r Ar repository-path
437 Use the repository at the specified path.
438 If not specified, assume the repository is located at or above the current
439 working directory.
440 If this directory is a
441 .Nm
442 work tree, use the repository path associated with this work tree.
443 .It Fl t
444 Allow existing references in the
445 .Dq refs/tags
446 namespace to be updated if they have changed on the server.
447 If not specified, only new tag references will be created.
448 .It Fl v
449 Verbose mode.
450 Causes
451 .Cm got fetch
452 to print debugging messages to standard error output.
453 The same option will be passed to
454 .Xr ssh 1
455 if applicable.
456 Multiple -v options increase the verbosity.
457 The maximum is 3.
458 .It Fl X
459 Delete all references which correspond to a particular
460 .Ar remote-repository
461 instead of fetching new changes.
462 This can be useful when a remote repository is being removed from
463 .Xr got.conf 5 .
464 .Pp
465 With
466 .Fl X ,
467 the
468 .Ar remote-repository
469 argument is mandatory and no other options except
470 .Fl r ,
471 .Fl v ,
472 and
473 .Fl q
474 are allowed.
475 .Pp
476 Only references are deleted.
477 Any commit, tree, tag, and blob objects fetched from a remote repository
478 will generally be stored in pack files and may be removed separately with
479 .Xr git-repack 1
480 and Git's garbage collector.
481 .El
482 .Tg co
483 .It Cm checkout Oo Fl Eq Oc Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Oo Fl p Ar path-prefix Oc Ar repository-path Op Ar work-tree-path
484 .Dl Pq alias: Cm co
485 Copy files from a repository into a new work tree.
486 Show the status of each affected file, using the following status codes:
487 .Bl -column YXZ description
488 .It A Ta new file was added
489 .It E Ta file already exists in work tree's meta-data
490 .El
491 .Pp
492 If the
493 .Ar work tree path
494 is not specified, either use the last component of
495 .Ar repository path ,
496 or if a
497 .Ar path prefix
498 was specified use the last component of
499 .Ar path prefix .
500 .Pp
501 The options for
502 .Cm got checkout
503 are as follows:
504 .Bl -tag -width Ds
505 .It Fl b Ar branch
506 Check out files from a commit on the specified
507 .Ar branch .
508 If this option is not specified, a branch resolved via the repository's HEAD
509 reference will be used.
510 .It Fl c Ar commit
511 Check out files from the specified
512 .Ar commit
513 on the selected branch.
514 The expected argument is a commit ID SHA1 hash or an existing reference
515 or tag name which will be resolved to a commit ID.
516 An abbreviated hash argument will be expanded to a full SHA1 hash
517 automatically, provided the abbreviation is unique.
518 If this option is not specified, the most recent commit on the selected
519 branch will be used.
520 .Pp
521 If the specified
522 .Ar commit
523 is not contained in the selected branch, a different branch which contains
524 this commit must be specified with the
525 .Fl b
526 option.
527 If no such branch is known, a new branch must be created for this
528 commit with
529 .Cm got branch
530 before
531 .Cm got checkout
532 can be used.
533 Checking out work trees with an unknown branch is intentionally not supported.
534 .It Fl E
535 Proceed with the checkout operation even if the directory at
536 .Ar work-tree-path
537 is not empty.
538 Existing files will be left intact.
539 .It Fl p Ar path-prefix
540 Restrict the work tree to a subset of the repository's tree hierarchy.
541 Only files beneath the specified
542 .Ar path-prefix
543 will be checked out.
544 .It Fl q
545 Silence progress output.
546 .El
547 .Tg up
548 .It Cm update Oo Fl q Oc Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
549 .Dl Pq alias: Cm up
550 Update an existing work tree to a different
551 .Ar commit .
552 Change existing files in the work tree as necessary to match file contents
553 of this commit.
554 Preserve any local changes in the work tree and merge them with the
555 incoming changes.
556 .Pp
557 Files which already contain merge conflicts will not be updated to avoid
558 further complications.
559 Such files will be updated when
560 .Cm got update
561 is run again after merge conflicts have been resolved.
562 If the conflicting changes are no longer needed, affected files can be
563 reverted with
564 .Cm got revert
565 before running
566 .Cm got update
567 again.
568 .Pp
569 Show the status of each affected file, using the following status codes:
570 .Bl -column YXZ description
571 .It U Ta file was updated and contained no local changes
572 .It G Ta file was updated and local changes were merged cleanly
573 .It C Ta file was updated and conflicts occurred during merge
574 .It D Ta file was deleted
575 .It A Ta new file was added
576 .It \(a~ Ta versioned file is obstructed by a non-regular file
577 .It ! Ta a missing versioned file was restored
578 .It # Ta file was not updated because it contains merge conflicts
579 .It ? Ta changes destined for an unversioned file were not merged
580 .El
581 .Pp
582 If no
583 .Ar path
584 is specified, update the entire work tree.
585 Otherwise, restrict the update operation to files at or within the
586 specified paths.
587 Each path is required to exist in the update operation's target commit.
588 Files in the work tree outside specified paths will remain unchanged and
589 will retain their previously recorded base commit.
590 Some
591 .Nm
592 commands may refuse to run while the work tree contains files from
593 multiple base commits.
594 The base commit of such a work tree can be made consistent by running
595 .Cm got update
596 across the entire work tree.
597 Specifying a
598 .Ar path
599 is incompatible with the
600 .Fl b
601 option.
602 .Pp
603 .Cm got update
604 cannot update paths with staged changes.
605 If changes have been staged with
606 .Cm got stage ,
607 these changes must first be committed with
608 .Cm got commit
609 or unstaged with
610 .Cm got unstage .
611 .Pp
612 The options for
613 .Cm got update
614 are as follows:
615 .Bl -tag -width Ds
616 .It Fl b Ar branch
617 Switch the work tree's branch reference to the specified
618 .Ar branch
619 before updating the work tree.
620 This option requires that all paths in the work tree are updated.
621 .Pp
622 As usual, any local changes in the work tree will be preserved.
623 This can be useful when switching to a newly created branch in order
624 to commit existing local changes to this branch.
625 .Pp
626 Any local changes must be dealt with separately in order to obtain a
627 work tree with pristine file contents corresponding exactly to the specified
628 .Ar branch .
629 Such changes could first be committed to a different branch with
630 .Cm got commit ,
631 or could be discarded with
632 .Cm got revert .
633 .It Fl c Ar commit
634 Update the work tree to the specified
635 .Ar commit .
636 The expected argument is a commit ID SHA1 hash or an existing reference
637 or tag name which will be resolved to a commit ID.
638 An abbreviated hash argument will be expanded to a full SHA1 hash
639 automatically, provided the abbreviation is unique.
640 If this option is not specified, the most recent commit on the work tree's
641 branch will be used.
642 .It Fl q
643 Silence progress output.
644 .El
645 .Tg st
646 .It Cm status Oo Fl I Oc Oo Fl S Ar status-codes Oc Oo Fl s Ar status-codes Oc Op Ar path ...
647 .Dl Pq alias: Cm st
648 Show the current modification status of files in a work tree,
649 using the following status codes:
650 .Bl -column YXZ description
651 .It M Ta modified file
652 .It A Ta file scheduled for addition in next commit
653 .It D Ta file scheduled for deletion in next commit
654 .It C Ta modified or added file which contains merge conflicts
655 .It ! Ta versioned file was expected on disk but is missing
656 .It \(a~ Ta versioned file is obstructed by a non-regular file
657 .It ? Ta unversioned item not tracked by
658 .Nm
659 .It m Ta modified file modes (executable bit only)
660 .It N Ta non-existent
661 .Ar path
662 specified on the command line
663 .El
664 .Pp
665 If no
666 .Ar path
667 is specified, show modifications in the entire work tree.
668 Otherwise, show modifications at or within the specified paths.
669 .Pp
670 If changes have been staged with
671 .Cm got stage ,
672 staged changes are shown in the second output column, using the following
673 status codes:
674 .Bl -column YXZ description
675 .It M Ta file modification is staged
676 .It A Ta file addition is staged
677 .It D Ta file deletion is staged
678 .El
679 .Pp
680 Changes created on top of staged changes are indicated in the first column:
681 .Bl -column YXZ description
682 .It MM Ta file was modified after earlier changes have been staged
683 .It MA Ta file was modified after having been staged for addition
684 .El
685 .Pp
686 The options for
687 .Cm got status
688 are as follows:
689 .Bl -tag -width Ds
690 .It Fl I
691 Show unversioned files even if they match an ignore pattern.
692 .It Fl S Ar status-codes
693 Suppress the output of files with a modification status matching any of the
694 single-character status codes contained in the
695 .Ar status-codes
696 argument.
697 Any combination of codes from the above list of possible status codes
698 may be specified.
699 For staged files, status codes displayed in either column will be matched.
700 Cannot be used together with the
701 .Fl s
702 option.
703 .It Fl s Ar status-codes
704 Only show files with a modification status matching any of the
705 single-character status codes contained in the
706 .Ar status-codes
707 argument.
708 Any combination of codes from the above list of possible status codes
709 may be specified.
710 For staged files, status codes displayed in either column will be matched.
711 Cannot be used together with the
712 .Fl S
713 option.
714 .El
715 .Pp
716 For compatibility with
717 .Xr cvs 1
718 and
719 .Xr git 1 ,
720 .Cm got status
721 reads
722 .Xr glob 7
723 patterns from
724 .Pa .cvsignore
725 and
726 .Pa .gitignore
727 files in each traversed directory and will not display unversioned files
728 which match these patterns.
729 As an extension to
730 .Xr glob 7
731 matching rules,
732 .Cm got status
733 supports consecutive asterisks,
734 .Dq ** ,
735 which will match an arbitrary amount of directories.
736 Unlike
737 .Xr cvs 1 ,
738 .Cm got status
739 only supports a single ignore pattern per line.
740 Unlike
741 .Xr git 1 ,
742 .Cm got status
743 does not support negated ignore patterns prefixed with
744 .Dq \&! ,
745 and gives no special significance to the location of path component separators,
746 .Dq / ,
747 in a pattern.
748 .It Cm log Oo Fl bPpRs Oc Oo Fl C Ar number Oc Oo Fl c Ar commit Oc Oo Fl l Ar N Oc Oo Fl r Ar repository-path Oc Oo Fl S Ar search-pattern Oc Oo Fl x Ar commit Oc Op Ar path
749 Display history of a repository.
750 If a
751 .Ar path
752 is specified, show only commits which modified this path.
753 If invoked in a work tree, the
754 .Ar path
755 is interpreted relative to the current working directory,
756 and the work tree's path prefix is implicitly prepended.
757 Otherwise, the path is interpreted relative to the repository root.
758 .Pp
759 The options for
760 .Cm got log
761 are as follows:
762 .Bl -tag -width Ds
763 .It Fl b
764 Display individual commits which were merged into the current branch
765 from other branches.
766 By default,
767 .Cm got log
768 shows the linear history of the current branch only.
769 .It Fl C Ar number
770 Set the number of context lines shown in diffs with
771 .Fl p .
772 By default, 3 lines of context are shown.
773 .It Fl c Ar commit
774 Start traversing history at the specified
775 .Ar commit .
776 The expected argument is a commit ID SHA1 hash or an existing reference
777 or tag name which will be resolved to a commit ID.
778 An abbreviated hash argument will be expanded to a full SHA1 hash
779 automatically, provided the abbreviation is unique.
780 If this option is not specified, default to the work tree's current branch
781 if invoked in a work tree, or to the repository's HEAD reference.
782 .It Fl l Ar N
783 Limit history traversal to a given number of commits.
784 If this option is not specified, a default limit value of zero is used,
785 which is treated as an unbounded limit.
786 The
787 .Ev GOT_LOG_DEFAULT_LIMIT
788 environment variable may be set to change this default value.
789 .It Fl P
790 Display the list of file paths changed in each commit, using the following
791 status codes:
792 .Bl -column YXZ description
793 .It M Ta modified file
794 .It D Ta file was deleted
795 .It A Ta new file was added
796 .It m Ta modified file modes (executable bit only)
797 .El
798 .Pp
799 Cannot be used with the
800 .Fl s
801 option.
802 .It Fl p
803 Display the patch of modifications made in each commit.
804 If a
805 .Ar path
806 is specified, only show the patch of modifications at or within this path.
807 Cannot be used with the
808 .Fl s
809 option.
810 .It Fl R
811 Determine a set of commits to display as usual, but display these commits
812 in reverse order.
813 .It Fl r Ar repository-path
814 Use the repository at the specified path.
815 If not specified, assume the repository is located at or above the current
816 working directory.
817 If this directory is a
818 .Nm
819 work tree, use the repository path associated with this work tree.
820 .It Fl S Ar search-pattern
821 If specified, show only commits with a log message, author name,
822 committer name, or ID SHA1 hash matched by the extended regular
823 expression
824 .Ar search-pattern .
825 Lines in committed patches will be matched if
826 .Fl p
827 is specified.
828 File paths changed by a commit will be matched if
829 .Fl P
830 is specified.
831 Regular expression syntax is documented in
832 .Xr re_format 7 .
833 .It Fl s
834 Display a short one-line summary of each commit, instead of the default
835 history format.
836 Cannot be used together with the
837 .Fl p
838 or
839 .Fl P
840 option.
841 .It Fl x Ar commit
842 Stop traversing commit history immediately after the specified
843 .Ar commit
844 has been traversed.
845 This option has no effect if the specified
846 .Ar commit
847 is never traversed.
848 .El
849 .Tg di
850 .It Cm diff Oo Fl aPsw Oc Oo Fl C Ar number Oc Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar object1 Ar object2 | Ar path ...
851 .Dl Pq alias: Cm di
852 When invoked within a work tree without any arguments, display all
853 local changes in the work tree.
854 If one or more
855 .Ar path
856 arguments are specified, only show changes within the specified paths.
857 .Pp
858 If two arguments are provided, treat each argument as a reference, a tag
859 name, or an object ID SHA1 hash, and display differences between the
860 corresponding objects.
861 Both objects must be of the same type (blobs, trees, or commits).
862 An abbreviated hash argument will be expanded to a full SHA1 hash
863 automatically, provided the abbreviation is unique.
864 If none of these interpretations produce a valid result or if the
865 .Fl P
866 option is used,
867 and if
868 .Cm got diff
869 is running in a work tree, attempt to interpret the two arguments as paths.
870 .Pp
871 The options for
872 .Cm got diff
873 are as follows:
874 .Bl -tag -width Ds
875 .It Fl a
876 Treat file contents as ASCII text even if binary data is detected.
877 .It Fl C Ar number
878 Set the number of context lines shown in the diff.
879 By default, 3 lines of context are shown.
880 .It Fl c Ar commit
881 Show differences between commits in the repository.
882 This option may be used up to two times.
883 When used only once, show differences between the specified
884 .Ar commit
885 and its first parent commit.
886 When used twice, show differences between the two specified commits.
887 .Pp
888 The expected argument is a commit ID SHA1 hash or an existing reference
889 or tag name which will be resolved to a commit ID.
890 An abbreviated hash argument will be expanded to a full SHA1 hash
891 automatically, provided the abbreviation is unique.
892 .Pp
893 If the
894 .Fl c
895 option is used, all non-option arguments will be interpreted as paths.
896 If one or more such
897 .Ar path
898 arguments are provided, only show differences for the specified paths.
899 .Pp
900 Cannot be used together with the
901 .Fl P
902 option.
903 .It Fl P
904 Interpret all arguments as paths only.
905 This option can be used to resolve ambiguity in cases where paths
906 look like tag names, reference names, or object IDs.
907 This option is only valid when
908 .Cm got diff
909 is invoked in a work tree.
910 .It Fl r Ar repository-path
911 Use the repository at the specified path.
912 If not specified, assume the repository is located at or above the current
913 working directory.
914 If this directory is a
915 .Nm
916 work tree, use the repository path associated with this work tree.
917 .It Fl s
918 Show changes staged with
919 .Cm got stage
920 instead of showing local changes in the work tree.
921 This option is only valid when
922 .Cm got diff
923 is invoked in a work tree.
924 .It Fl w
925 Ignore whitespace-only changes.
926 .El
927 .Tg bl
928 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
929 .Dl Pq alias: Cm bl
930 Display line-by-line history of a file at the specified path.
931 .Pp
932 The options for
933 .Cm got blame
934 are as follows:
935 .Bl -tag -width Ds
936 .It Fl c Ar commit
937 Start traversing history at the specified
938 .Ar commit .
939 The expected argument is a commit ID SHA1 hash or an existing reference
940 or tag name which will be resolved to a commit ID.
941 An abbreviated hash argument will be expanded to a full SHA1 hash
942 automatically, provided the abbreviation is unique.
943 .It Fl r Ar repository-path
944 Use the repository at the specified path.
945 If not specified, assume the repository is located at or above the current
946 working directory.
947 If this directory is a
948 .Nm
949 work tree, use the repository path associated with this work tree.
950 .El
951 .Tg tr
952 .It Cm tree Oo Fl iR Oc Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Op Ar path
953 .Dl Pq alias: Cm tr
954 Display a listing of files and directories at the specified
955 directory path in the repository.
956 Entries shown in this listing may carry one of the following trailing
957 annotations:
958 .Bl -column YXZ description
959 .It @ Ta entry is a symbolic link
960 .It / Ta entry is a directory
961 .It * Ta entry is an executable file
962 .It $ Ta entry is a Git submodule
963 .El
964 .Pp
965 Symbolic link entries are also annotated with the target path of the link.
966 .Pp
967 If no
968 .Ar path
969 is specified, list the repository path corresponding to the current
970 directory of the work tree, or the root directory of the repository
971 if there is no work tree.
972 .Pp
973 The options for
974 .Cm got tree
975 are as follows:
976 .Bl -tag -width Ds
977 .It Fl c Ar commit
978 List files and directories as they appear in the specified
979 .Ar commit .
980 The expected argument is a commit ID SHA1 hash or an existing reference
981 or tag name which will be resolved to a commit ID.
982 An abbreviated hash argument will be expanded to a full SHA1 hash
983 automatically, provided the abbreviation is unique.
984 .It Fl i
985 Show object IDs of files (blob objects) and directories (tree objects).
986 .It Fl R
987 Recurse into sub-directories in the repository.
988 .It Fl r Ar repository-path
989 Use the repository at the specified path.
990 If not specified, assume the repository is located at or above the current
991 working directory.
992 If this directory is a
993 .Nm
994 work tree, use the repository path associated with this work tree.
995 .El
996 .It Cm ref Oo Fl dlt Oc Oo Fl c Ar object Oc Oo Fl r Ar repository-path Oc Oo Fl s Ar reference Oc Op Ar name
997 Manage references in a repository.
998 .Pp
999 References may be listed, created, deleted, and changed.
1000 When creating, deleting, or changing a reference the specified
1001 .Ar name
1002 must be an absolute reference name, i.e. it must begin with
1003 .Dq refs/ .
1004 .Pp
1005 The options for
1006 .Cm got ref
1007 are as follows:
1008 .Bl -tag -width Ds
1009 .It Fl c Ar object
1010 Create a reference or change an existing reference.
1011 The reference with the specified
1012 .Ar name
1013 will point at the specified
1014 .Ar object .
1015 The expected
1016 .Ar object
1017 argument is a ID SHA1 hash or an existing reference or tag name which will
1018 be resolved to the ID of a corresponding commit, tree, tag, or blob object.
1019 Cannot be used together with any other options except
1020 .Fl r .
1021 .It Fl d
1022 Delete the reference with the specified
1023 .Ar name
1024 from the repository.
1025 Any commit, tree, tag, and blob objects belonging to deleted references
1026 remain in the repository and may be removed separately with
1027 Git's garbage collector or
1028 .Cm gotadmin cleanup .
1029 Cannot be used together with any other options except
1030 .Fl r .
1031 .It Fl l
1032 List references in the repository.
1033 If no
1034 .Ar name
1035 is specified, list all existing references in the repository.
1037 .Ar name
1038 is a reference namespace, list all references in this namespace.
1039 Otherwise, show only the reference with the given
1040 .Ar name .
1041 Cannot be used together with any other options except
1042 .Fl r
1043 and
1044 .Fl t .
1045 .It Fl r Ar repository-path
1046 Use the repository at the specified path.
1047 If not specified, assume the repository is located at or above the current
1048 working directory.
1049 If this directory is a
1050 .Nm
1051 work tree, use the repository path associated with this work tree.
1052 .It Fl s Ar reference
1053 Create a symbolic reference, or change an existing symbolic reference.
1054 The symbolic reference with the specified
1055 .Ar name
1056 will point at the specified
1057 .Ar reference
1058 which must already exist in the repository.
1059 Care should be taken not to create loops between references when
1060 this option is used.
1061 Cannot be used together with any other options except
1062 .Fl r .
1063 .It Fl t
1064 Sort listed references by modification time (most recently modified first)
1065 instead of sorting by lexicographical order.
1066 Use of this option requires the
1067 .Fl l
1068 option to be used as well.
1069 .El
1070 .Tg br
1071 .It Cm branch Oo Fl lnt Oc Oo Fl c Ar commit Oc Oo Fl d Ar name Oc Oo Fl r Ar repository-path Oc Op Ar name
1072 .Dl Pq alias: Cm br
1073 Create, list, or delete branches.
1074 .Pp
1075 Local branches are managed via references which live in the
1076 .Dq refs/heads/
1077 reference namespace.
1078 The
1079 .Cm got branch
1080 command creates references in this namespace only.
1081 .Pp
1082 When deleting branches, the specified
1083 .Ar name
1084 is searched in the
1085 .Dq refs/heads
1086 reference namespace first.
1087 If no corresponding branch is found, the
1088 .Dq refs/remotes
1089 namespace will be searched next.
1090 .Pp
1091 If invoked in a work tree without any arguments, print the name of the
1092 work tree's current branch.
1093 .Pp
1094 If a
1095 .Ar name
1096 argument is passed, attempt to create a branch reference with the given name.
1097 By default the new branch reference will point at the latest commit on the
1098 work tree's current branch if invoked in a work tree, and otherwise to a commit
1099 resolved via the repository's HEAD reference.
1100 .Pp
1101 If invoked in a work tree, once the branch was created successfully
1102 switch the work tree's head reference to the newly created branch and
1103 update files across the entire work tree, just like
1104 .Cm got update -b Ar name
1105 would do.
1106 Show the status of each affected file, using the following status codes:
1107 .Bl -column YXZ description
1108 .It U Ta file was updated and contained no local changes
1109 .It G Ta file was updated and local changes were merged cleanly
1110 .It C Ta file was updated and conflicts occurred during merge
1111 .It D Ta file was deleted
1112 .It A Ta new file was added
1113 .It \(a~ Ta versioned file is obstructed by a non-regular file
1114 .It ! Ta a missing versioned file was restored
1115 .El
1116 .Pp
1117 The options for
1118 .Cm got branch
1119 are as follows:
1120 .Bl -tag -width Ds
1121 .It Fl c Ar commit
1122 Make a newly created branch reference point at the specified
1123 .Ar commit .
1124 The expected
1125 .Ar commit
1126 argument is a commit ID SHA1 hash or an existing reference
1127 or tag name which will be resolved to a commit ID.
1128 .It Fl d Ar name
1129 Delete the branch with the specified
1130 .Ar name
1131 from the
1132 .Dq refs/heads
1134 .Dq refs/remotes
1135 reference namespace.
1136 .Pp
1137 Only the branch reference is deleted.
1138 Any commit, tree, and blob objects belonging to the branch
1139 remain in the repository and may be removed separately with
1140 Git's garbage collector or
1141 .Cm gotadmin cleanup .
1142 .It Fl l
1143 List all existing branches in the repository, including copies of remote
1144 repositories' branches in the
1145 .Dq refs/remotes/
1146 reference namespace.
1147 .Pp
1148 If invoked in a work tree, the work tree's current branch is shown
1149 with one the following annotations:
1150 .Bl -column YXZ description
1151 .It * Ta work tree's base commit matches the branch tip
1152 .It \(a~ Ta work tree's base commit is out-of-date
1153 .El
1154 .It Fl n
1155 Do not switch and update the work tree after creating a new branch.
1156 .It Fl r Ar repository-path
1157 Use the repository at the specified path.
1158 If not specified, assume the repository is located at or above the current
1159 working directory.
1160 If this directory is a
1161 .Nm
1162 work tree, use the repository path associated with this work tree.
1163 .It Fl t
1164 Sort listed branches by modification time (most recently modified first)
1165 instead of sorting by lexicographical order.
1166 Branches in the
1167 .Dq refs/heads/
1168 reference namespace are listed before branches in
1169 .Dq refs/remotes/
1170 regardless.
1171 Use of this option requires the
1172 .Fl l
1173 option to be used as well.
1174 .El
1175 .It Cm tag Oo Fl lVv Oc Oo Fl c Ar commit Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl s Ar signer-id Oc Ar name
1176 Manage tags in a repository.
1177 .Pp
1178 Tags are managed via references which live in the
1179 .Dq refs/tags/
1180 reference namespace.
1181 The
1182 .Cm got tag
1183 command operates on references in this namespace only.
1184 References in this namespace point at tag objects which contain a pointer
1185 to another object, a tag message, as well as author and timestamp information.
1186 .Pp
1187 Attempt to create a tag with the given
1188 .Ar name ,
1189 and make this tag point at the given
1190 .Ar commit .
1191 If no commit is specified, default to the latest commit on the work tree's
1192 current branch if invoked in a work tree, and to a commit resolved via
1193 the repository's HEAD reference otherwise.
1194 .Pp
1195 The options for
1196 .Cm got tag
1197 are as follows:
1198 .Bl -tag -width Ds
1199 .It Fl c Ar commit
1200 Make the newly created tag reference point at the specified
1201 .Ar commit .
1202 The expected
1203 .Ar commit
1204 argument is a commit ID SHA1 hash or an existing reference or tag name which
1205 will be resolved to a commit ID.
1206 An abbreviated hash argument will be expanded to a full SHA1 hash
1207 automatically, provided the abbreviation is unique.
1208 .It Fl l
1209 List all existing tags in the repository instead of creating a new tag.
1210 If a
1211 .Ar name
1212 argument is passed, show only the tag with the given
1213 .Ar name .
1214 .It Fl m Ar message
1215 Use the specified tag message when creating the new tag.
1216 Without the
1217 .Fl m
1218 option,
1219 .Cm got tag
1220 opens a temporary file in an editor where a tag message can be written.
1221 .It Fl r Ar repository-path
1222 Use the repository at the specified path.
1223 If not specified, assume the repository is located at or above the current
1224 working directory.
1225 If this directory is a
1226 .Nm
1227 work tree, use the repository path associated with this work tree.
1228 .It Fl s Ar signer-id
1229 While creating a new tag, sign this tag with the identity given in
1230 .Ar signer-id .
1231 .Pp
1232 For SSH-based signatures,
1233 .Ar signer-id
1234 is the path to a file which may refer to either a private SSH key,
1235 or a public SSH key with the private half available via
1236 .Xr ssh-agent 1 .
1237 .Cm got tag
1238 will sign the tag object by invoking
1239 .Xr ssh-keygen 1
1240 with the
1241 .Fl Y Cm sign
1242 command, using the signature namespace
1243 .Dq git
1244 for compatibility with
1245 .Xr git 1 .
1246 .It Fl V
1247 Verify tag object signatures.
1248 If a
1249 .Ar name
1250 is specified, show and verify the tag object with the provided name.
1251 Otherwise, list all tag objects and verify signatures where present.
1252 .Pp
1253 .Cm got tag
1254 verifies SSH-based signatures by invoking
1255 .Xr ssh-keygen 1
1256 with the options
1257 .Fl Y Cm verify Fl f Ar allowed_signers .
1258 A path to the
1259 .Ar allowed_signers
1260 file must be set in
1261 .Xr got.conf 5 ,
1262 otherwise verification is impossible.
1263 .It Fl v
1264 Verbose mode.
1265 During SSH signature creation and verification this option will be passed to
1266 .Xr ssh-keygen 1 .
1267 Multiple -v options increase the verbosity.
1268 The maximum is 3.
1269 .El
1270 .Pp
1271 By design, the
1272 .Cm got tag
1273 command will not delete tags or change existing tags.
1274 If a tag must be deleted, the
1275 .Cm got ref
1276 command may be used to delete a tag's reference.
1277 This should only be done if the tag has not already been copied to
1278 another repository.
1279 .It Cm add Oo Fl IR Oc Ar path ...
1280 Schedule unversioned files in a work tree for addition to the
1281 repository in the next commit.
1282 By default, files which match a
1283 .Cm got status
1284 ignore pattern will not be added.
1285 .Pp
1286 The options for
1287 .Cm got add
1288 are as follows:
1289 .Bl -tag -width Ds
1290 .It Fl I
1291 Add files even if they match a
1292 .Cm got status
1293 ignore pattern.
1294 .It Fl R
1295 Permit recursion into directories.
1296 If this option is not specified,
1297 .Cm got add
1298 will refuse to run if a specified
1299 .Ar path
1300 is a directory.
1301 .El
1302 .Tg rm
1303 .It Cm remove Oo Fl fkR Oc Oo Fl s Ar status-codes Oc Ar path ...
1304 .Dl Pq alias: Cm rm
1305 Remove versioned files from a work tree and schedule them for deletion
1306 from the repository in the next commit.
1307 .Pp
1308 The options for
1309 .Cm got remove
1310 are as follows:
1311 .Bl -tag -width Ds
1312 .It Fl f
1313 Perform the operation even if a file contains local modifications,
1314 and do not raise an error if a specified
1315 .Ar path
1316 does not exist on disk.
1317 .It Fl k
1318 Keep affected files on disk.
1319 .It Fl R
1320 Permit recursion into directories.
1321 If this option is not specified,
1322 .Cm got remove
1323 will refuse to run if a specified
1324 .Ar path
1325 is a directory.
1326 .It Fl s Ar status-codes
1327 Only delete files with a modification status matching one of the
1328 single-character status codes contained in the
1329 .Ar status-codes
1330 argument.
1331 The following status codes may be specified:
1332 .Bl -column YXZ description
1333 .It M Ta modified file (this implies the
1334 .Fl f
1335 option)
1336 .It ! Ta versioned file expected on disk but missing
1337 .El
1338 .El
1339 .Tg pa
1340 .It Cm patch Oo Fl nR Oc Oo Fl c Ar commit Oc Oo Fl p Ar strip-count Oc Op Ar patchfile
1341 .Dl Pq alias: Cm pa
1342 Apply changes from
1343 .Ar patchfile
1344 to files in a work tree.
1345 Files added or removed by a patch will be scheduled for addition or removal in
1346 the work tree.
1347 .Pp
1348 The patch must be in the unified diff format as produced by
1349 .Cm got diff ,
1350 .Xr git-diff 1 ,
1351 or by
1352 .Xr diff 1
1353 and
1354 .Xr cvs 1
1355 diff when invoked with their
1356 .Fl u
1357 options.
1358 If no
1359 .Ar patchfile
1360 argument is provided, read unified diff data from standard input instead.
1361 .Pp
1362 If the
1363 .Ar patchfile
1364 contains multiple patches, then attempt to apply each of them in sequence.
1365 .Pp
1366 Show the status of each affected file, using the following status codes:
1367 .Bl -column XYZ description
1368 .It M Ta file was modified
1369 .It G Ta file was merged using a merge-base found in the repository
1370 .It C Ta file was merged and conflicts occurred during merge
1371 .It D Ta file was deleted
1372 .It A Ta file was added
1373 .It # Ta failed to patch the file
1374 .El
1375 .Pp
1376 If a change does not match at its exact line number, attempt to
1377 apply it somewhere else in the file if a good spot can be found.
1378 Otherwise, the patch will fail to apply.
1379 .Pp
1380 .Nm
1381 .Cm patch
1382 will refuse to apply a patch if certain preconditions are not met.
1383 Files to be deleted must already be under version control, and must
1384 not have been scheduled for deletion already.
1385 Files to be added must not yet be under version control and must not
1386 already be present on disk.
1387 Files to be modified must already be under version control and may not
1388 contain conflict markers.
1389 .Pp
1390 If an error occurs, the
1391 .Cm patch
1392 operation will be aborted.
1393 Any changes made to the work tree up to this point will be left behind.
1394 Such changes can be viewed with
1395 .Cm got diff
1396 and can be reverted with
1397 .Cm got revert
1398 if needed.
1399 .Pp
1400 The options for
1401 .Cm got patch
1402 are as follows:
1403 .Bl -tag -width Ds
1404 .It Fl c Ar commit
1405 Attempt to locate files within the specified
1406 .Ar commit
1407 for use as a merge-base for 3-way merges.
1408 Ideally, the specified
1409 .Ar commit
1410 should contain versions of files which the changes contained in the
1411 .Ar patchfile
1412 were based on.
1413 Files will be located by path, relative to the repository root.
1414 If the
1415 .Fl p
1416 option is used then leading path components will be stripped
1417 before paths are looked up in the repository.
1418 .Pp
1419 If the
1420 .Fl c
1421 option is not used then
1422 .Cm got patch
1423 will attempt to locate merge-bases via object IDs found in
1424 .Ar patchfile
1425 meta-data, such as produced by
1426 .Cm got diff
1428 .Xr git-diff 1 .
1429 Use of the
1430 .Fl c
1431 option is only recommended in the absence of such meta-data.
1432 .Pp
1433 In case no merge-base is available for a file, changes will be applied
1434 without doing a 3-way merge.
1435 Changes which do not apply cleanly may then be rejected entirely, rather
1436 than producing merge conflicts in the patched target file.
1437 .It Fl n
1438 Do not make any modifications to the work tree.
1439 This can be used to check whether a patch would apply without issues.
1440 If the
1441 .Ar patchfile
1442 contains diffs that affect the same file multiple times, the results
1443 displayed may be incorrect.
1444 .It Fl p Ar strip-count
1445 Specify the number of leading path components to strip from paths
1446 parsed from
1447 .Ar patchfile .
1448 If the
1449 .Fl p
1450 option is not used,
1451 .Sq a/
1452 and
1453 .Sq b/
1454 path prefixes generated by
1455 .Xr git-diff 1
1456 will be recognized and stripped automatically.
1457 .It Fl R
1458 Reverse the patch before applying it.
1459 .El
1460 .Tg rv
1461 .It Cm revert Oo Fl pR Oc Oo Fl F Ar response-script Oc Ar path ...
1462 .Dl Pq alias: Cm rv
1463 Revert any local changes in files at the specified paths in a work tree.
1464 File contents will be overwritten with those contained in the
1465 work tree's base commit.
1466 There is no way to bring discarded changes back after
1467 .Cm got revert !
1468 .Pp
1469 If a file was added with
1470 .Cm got add ,
1471 it will become an unversioned file again.
1472 If a file was deleted with
1473 .Cm got remove ,
1474 it will be restored.
1475 .Pp
1476 The options for
1477 .Cm got revert
1478 are as follows:
1479 .Bl -tag -width Ds
1480 .It Fl F Ar response-script
1481 With the
1482 .Fl p
1483 option, read
1484 .Dq y ,
1485 .Dq n ,
1486 and
1487 .Dq q
1488 responses line-by-line from the specified
1489 .Ar response-script
1490 file instead of prompting interactively.
1491 .It Fl p
1492 Instead of reverting all changes in files, interactively select or reject
1493 changes to revert based on
1494 .Dq y
1495 (revert change),
1496 .Dq n
1497 (keep change), and
1498 .Dq q
1499 (quit reverting this file) responses.
1500 If a file is in modified status, individual patches derived from the
1501 modified file content can be reverted.
1502 Files in added or deleted status may only be reverted in their entirety.
1503 .It Fl R
1504 Permit recursion into directories.
1505 If this option is not specified,
1506 .Cm got revert
1507 will refuse to run if a specified
1508 .Ar path
1509 is a directory.
1510 .El
1511 .Tg ci
1512 .It Cm commit Oo Fl NS Oc Oo Fl A Ar author Oc Oo Fl F Ar path Oc Oo Fl m Ar message Oc Op Ar path ...
1513 .Dl Pq alias: Cm ci
1514 Create a new commit in the repository from changes in a work tree
1515 and use this commit as the new base commit for the work tree.
1516 If no
1517 .Ar path
1518 is specified, commit all changes in the work tree.
1519 Otherwise, commit changes at or within the specified paths.
1520 .Pp
1521 If changes have been explicitly staged for commit with
1522 .Cm got stage ,
1523 only commit staged changes and reject any specified paths which
1524 have not been staged.
1525 .Pp
1526 .Cm got commit
1527 opens a temporary file in an editor where a log message can be written
1528 unless the
1529 .Fl m
1530 option is used
1531 or the
1532 .Fl F
1533 and
1534 .Fl N
1535 options are used together.
1536 .Pp
1537 Show the status of each affected file, using the following status codes:
1538 .Bl -column YXZ description
1539 .It M Ta modified file
1540 .It D Ta file was deleted
1541 .It A Ta new file was added
1542 .It m Ta modified file modes (executable bit only)
1543 .El
1544 .Pp
1545 Files which are not part of the new commit will retain their previously
1546 recorded base commit.
1547 Some
1548 .Nm
1549 commands may refuse to run while the work tree contains files from
1550 multiple base commits.
1551 The base commit of such a work tree can be made consistent by running
1552 .Cm got update
1553 across the entire work tree.
1554 .Pp
1555 The
1556 .Cm got commit
1557 command requires the
1558 .Ev GOT_AUTHOR
1559 environment variable to be set,
1560 unless an author has been configured in
1561 .Xr got.conf 5
1562 or Git's
1563 .Dv user.name
1564 and
1565 .Dv user.email
1566 configuration settings can be
1567 obtained from the repository's
1568 .Pa .git/config
1569 file or from Git's global
1570 .Pa ~/.gitconfig
1571 configuration file.
1572 .Pp
1573 The options for
1574 .Cm got commit
1575 are as follows:
1576 .Bl -tag -width Ds
1577 .It Fl A Ar author
1578 Set author information in the newly created commit to
1579 .Ar author .
1580 This is useful when committing changes which were written by someone
1581 else.
1582 The
1583 .Ar author
1584 argument must use the same format as the
1585 .Ev GOT_AUTHOR
1586 environment variable.
1587 .Pp
1588 In addition to storing author information, the newly created commit
1589 object will retain
1590 .Dq committer
1591 information which is obtained, as usual, from the
1592 .Ev GOT_AUTHOR
1593 environment variable, or
1594 .Xr got.conf 5 ,
1595 or Git configuration settings.
1596 .It Fl F Ar path
1597 Use the prepared log message stored in the file found at
1598 .Ar path
1599 when creating the new commit.
1600 .Cm got commit
1601 opens a temporary file in an editor where the prepared log message can be
1602 reviewed and edited further if needed.
1603 Cannot be used together with the
1604 .Fl m
1605 option.
1606 .It Fl m Ar message
1607 Use the specified log message when creating the new commit.
1608 Cannot be used together with the
1609 .Fl F
1610 option.
1611 .It Fl N
1612 This option prevents
1613 .Cm got commit
1614 from opening the commit message in an editor.
1615 It has no effect unless it is used together with the
1616 .Fl F
1617 option and is intended for non-interactive use such as scripting.
1618 .It Fl S
1619 Allow the addition of symbolic links which point outside of the path space
1620 that is under version control.
1621 By default,
1622 .Cm got commit
1623 will reject such symbolic links due to safety concerns.
1624 As a precaution,
1625 .Nm
1626 may decide to represent such a symbolic link as a regular file which contains
1627 the link's target path, rather than creating an actual symbolic link which
1628 points outside of the work tree.
1629 Use of this option is discouraged because external mechanisms such as
1630 .Dq make obj
1631 are better suited for managing symbolic links to paths not under
1632 version control.
1633 .El
1634 .Pp
1635 .Cm got commit
1636 will refuse to run if certain preconditions are not met.
1637 If the work tree's current branch is not in the
1638 .Dq refs/heads/
1639 reference namespace, new commits may not be created on this branch.
1640 Local changes may only be committed if they are based on file content
1641 found in the most recent commit on the work tree's branch.
1642 If a path is found to be out of date,
1643 .Cm got update
1644 must be used first in order to merge local changes with changes made
1645 in the repository.
1646 .Tg se
1647 .It Cm send Oo Fl afqTv Oc Oo Fl b Ar branch Oc Oo Fl d Ar branch Oc Oo Fl r Ar repository-path Oc Oo Fl t Ar tag Oc Op Ar remote-repository
1648 .Dl Pq alias: Cm se
1649 Send new changes to a remote repository.
1650 If no
1651 .Ar remote-repository
1652 is specified,
1653 .Dq origin
1654 will be used.
1655 The remote repository's URL is obtained from the corresponding entry in
1656 .Xr got.conf 5
1657 or Git's
1658 .Pa config
1659 file of the local repository, as created by
1660 .Cm got clone .
1661 .Pp
1662 All objects corresponding to new changes will be written to a temporary
1663 pack file which is then uploaded to the server.
1664 Upon success, references in the
1665 .Dq refs/remotes/
1666 reference namespace of the local repository will be updated to point at
1667 the commits which have been sent.
1668 .Pp
1669 By default, changes will only be sent if they are based on up-to-date
1670 copies of relevant branches in the remote repository.
1671 If any changes to be sent are based on out-of-date copies or would
1672 otherwise break linear history of existing branches, new changes must
1673 be fetched from the server with
1674 .Cm got fetch
1675 and local branches must be rebased with
1676 .Cm got rebase
1677 before
1678 .Cm got send
1679 can succeed.
1680 The
1681 .Fl f
1682 option can be used to make exceptions to these requirements.
1683 .Pp
1684 The options for
1685 .Cm got send
1686 are as follows:
1687 .Bl -tag -width Ds
1688 .It Fl a
1689 Send all branches from the local repository's
1690 .Dq refs/heads/
1691 reference namespace.
1692 The
1693 .Fl a
1694 option is equivalent to listing all branches with multiple
1695 .Fl b
1696 options.
1697 Cannot be used together with the
1698 .Fl b
1699 option.
1700 .It Fl b Ar branch
1701 Send the specified
1702 .Ar branch
1703 from the local repository's
1704 .Dq refs/heads/
1705 reference namespace.
1706 This option may be specified multiple times to build a list of branches
1707 to send.
1708 If this option is not specified, default to the work tree's current branch
1709 if invoked in a work tree, or to the repository's HEAD reference.
1710 Cannot be used together with the
1711 .Fl a
1712 option.
1713 .It Fl d Ar branch
1714 Delete the specified
1715 .Ar branch
1716 from the remote repository's
1717 .Dq refs/heads/
1718 reference namespace.
1719 This option may be specified multiple times to build a list of branches
1720 to delete.
1721 .Pp
1722 Only references are deleted.
1723 Any commit, tree, tag, and blob objects belonging to deleted branches
1724 may become subject to deletion by Git's garbage collector running on
1725 the server.
1726 .Pp
1727 Requesting deletion of branches results in an error if the server
1728 does not support this feature or disallows the deletion of branches
1729 based on its configuration.
1730 .It Fl f
1731 Attempt to force the server to overwrite existing branches or tags
1732 in the remote repository, even when
1733 .Cm got fetch
1734 and
1735 .Cm got rebase
1736 would usually be required before changes can be sent.
1737 The server may reject forced requests regardless, depending on its
1738 configuration.
1739 .Pp
1740 Any commit, tree, tag, and blob objects belonging to overwritten branches
1741 or tags may become subject to deletion by Git's garbage collector running
1742 on the server.
1743 .Pp
1744 The
1745 .Dq refs/tags
1746 reference namespace is globally shared between all repositories.
1747 Use of the
1748 .Fl f
1749 option to overwrite tags is discouraged because it can lead to
1750 inconsistencies between the tags present in different repositories.
1751 In general, creating a new tag with a different name is recommended
1752 instead of overwriting an existing tag.
1753 .Pp
1754 Use of the
1755 .Fl f
1756 option is particularly discouraged if changes being sent are based
1757 on an out-of-date copy of a branch in the remote repository.
1758 Instead of using the
1759 .Fl f
1760 option, new changes should
1761 be fetched with
1762 .Cm got fetch
1763 and local branches should be rebased with
1764 .Cm got rebase ,
1765 followed by another attempt to send the changes.
1766 .Pp
1767 The
1768 .Fl f
1769 option should only be needed in situations where the remote repository's
1770 copy of a branch or tag is known to be out-of-date and is considered
1771 disposable.
1772 The risks of creating inconsistencies between different repositories
1773 should also be taken into account.
1774 .It Fl q
1775 Suppress progress reporting output.
1776 The same option will be passed to
1777 .Xr ssh 1
1778 if applicable.
1779 .It Fl r Ar repository-path
1780 Use the repository at the specified path.
1781 If not specified, assume the repository is located at or above the current
1782 working directory.
1783 If this directory is a
1784 .Nm
1785 work tree, use the repository path associated with this work tree.
1786 .It Fl T
1787 Attempt to send all tags from the local repository's
1788 .Dq refs/tags/
1789 reference namespace.
1790 The
1791 .Fl T
1792 option is equivalent to listing all tags with multiple
1793 .Fl t
1794 options.
1795 Cannot be used together with the
1796 .Fl t
1797 option.
1798 .It Fl t Ar tag
1799 Send the specified
1800 .Ar tag
1801 from the local repository's
1802 .Dq refs/tags/
1803 reference namespace, in addition to any branches that are being sent.
1804 The
1805 .Fl t
1806 option may be specified multiple times to build a list of tags to send.
1807 No tags will be sent if the
1808 .Fl t
1809 option is not used.
1810 .Pp
1811 Raise an error if the specified
1812 .Ar tag
1813 already exists in the remote repository, unless the
1814 .Fl f
1815 option is used to overwrite the server's copy of the tag.
1816 In general, creating a new tag with a different name is recommended
1817 instead of overwriting an existing tag.
1818 .Pp
1819 Cannot be used together with the
1820 .Fl T
1821 option.
1822 .It Fl v
1823 Verbose mode.
1824 Causes
1825 .Cm got send
1826 to print debugging messages to standard error output.
1827 The same option will be passed to
1828 .Xr ssh 1
1829 if applicable.
1830 Multiple -v options increase the verbosity.
1831 The maximum is 3.
1832 .El
1833 .Tg cy
1834 .It Cm cherrypick Ar commit
1835 .Dl Pq alias: Cm cy
1836 Merge changes from a single
1837 .Ar commit
1838 into the work tree.
1839 The specified
1840 .Ar commit
1841 should be on a different branch than the work tree's base commit.
1842 The expected argument is a reference or a commit ID SHA1 hash.
1843 An abbreviated hash argument will be expanded to a full SHA1 hash
1844 automatically, provided the abbreviation is unique.
1845 .Pp
1846 Show the status of each affected file, using the following status codes:
1847 .Bl -column YXZ description
1848 .It G Ta file was merged
1849 .It C Ta file was merged and conflicts occurred during merge
1850 .It ! Ta changes destined for a missing file were not merged
1851 .It D Ta file was deleted
1852 .It d Ta file's deletion was prevented by local modifications
1853 .It A Ta new file was added
1854 .It \(a~ Ta changes destined for a non-regular file were not merged
1855 .It ? Ta changes destined for an unversioned file were not merged
1856 .El
1857 .Pp
1858 The merged changes will appear as local changes in the work tree, which
1859 may be viewed with
1860 .Cm got diff ,
1861 amended manually or with further
1862 .Cm got cherrypick
1863 commands,
1864 committed with
1865 .Cm got commit ,
1866 or discarded again with
1867 .Cm got revert .
1868 .Pp
1869 .Cm got cherrypick
1870 will refuse to run if certain preconditions are not met.
1871 If the work tree contains multiple base commits, it must first be updated
1872 to a single base commit with
1873 .Cm got update .
1874 If any relevant files already contain merge conflicts, these
1875 conflicts must be resolved first.
1876 .Tg bo
1877 .It Cm backout Ar commit
1878 .Dl Pq alias: Cm bo
1879 Reverse-merge changes from a single
1880 .Ar commit
1881 into the work tree.
1882 The specified
1883 .Ar commit
1884 should be on the same branch as the work tree's base commit.
1885 The expected argument is a reference or a commit ID SHA1 hash.
1886 An abbreviated hash argument will be expanded to a full SHA1 hash
1887 automatically, provided the abbreviation is unique.
1888 .Pp
1889 Show the status of each affected file, using the following status codes:
1890 .Bl -column YXZ description
1891 .It G Ta file was merged
1892 .It C Ta file was merged and conflicts occurred during merge
1893 .It ! Ta changes destined for a missing file were not merged
1894 .It D Ta file was deleted
1895 .It d Ta file's deletion was prevented by local modifications
1896 .It A Ta new file was added
1897 .It \(a~ Ta changes destined for a non-regular file were not merged
1898 .It ? Ta changes destined for an unversioned file were not merged
1899 .El
1900 .Pp
1901 The reverse-merged changes will appear as local changes in the work tree,
1902 which may be viewed with
1903 .Cm got diff ,
1904 amended manually or with further
1905 .Cm got backout
1906 commands,
1907 committed with
1908 .Cm got commit ,
1909 or discarded again with
1910 .Cm got revert .
1911 .Pp
1912 .Cm got backout
1913 will refuse to run if certain preconditions are not met.
1914 If the work tree contains multiple base commits, it must first be updated
1915 to a single base commit with
1916 .Cm got update .
1917 If any relevant files already contain merge conflicts, these
1918 conflicts must be resolved first.
1919 .Tg rb
1920 .It Cm rebase Oo Fl aclX Oc Op Ar branch
1921 .Dl Pq alias: Cm rb
1922 Rebase commits on the specified
1923 .Ar branch
1924 onto the tip of the current branch of the work tree.
1925 The
1926 .Ar branch
1927 must share common ancestry with the work tree's current branch.
1928 Rebasing begins with the first descendant commit of the youngest
1929 common ancestor commit shared by the specified
1930 .Ar branch
1931 and the work tree's current branch, and stops once the tip commit
1932 of the specified
1933 .Ar branch
1934 has been rebased.
1935 .Pp
1936 When
1937 .Cm got rebase
1938 is used as intended, the specified
1939 .Ar branch
1940 represents a local commit history and may already contain changes
1941 that are not yet visible in any other repositories.
1942 The work tree's current branch, which must be set with
1943 .Cm got update -b
1944 before starting the
1945 .Cm rebase
1946 operation, represents a branch from a remote repository which shares
1947 a common history with the specified
1948 .Ar branch
1949 but has progressed, and perhaps diverged, due to commits added to the
1950 remote repository.
1951 .Pp
1952 Rebased commits are accumulated on a temporary branch which the work tree
1953 will remain switched to throughout the entire rebase operation.
1954 Commits on this branch represent the same changes with the same log
1955 messages as their counterparts on the original
1956 .Ar branch ,
1957 but with different commit IDs.
1958 Once rebasing has completed successfully, the temporary branch becomes
1959 the new version of the specified
1960 .Ar branch
1961 and the work tree is automatically switched to it.
1962 If author information is available via the
1963 .Ev GOT_AUTHOR
1964 environment variable,
1965 .Xr got.conf 5
1966 or Git's
1967 .Dv user.name
1968 and
1969 .Dv user.email
1970 configuration settings, this author information will be used to identify
1971 the
1972 .Dq committer
1973 of rebased commits.
1974 .Pp
1975 Old commits in their pre-rebase state are automatically backed up in the
1976 .Dq refs/got/backup/rebase
1977 reference namespace.
1978 As long as these references are not removed older versions of rebased
1979 commits will remain in the repository and can be viewed with the
1980 .Cm got rebase -l
1981 command.
1982 Removal of these references makes objects which become unreachable via
1983 any reference subject to removal by Git's garbage collector or
1984 .Cm gotadmin cleanup .
1985 .Pp
1986 While rebasing commits, show the status of each affected file,
1987 using the following status codes:
1988 .Bl -column YXZ description
1989 .It G Ta file was merged
1990 .It C Ta file was merged and conflicts occurred during merge
1991 .It ! Ta changes destined for a missing file were not merged
1992 .It D Ta file was deleted
1993 .It d Ta file's deletion was prevented by local modifications
1994 .It A Ta new file was added
1995 .It \(a~ Ta changes destined for a non-regular file were not merged
1996 .It ? Ta changes destined for an unversioned file were not merged
1997 .El
1998 .Pp
1999 If merge conflicts occur, the rebase operation is interrupted and may
2000 be continued once conflicts have been resolved.
2001 If any files with destined changes are found to be missing or unversioned,
2002 or if files could not be deleted due to differences in deleted content,
2003 the rebase operation will be interrupted to prevent potentially incomplete
2004 changes from being committed to the repository without user intervention.
2005 The work tree may be modified as desired and the rebase operation can be
2006 continued once the changes present in the work tree are considered complete.
2007 Alternatively, the rebase operation may be aborted which will leave
2008 .Ar branch
2009 unmodified and the work tree switched back to its original branch.
2010 .Pp
2011 If a merge conflict is resolved in a way which renders the merged
2012 change into a no-op change, the corresponding commit will be elided
2013 when the rebase operation continues.
2014 .Pp
2015 .Cm got rebase
2016 will refuse to run if certain preconditions are not met.
2017 If the work tree is not yet fully updated to the tip commit of its
2018 branch, then the work tree must first be updated with
2019 .Cm got update .
2020 If changes have been staged with
2021 .Cm got stage ,
2022 these changes must first be committed with
2023 .Cm got commit
2024 or unstaged with
2025 .Cm got unstage .
2026 If the work tree contains local changes, these changes must first be
2027 committed with
2028 .Cm got commit
2029 or reverted with
2030 .Cm got revert .
2031 If the
2032 .Ar branch
2033 contains changes to files outside of the work tree's path prefix,
2034 the work tree cannot be used to rebase this branch.
2035 .Pp
2036 The
2037 .Cm got update
2038 and
2039 .Cm got commit
2040 commands will refuse to run while a rebase operation is in progress.
2041 Other commands which manipulate the work tree may be used for
2042 conflict resolution purposes.
2043 .Pp
2044 If the specified
2045 .Ar branch
2046 is already based on the work tree's current branch, then no commits
2047 need to be rebased and
2048 .Cm got rebase
2049 will simply switch the work tree to the specified
2050 .Ar branch
2051 and update files in the work tree accordingly.
2052 .Pp
2053 The options for
2054 .Cm got rebase
2055 are as follows:
2056 .Bl -tag -width Ds
2057 .It Fl a
2058 Abort an interrupted rebase operation.
2059 If this option is used, no other command-line arguments are allowed.
2060 .It Fl c
2061 Continue an interrupted rebase operation.
2062 If this option is used, no other command-line arguments are allowed.
2063 .It Fl l
2064 Show a list of past rebase operations, represented by references in the
2065 .Dq refs/got/backup/rebase
2066 reference namespace.
2067 .Pp
2068 Display the author, date, and log message of each backed up commit,
2069 the object ID of the corresponding post-rebase commit, and
2070 the object ID of their common ancestor commit.
2071 Given these object IDs,
2072 the
2073 .Cm got log
2074 command with the
2075 .Fl c
2076 and
2077 .Fl x
2078 options can be used to examine the history of either version of the branch,
2079 and the
2080 .Cm got branch
2081 command with the
2082 .Fl c
2083 option can be used to create a new branch from a pre-rebase state if desired.
2084 .Pp
2085 If a
2086 .Ar branch
2087 is specified, only show commits which at some point in time represented this
2088 branch.
2089 Otherwise, list all backed up commits for any branches.
2090 .Pp
2091 If this option is used,
2092 .Cm got rebase
2093 does not require a work tree.
2094 None of the other options can be used together with
2095 .Fl l .
2096 .It Fl X
2097 Delete backups created by past rebase operations, represented by references
2098 in the
2099 .Dq refs/got/backup/rebase
2100 reference namespace.
2101 .Pp
2102 If a
2103 .Ar branch
2104 is specified, only delete backups which at some point in time represented
2105 this branch.
2106 Otherwise, delete all references found within
2107 .Dq refs/got/backup/rebase .
2108 .Pp
2109 Any commit, tree, tag, and blob objects belonging to deleted backups
2110 remain in the repository and may be removed separately with
2111 Git's garbage collector or
2112 .Cm gotadmin cleanup .
2113 .Pp
2114 If this option is used,
2115 .Cm got rebase
2116 does not require a work tree.
2117 None of the other options can be used together with
2118 .Fl X .
2119 .El
2120 .Tg he
2121 .It Cm histedit Oo Fl aceflmX Oc Oo Fl F Ar histedit-script Oc Op Ar branch
2122 .Dl Pq alias: Cm he
2123 Edit commit history between the work tree's current base commit and
2124 the tip commit of the work tree's current branch.
2125 .Pp
2126 The
2127 .Cm got histedit
2128 command requires the
2129 .Ev GOT_AUTHOR
2130 environment variable to be set,
2131 unless an author has been configured in
2132 .Xr got.conf 5
2133 or Git's
2134 .Dv user.name
2135 and
2136 .Dv user.email
2137 configuration settings can be obtained from the repository's
2138 .Pa .git/config
2139 file or from Git's global
2140 .Pa ~/.gitconfig
2141 configuration file.
2142 .Pp
2143 Before starting a
2144 .Cm histedit
2145 operation, the work tree's current branch must be set with
2146 .Cm got update -b
2147 to the branch which should be edited, unless this branch is already the
2148 current branch of the work tree.
2149 The tip of this branch represents the upper bound (inclusive) of commits
2150 touched by the
2151 .Cm histedit
2152 operation.
2153 .Pp
2154 Furthermore, the work tree's base commit
2155 must be set with
2156 .Cm got update -c
2157 to a point in this branch's commit history where editing should begin.
2158 This commit represents the lower bound (non-inclusive) of commits touched
2159 by the
2160 .Cm histedit
2161 operation.
2162 .Pp
2163 Editing of commit history is controlled via a
2164 .Ar histedit script
2165 which can be written in an editor based on a template, passed on the
2166 command line, or generated with the
2167 .Fl f
2169 .Fl m
2170 options.
2171 .Pp
2172 The format of the histedit script is line-based.
2173 Each line in the script begins with a command name, followed by
2174 whitespace and an argument.
2175 For most commands, the expected argument is a commit ID SHA1 hash.
2176 Any remaining text on the line is ignored.
2177 Lines which begin with the
2178 .Sq #
2179 character are ignored entirely.
2180 .Pp
2181 The available histedit script commands are as follows:
2182 .Bl -column YXZ pick-commit
2183 .It Cm pick Ar commit Ta Use the specified commit as it is.
2184 .It Cm edit Ar commit Ta Use the specified commit but once changes have been
2185 merged into the work tree interrupt the histedit operation for amending.
2186 .It Cm fold Ar commit Ta Combine the specified commit with the next commit
2187 listed further below that will be used.
2188 .It Cm drop Ar commit Ta Remove this commit from the edited history.
2189 .It Cm mesg Oo Ar log-message Oc Ta Create a new log message for the commit of
2190 a preceding
2191 .Cm pick
2193 .Cm edit
2194 command on the previous line of the histedit script.
2195 The optional
2196 .Ar log-message
2197 argument provides a new single-line log message to use.
2198 If the
2199 .Ar log-message
2200 argument is omitted, open an editor where a new log message can be written.
2201 .El
2202 .Pp
2203 Every commit in the history being edited must be mentioned in the script.
2204 Lines may be re-ordered to change the order of commits in the edited history.
2205 No commit may be listed more than once.
2206 .Pp
2207 Edited commits are accumulated on a temporary branch which the work tree
2208 will remain switched to throughout the entire histedit operation.
2209 Once history editing has completed successfully, the temporary branch becomes
2210 the new version of the work tree's branch and the work tree is automatically
2211 switched to it.
2212 .Pp
2213 Old commits in their pre-histedit state are automatically backed up in the
2214 .Dq refs/got/backup/histedit
2215 reference namespace.
2216 As long as these references are not removed older versions of edited
2217 commits will remain in the repository and can be viewed with the
2218 .Cm got histedit -l
2219 command.
2220 Removal of these references makes objects which become unreachable via
2221 any reference subject to removal by Git's garbage collector or
2222 .Cm gotadmin cleanup .
2223 .Pp
2224 While merging commits, show the status of each affected file,
2225 using the following status codes:
2226 .Bl -column YXZ description
2227 .It G Ta file was merged
2228 .It C Ta file was merged and conflicts occurred during merge
2229 .It ! Ta changes destined for a missing file were not merged
2230 .It D Ta file was deleted
2231 .It d Ta file's deletion was prevented by local modifications
2232 .It A Ta new file was added
2233 .It \(a~ Ta changes destined for a non-regular file were not merged
2234 .It ? Ta changes destined for an unversioned file were not merged
2235 .El
2236 .Pp
2237 If merge conflicts occur, the histedit operation is interrupted and may
2238 be continued once conflicts have been resolved.
2239 If any files with destined changes are found to be missing or unversioned,
2240 or if files could not be deleted due to differences in deleted content,
2241 the histedit operation will be interrupted to prevent potentially incomplete
2242 changes from being committed to the repository without user intervention.
2243 The work tree may be modified as desired and the histedit operation can be
2244 continued once the changes present in the work tree are considered complete.
2245 Alternatively, the histedit operation may be aborted which will leave
2246 the work tree switched back to its original branch.
2247 .Pp
2248 If a merge conflict is resolved in a way which renders the merged
2249 change into a no-op change, the corresponding commit will be elided
2250 when the histedit operation continues.
2251 .Pp
2252 .Cm got histedit
2253 will refuse to run if certain preconditions are not met.
2254 If the work tree's current branch is not in the
2255 .Dq refs/heads/
2256 reference namespace, the history of the branch may not be edited.
2257 If the work tree contains multiple base commits, it must first be updated
2258 to a single base commit with
2259 .Cm got update .
2260 If changes have been staged with
2261 .Cm got stage ,
2262 these changes must first be committed with
2263 .Cm got commit
2264 or unstaged with
2265 .Cm got unstage .
2266 If the work tree contains local changes, these changes must first be
2267 committed with
2268 .Cm got commit
2269 or reverted with
2270 .Cm got revert .
2271 If the edited history contains changes to files outside of the work tree's
2272 path prefix, the work tree cannot be used to edit the history of this branch.
2273 .Pp
2274 The
2275 .Cm got update ,
2276 .Cm got rebase ,
2277 and
2278 .Cm got integrate
2279 commands will refuse to run while a histedit operation is in progress.
2280 Other commands which manipulate the work tree may be used, and the
2281 .Cm got commit
2282 command may be used to commit arbitrary changes to the temporary branch
2283 while the histedit operation is interrupted.
2284 .Pp
2285 The options for
2286 .Cm got histedit
2287 are as follows:
2288 .Bl -tag -width Ds
2289 .It Fl a
2290 Abort an interrupted histedit operation.
2291 If this option is used, no other command-line arguments are allowed.
2292 .It Fl c
2293 Continue an interrupted histedit operation.
2294 If this option is used, no other command-line arguments are allowed.
2295 .It Fl e
2296 Interrupt the histedit operation for editing after merging each commit.
2297 This option is a quick equivalent to a histedit script which uses the
2298 .Cm edit
2299 command for all commits.
2300 The
2301 .Fl e
2302 option can only be used when starting a new histedit operation.
2303 If this option is used, no other command-line arguments are allowed.
2304 .It Fl F Ar histedit-script
2305 Use the specified
2306 .Ar histedit-script
2307 instead of opening a temporary file in an editor where a histedit script
2308 can be written.
2309 .It Fl f
2310 Fold all commits into a single commit.
2311 This option is a quick equivalent to a histedit script which folds all
2312 commits, combining them all into one commit.
2313 The
2314 .Fl f
2315 option can only be used when starting a new histedit operation.
2316 If this option is used, no other command-line arguments are allowed.
2317 .It Fl l
2318 Show a list of past histedit operations, represented by references in the
2319 .Dq refs/got/backup/histedit
2320 reference namespace.
2321 .Pp
2322 Display the author, date, and log message of each backed up commit,
2323 the object ID of the corresponding post-histedit commit, and
2324 the object ID of their common ancestor commit.
2325 Given these object IDs,
2326 the
2327 .Cm got log
2328 command with the
2329 .Fl c
2330 and
2331 .Fl x
2332 options can be used to examine the history of either version of the branch,
2333 and the
2334 .Cm got branch
2335 command with the
2336 .Fl c
2337 option can be used to create a new branch from a pre-histedit state if desired.
2338 .Pp
2339 If a
2340 .Ar branch
2341 is specified, only show commits which at some point in time represented this
2342 branch.
2343 Otherwise, list all backed up commits for any branches.
2344 .Pp
2345 If this option is used,
2346 .Cm got histedit
2347 does not require a work tree.
2348 None of the other options can be used together with
2349 .Fl l .
2350 .It Fl m
2351 Edit log messages only.
2352 This option is a quick equivalent to a histedit script which edits
2353 only log messages but otherwise leaves every picked commit as-is.
2354 The
2355 .Fl m
2356 option can only be used when starting a new histedit operation.
2357 If this option is used, no other command-line arguments are allowed.
2358 .It Fl X
2359 Delete backups created by past histedit operations, represented by references
2360 in the
2361 .Dq refs/got/backup/histedit
2362 reference namespace.
2363 .Pp
2364 If a
2365 .Ar branch
2366 is specified, only delete backups which at some point in time represented
2367 this branch.
2368 Otherwise, delete all references found within
2369 .Dq refs/got/backup/histedit .
2370 .Pp
2371 Any commit, tree, tag, and blob objects belonging to deleted backups
2372 remain in the repository and may be removed separately with
2373 Git's garbage collector or
2374 .Cm gotadmin cleanup .
2375 .Pp
2376 If this option is used,
2377 .Cm got histedit
2378 does not require a work tree.
2379 None of the other options can be used together with
2380 .Fl X .
2381 .El
2382 .Tg ig
2383 .It Cm integrate Ar branch
2384 .Dl Pq alias: Cm ig
2385 Integrate the specified
2386 .Ar branch
2387 into the work tree's current branch.
2388 Files in the work tree are updated to match the contents on the integrated
2389 .Ar branch ,
2390 and the reference of the work tree's branch is changed to point at the
2391 head commit of the integrated
2392 .Ar branch .
2393 .Pp
2394 Both branches can be considered equivalent after integration since they
2395 will be pointing at the same commit.
2396 Both branches remain available for future work, if desired.
2397 In case the integrated
2398 .Ar branch
2399 is no longer needed it may be deleted with
2400 .Cm got branch -d .
2401 .Pp
2402 Show the status of each affected file, using the following status codes:
2403 .Bl -column YXZ description
2404 .It U Ta file was updated
2405 .It D Ta file was deleted
2406 .It A Ta new file was added
2407 .It \(a~ Ta versioned file is obstructed by a non-regular file
2408 .It ! Ta a missing versioned file was restored
2409 .El
2410 .Pp
2411 .Cm got integrate
2412 will refuse to run if certain preconditions are not met.
2413 Most importantly, the
2414 .Ar branch
2415 must have been rebased onto the work tree's current branch with
2416 .Cm got rebase
2417 before it can be integrated, in order to linearize commit history and
2418 resolve merge conflicts.
2419 If the work tree contains multiple base commits, it must first be updated
2420 to a single base commit with
2421 .Cm got update .
2422 If changes have been staged with
2423 .Cm got stage ,
2424 these changes must first be committed with
2425 .Cm got commit
2426 or unstaged with
2427 .Cm got unstage .
2428 If the work tree contains local changes, these changes must first be
2429 committed with
2430 .Cm got commit
2431 or reverted with
2432 .Cm got revert .
2433 .Tg mg
2434 .It Cm merge Oo Fl acn Oc Op Ar branch
2435 .Dl Pq alias: Cm mg
2436 Create a merge commit based on the current branch of the work tree and
2437 the specified
2438 .Ar branch .
2439 If a linear project history is desired, then use of
2440 .Cm got rebase
2441 should be preferred over
2442 .Cm got merge .
2443 However, even strictly linear projects may require merge commits in order
2444 to merge in new versions of third-party code stored on vendor branches
2445 created with
2446 .Cm got import .
2447 .Pp
2448 Merge commits are commits based on multiple parent commits.
2449 The tip commit of the work tree's current branch, which must be set with
2450 .Cm got update -b
2451 before starting the
2452 .Cm merge
2453 operation, will be used as the first parent.
2454 The tip commit of the specified
2455 .Ar branch
2456 will be used as the second parent.
2457 .Pp
2458 No ancestral relationship between the two branches is required.
2459 If the two branches have already been merged previously, only new changes
2460 will be merged.
2461 .Pp
2462 It is not possible to create merge commits with more than two parents.
2463 If more than one branch needs to be merged, then multiple merge commits
2464 with two parents each can be created in sequence.
2465 .Pp
2466 While merging changes found on the
2467 .Ar branch
2468 into the work tree, show the status of each affected file,
2469 using the following status codes:
2470 .Bl -column YXZ description
2471 .It G Ta file was merged
2472 .It C Ta file was merged and conflicts occurred during merge
2473 .It ! Ta changes destined for a missing file were not merged
2474 .It D Ta file was deleted
2475 .It d Ta file's deletion was prevented by local modifications
2476 .It A Ta new file was added
2477 .It \(a~ Ta changes destined for a non-regular file were not merged
2478 .It ? Ta changes destined for an unversioned file were not merged
2479 .El
2480 .Pp
2481 If merge conflicts occur, the merge operation is interrupted and conflicts
2482 must be resolved before the merge operation can continue.
2483 If any files with destined changes are found to be missing or unversioned,
2484 or if files could not be deleted due to differences in deleted content,
2485 the merge operation will be interrupted to prevent potentially incomplete
2486 changes from being committed to the repository without user intervention.
2487 The work tree may be modified as desired and the merge can be continued
2488 once the changes present in the work tree are considered complete.
2489 Alternatively, the merge operation may be aborted which will leave
2490 the work tree's current branch unmodified.
2491 .Pp
2492 If a merge conflict is resolved in a way which renders all merged
2493 changes into no-op changes, the merge operation cannot continue
2494 and must be aborted.
2495 .Pp
2496 .Cm got merge
2497 will refuse to run if certain preconditions are not met.
2498 If history of the
2499 .Ar branch
2500 is based on the work tree's current branch, then no merge commit can
2501 be created and
2502 .Cm got integrate
2503 may be used to integrate the
2504 .Ar branch
2505 instead.
2506 If the work tree is not yet fully updated to the tip commit of its
2507 branch, then the work tree must first be updated with
2508 .Cm got update .
2509 If the work tree contains multiple base commits, it must first be updated
2510 to a single base commit with
2511 .Cm got update .
2512 If changes have been staged with
2513 .Cm got stage ,
2514 these changes must first be committed with
2515 .Cm got commit
2516 or unstaged with
2517 .Cm got unstage .
2518 If the work tree contains local changes, these changes must first be
2519 committed with
2520 .Cm got commit
2521 or reverted with
2522 .Cm got revert .
2523 If the
2524 .Ar branch
2525 contains changes to files outside of the work tree's path prefix,
2526 the work tree cannot be used to merge this branch.
2527 .Pp
2528 The
2529 .Cm got update ,
2530 .Cm got commit ,
2531 .Cm got rebase ,
2532 .Cm got histedit ,
2533 .Cm got integrate ,
2534 and
2535 .Cm got stage
2536 commands will refuse to run while a merge operation is in progress.
2537 Other commands which manipulate the work tree may be used for
2538 conflict resolution purposes.
2539 .Pp
2540 The options for
2541 .Cm got merge
2542 are as follows:
2543 .Bl -tag -width Ds
2544 .It Fl a
2545 Abort an interrupted merge operation.
2546 If this option is used, no other command-line arguments are allowed.
2547 .It Fl c
2548 Continue an interrupted merge operation.
2549 If this option is used, no other command-line arguments are allowed.
2550 .It Fl n
2551 Merge changes into the work tree as usual but do not create a merge
2552 commit immediately.
2553 The merge result can be adjusted as desired before a merge commit is
2554 created with
2555 .Cm got merge -c .
2556 Alternatively, the merge may be aborted with
2557 .Cm got merge -a .
2558 .El
2559 .Tg sg
2560 .It Cm stage Oo Fl lpS Oc Oo Fl F Ar response-script Oc Op Ar path ...
2561 .Dl Pq alias: Cm sg
2562 Stage local changes for inclusion in the next commit.
2563 If no
2564 .Ar path
2565 is specified, stage all changes in the work tree.
2566 Otherwise, stage changes at or within the specified paths.
2567 Paths may be staged if they are added, modified, or deleted according to
2568 .Cm got status .
2569 .Pp
2570 Show the status of each affected file, using the following status codes:
2571 .Bl -column YXZ description
2572 .It A Ta file addition has been staged
2573 .It M Ta file modification has been staged
2574 .It D Ta file deletion has been staged
2575 .El
2576 .Pp
2577 Staged file contents are saved in newly created blob objects in the repository.
2578 These blobs will be referred to by tree objects once staged changes have been
2579 committed.
2580 .Pp
2581 Staged changes affect the behaviour of
2582 .Cm got commit ,
2583 .Cm got status ,
2584 and
2585 .Cm got diff .
2586 While paths with staged changes exist, the
2587 .Cm got commit
2588 command will refuse to commit any paths which do not have staged changes.
2589 Local changes created on top of staged changes can only be committed if
2590 the path is staged again, or if the staged changes are committed first.
2591 The
2592 .Cm got status
2593 command will show both local changes and staged changes.
2594 The
2595 .Cm got diff
2596 command is able to display local changes relative to staged changes,
2597 and to display staged changes relative to the repository.
2598 The
2599 .Cm got revert
2600 command cannot revert staged changes but may be used to revert
2601 local changes created on top of staged changes.
2602 .Pp
2603 The options for
2604 .Cm got stage
2605 are as follows:
2606 .Bl -tag -width Ds
2607 .It Fl F Ar response-script
2608 With the
2609 .Fl p
2610 option, read
2611 .Dq y ,
2612 .Dq n ,
2613 and
2614 .Dq q
2615 responses line-by-line from the specified
2616 .Ar response-script
2617 file instead of prompting interactively.
2618 .It Fl l
2619 Instead of staging new changes, list paths which are already staged,
2620 along with the IDs of staged blob objects and stage status codes.
2621 If paths were provided on the command line, show the staged paths
2622 among the specified paths.
2623 Otherwise, show all staged paths.
2624 .It Fl p
2625 Instead of staging the entire content of a changed file, interactively
2626 select or reject changes for staging based on
2627 .Dq y
2628 (stage change),
2629 .Dq n
2630 (reject change), and
2631 .Dq q
2632 (quit staging this file) responses.
2633 If a file is in modified status, individual patches derived from the
2634 modified file content can be staged.
2635 Files in added or deleted status may only be staged or rejected in
2636 their entirety.
2637 .It Fl S
2638 Allow staging of symbolic links which point outside of the path space
2639 that is under version control.
2640 By default,
2641 .Cm got stage
2642 will reject such symbolic links due to safety concerns.
2643 As a precaution,
2644 .Nm
2645 may decide to represent such a symbolic link as a regular file which contains
2646 the link's target path, rather than creating an actual symbolic link which
2647 points outside of the work tree.
2648 Use of this option is discouraged because external mechanisms such as
2649 .Dq make obj
2650 are better suited for managing symbolic links to paths not under
2651 version control.
2652 .El
2653 .Pp
2654 .Cm got stage
2655 will refuse to run if certain preconditions are not met.
2656 If a file contains merge conflicts, these conflicts must be resolved first.
2657 If a file is found to be out of date relative to the head commit on the
2658 work tree's current branch, the file must be updated with
2659 .Cm got update
2660 before it can be staged (however, this does not prevent the file from
2661 becoming out-of-date at some point after having been staged).
2662 .Pp
2663 The
2664 .Cm got update ,
2665 .Cm got rebase ,
2666 and
2667 .Cm got histedit
2668 commands will refuse to run while staged changes exist.
2669 If staged changes cannot be committed because a staged path
2670 is out of date, the path must be unstaged with
2671 .Cm got unstage
2672 before it can be updated with
2673 .Cm got update ,
2674 and may then be staged again if necessary.
2675 .Tg ug
2676 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
2677 .Dl Pq alias: Cm ug
2678 Merge staged changes back into the work tree and put affected paths
2679 back into non-staged status.
2680 If no
2681 .Ar path
2682 is specified, unstage all staged changes across the entire work tree.
2683 Otherwise, unstage changes at or within the specified paths.
2684 .Pp
2685 Show the status of each affected file, using the following status codes:
2686 .Bl -column YXZ description
2687 .It G Ta file was unstaged
2688 .It C Ta file was unstaged and conflicts occurred during merge
2689 .It ! Ta changes destined for a missing file were not merged
2690 .It D Ta file was staged as deleted and still is deleted
2691 .It d Ta file's deletion was prevented by local modifications
2692 .It \(a~ Ta changes destined for a non-regular file were not merged
2693 .El
2694 .Pp
2695 The options for
2696 .Cm got unstage
2697 are as follows:
2698 .Bl -tag -width Ds
2699 .It Fl F Ar response-script
2700 With the
2701 .Fl p
2702 option, read
2703 .Dq y ,
2704 .Dq n ,
2705 and
2706 .Dq q
2707 responses line-by-line from the specified
2708 .Ar response-script
2709 file instead of prompting interactively.
2710 .It Fl p
2711 Instead of unstaging the entire content of a changed file, interactively
2712 select or reject changes for unstaging based on
2713 .Dq y
2714 (unstage change),
2715 .Dq n
2716 (keep change staged), and
2717 .Dq q
2718 (quit unstaging this file) responses.
2719 If a file is staged in modified status, individual patches derived from the
2720 staged file content can be unstaged.
2721 Files staged in added or deleted status may only be unstaged in their entirety.
2722 .El
2723 .It Cm cat Oo Fl P Oc Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar arg ...
2724 Parse and print contents of objects to standard output in a line-based
2725 text format.
2726 Content of commit, tree, and tag objects is printed in a way similar
2727 to the actual content stored in such objects.
2728 Blob object contents are printed as they would appear in files on disk.
2729 .Pp
2730 Attempt to interpret each argument as a reference, a tag name, or
2731 an object ID SHA1 hash.
2732 References will be resolved to an object ID.
2733 Tag names will resolved to a tag object.
2734 An abbreviated hash argument will be expanded to a full SHA1 hash
2735 automatically, provided the abbreviation is unique.
2736 .Pp
2737 If none of the above interpretations produce a valid result, or if the
2738 .Fl P
2739 option is used, attempt to interpret the argument as a path which will
2740 be resolved to the ID of an object found at this path in the repository.
2741 .Pp
2742 The options for
2743 .Cm got cat
2744 are as follows:
2745 .Bl -tag -width Ds
2746 .It Fl c Ar commit
2747 Look up paths in the specified
2748 .Ar commit .
2749 If this option is not used, paths are looked up in the commit resolved
2750 via the repository's HEAD reference.
2751 The expected argument is a commit ID SHA1 hash or an existing reference
2752 or tag name which will be resolved to a commit ID.
2753 An abbreviated hash argument will be expanded to a full SHA1 hash
2754 automatically, provided the abbreviation is unique.
2755 .It Fl P
2756 Interpret all arguments as paths only.
2757 This option can be used to resolve ambiguity in cases where paths
2758 look like tag names, reference names, or object IDs.
2759 .It Fl r Ar repository-path
2760 Use the repository at the specified path.
2761 If not specified, assume the repository is located at or above the current
2762 working directory.
2763 If this directory is a
2764 .Nm
2765 work tree, use the repository path associated with this work tree.
2766 .El
2767 .It Cm info Op Ar path ...
2768 Display meta-data stored in a work tree.
2769 See
2770 .Xr got-worktree 5
2771 for details.
2772 .Pp
2773 The work tree to use is resolved implicitly by walking upwards from the
2774 current working directory.
2775 .Pp
2776 If one or more
2777 .Ar path
2778 arguments are specified, show additional per-file information for tracked
2779 files located at or within these paths.
2780 If a
2781 .Ar path
2782 argument corresponds to the work tree's root directory, display information
2783 for all tracked files.
2784 .El
2785 .Sh ENVIRONMENT
2786 .Bl -tag -width GOT_IGNORE_GITCONFIG
2787 .It Ev GOT_AUTHOR
2788 The author's name and email address, such as
2789 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
2790 Used by the
2791 .Cm got commit ,
2792 .Cm got import ,
2793 .Cm got rebase ,
2794 and
2795 .Cm got histedit
2796 commands.
2797 Because
2798 .Xr git 1
2799 may fail to parse commits without an email address in author data,
2800 .Nm
2801 attempts to reject
2802 .Ev GOT_AUTHOR
2803 environment variables with a missing email address.
2804 .Pp
2805 .Ev GOT_AUTHOR will be overridden by configuration settings in
2806 .Xr got.conf 5
2807 or by Git's
2808 .Dv user.name
2809 and
2810 .Dv user.email
2811 configuration settings in the repository's
2812 .Pa .git/config
2813 file.
2814 The
2815 .Dv user.name
2816 and
2817 .Dv user.email
2818 configuration settings contained in Git's global
2819 .Pa ~/.gitconfig
2820 configuration file will only be used if neither
2821 .Xr got.conf 5
2822 nor the
2823 .Ev GOT_AUTHOR
2824 environment variable provide author information.
2825 .It Ev VISUAL , EDITOR
2826 The editor spawned by
2827 .Cm got commit ,
2828 .Cm got histedit ,
2829 .Cm got import ,
2831 .Cm got tag .
2832 If not set, the
2833 .Xr ed 1
2834 text editor will be spawned in order to give
2835 .Xr ed 1
2836 the attention it deserves.
2837 .It Ev GOT_LOG_DEFAULT_LIMIT
2838 The default limit on the number of commits traversed by
2839 .Cm got log .
2840 If set to zero, the limit is unbounded.
2841 This variable will be silently ignored if it is set to a non-numeric value.
2842 .It Ev GOT_IGNORE_GITCONFIG
2843 If this variable is set then any remote repository definitions or author
2844 information found in Git configuration files will be ignored.
2845 .El
2846 .Sh FILES
2847 .Bl -tag -width packed-refs -compact
2848 .It Pa got.conf
2849 Repository-wide configuration settings for
2850 .Nm .
2851 If present, a
2852 .Xr got.conf 5
2853 configuration file located in the root directory of a Git repository
2854 supersedes any relevant settings in Git's
2855 .Pa config
2856 file.
2857 .Pp
2858 .It Pa .got/got.conf
2859 Worktree-specific configuration settings for
2860 .Nm .
2861 If present, a
2862 .Xr got.conf 5
2863 configuration file in the
2864 .Pa .got
2865 meta-data directory of a work tree supersedes any relevant settings in
2866 the repository's
2867 .Xr got.conf 5
2868 configuration file and Git's
2869 .Pa config
2870 file.
2871 .El
2872 .Sh EXIT STATUS
2873 .Ex -std got
2874 .Sh EXAMPLES
2875 Enable tab-completion of
2876 .Nm
2877 command names in
2878 .Xr ksh 1 :
2879 .Pp
2880 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
2881 .Pp
2882 Clone an existing Git repository for use with
2883 .Nm .
2884 .Pp
2885 .Dl $ cd /var/git/
2886 .Dl $ got clone ssh://git@github.com/openbsd/src.git
2887 .Pp
2888 Use of HTTP URLs currently requires
2889 .Xr git 1 :
2890 .Pp
2891 .Dl $ cd /var/git/
2892 .Dl $ git clone --bare https://github.com/openbsd/src.git
2893 .Pp
2894 Alternatively, for quick and dirty local testing of
2895 .Nm
2896 a new Git repository could be created and populated with files,
2897 e.g. from a temporary CVS checkout located at
2898 .Pa /tmp/src :
2899 .Pp
2900 .Dl $ gotadmin init /var/git/src.git
2901 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
2902 .Pp
2903 Check out a work tree from the Git repository to /usr/src:
2904 .Pp
2905 .Dl $ got checkout /var/git/src.git /usr/src
2906 .Pp
2907 View local changes in a work tree directory:
2908 .Pp
2909 .Dl $ got diff | less
2910 .Pp
2911 In a work tree, display files in a potentially problematic state:
2912 .Pp
2913 .Dl $ got status -s 'C!~?'
2914 .Pp
2915 Interactively revert selected local changes in a work tree directory:
2916 .Pp
2917 .Dl $ got revert -p -R\ .
2918 .Pp
2919 In a work tree or a git repository directory, list all branch references:
2920 .Pp
2921 .Dl $ got branch -l
2922 .Pp
2923 In a work tree or a git repository directory, create a new branch called
2924 .Dq unified-buffer-cache
2925 which is forked off the
2926 .Dq master
2927 branch:
2928 .Pp
2929 .Dl $ got branch -c master unified-buffer-cache
2930 .Pp
2931 Switch an existing work tree to the branch
2932 .Dq unified-buffer-cache .
2933 Local changes in the work tree will be preserved and merged if necessary:
2934 .Pp
2935 .Dl $ got update -b unified-buffer-cache
2936 .Pp
2937 Create a new commit from local changes in a work tree directory.
2938 This new commit will become the head commit of the work tree's current branch:
2939 .Pp
2940 .Dl $ got commit
2941 .Pp
2942 In a work tree or a git repository directory, view changes committed in
2943 the 3 most recent commits to the work tree's branch, or the branch resolved
2944 via the repository's HEAD reference, respectively:
2945 .Pp
2946 .Dl $ got log -p -l 3
2947 .Pp
2948 As above, but display changes in the order in which
2949 .Xr patch 1
2950 could apply them in sequence:
2951 .Pp
2952 .Dl $ got log -p -l 3 -R
2953 .Pp
2954 In a work tree or a git repository directory, log the history of a subdirectory:
2955 .Pp
2956 .Dl $ got log sys/uvm
2957 .Pp
2958 While operating inside a work tree, paths are specified relative to the current
2959 working directory, so this command will log the subdirectory
2960 .Pa sys/uvm :
2961 .Pp
2962 .Dl $ cd sys/uvm && got log\ .
2963 .Pp
2964 And this command has the same effect:
2965 .Pp
2966 .Dl $ cd sys/dev/usb && got log ../../uvm
2967 .Pp
2968 And this command displays work tree meta-data about all tracked files:
2969 .Pp
2970 .Dl $ cd /usr/src
2971 .Dl $ got info\ . | less
2972 .Pp
2973 Add new files and remove obsolete files in a work tree directory:
2974 .Pp
2975 .Dl $ got add sys/uvm/uvm_ubc.c
2976 .Dl $ got remove sys/uvm/uvm_vnode.c
2977 .Pp
2978 Create a new commit from local changes in a work tree directory
2979 with a pre-defined log message.
2980 .Pp
2981 .Dl $ got commit -m 'unify the buffer cache'
2982 .Pp
2983 Alternatively, create a new commit from local changes in a work tree
2984 directory with a log message that has been prepared in the file
2985 .Pa /tmp/msg :
2986 .Pp
2987 .Dl $ got commit -F /tmp/msg
2988 .Pp
2989 Update any work tree checked out from the
2990 .Dq unified-buffer-cache
2991 branch to the latest commit on this branch:
2992 .Pp
2993 .Dl $ got update
2994 .Pp
2995 Roll file content on the unified-buffer-cache branch back by one commit,
2996 and then fetch the rolled-back change into the work tree as a local change
2997 to be amended and perhaps committed again:
2998 .Pp
2999 .Dl $ got backout unified-buffer-cache
3000 .Dl $ got commit -m 'roll back previous'
3001 .Dl $ # now back out the previous backout :-)
3002 .Dl $ got backout unified-buffer-cache
3003 .Pp
3004 Fetch new changes on the remote repository's
3005 .Dq master
3006 branch, making them visible on the local repository's
3007 .Dq origin/master
3008 branch:
3009 .Pp
3010 .Dl $ cd /usr/src
3011 .Dl $ got fetch
3012 .Pp
3013 In a repository created with a HTTP URL and
3014 .Cm git clone --bare
3015 the
3016 .Xr git-fetch 1
3017 command must be used instead:
3018 .Pp
3019 .Dl $ cd /var/git/src.git
3020 .Dl $ git fetch origin master:refs/remotes/origin/master
3021 .Pp
3022 Rebase the local
3023 .Dq master
3024 branch to merge the new changes that are now visible on the
3025 .Dq origin/master
3026 branch:
3027 .Pp
3028 .Dl $ cd /usr/src
3029 .Dl $ got update -b origin/master
3030 .Dl $ got rebase master
3031 .Pp
3032 Rebase the
3033 .Dq unified-buffer-cache
3034 branch on top of the new head commit of the
3035 .Dq master
3036 branch.
3037 .Pp
3038 .Dl $ got update -b master
3039 .Dl $ got rebase unified-buffer-cache
3040 .Pp
3041 Create a patch from all changes on the unified-buffer-cache branch.
3042 The patch can be mailed out for review and applied to
3043 .Ox Ns 's
3044 CVS tree:
3045 .Pp
3046 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
3047 .Pp
3048 Edit the entire commit history of the
3049 .Dq unified-buffer-cache
3050 branch:
3051 .Pp
3052 .Dl $ got update -b unified-buffer-cache
3053 .Dl $ got update -c master
3054 .Dl $ got histedit
3055 .Pp
3056 Before working against existing branches in a repository cloned with
3057 .Cm git clone --bare
3058 instead of
3059 .Cm got clone ,
3060 a Git
3061 .Dq refspec
3062 must be configured to map all references in the remote repository
3063 into the
3064 .Dq refs/remotes
3065 namespace of the local repository.
3066 This can be achieved by setting Git's
3067 .Pa remote.origin.fetch
3068 configuration variable to the value
3069 .Dq +refs/heads/*:refs/remotes/origin/*
3070 with the
3071 .Cm git config
3072 command:
3073 .Pp
3074 .Dl $ cd /var/git/repo
3075 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
3076 .Pp
3077 Additionally, the
3078 .Dq mirror
3079 option must be disabled:
3080 .Pp
3081 .Dl $ cd /var/git/repo
3082 .Dl $ git config remote.origin.mirror false
3083 .Pp
3084 Alternatively, the following
3085 .Xr git-fetch 1
3086 configuration item can be added manually to the Git repository's
3087 .Pa config
3088 file:
3089 .Pp
3090 .Dl [remote \&"origin\&"]
3091 .Dl url = ...
3092 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
3093 .Dl mirror = false
3094 .Pp
3095 This configuration leaves the local repository's
3096 .Dq refs/heads
3097 namespace free for use by local branches checked out with
3098 .Cm got checkout
3099 and, if needed, created with
3100 .Cm got branch .
3101 Branches in the
3102 .Dq refs/remotes/origin
3103 namespace can now be updated with incoming changes from the remote
3104 repository with
3105 .Cm got fetch
3107 .Xr git-fetch 1
3108 without extra command line arguments.
3109 Newly fetched changes can be examined with
3110 .Cm got log .
3111 .Pp
3112 Display changes on the remote repository's version of the
3113 .Dq master
3114 branch, as of the last time
3115 .Cm got fetch
3116 was run:
3117 .Pp
3118 .Dl $ got log -c origin/master | less
3119 .Pp
3120 As shown here, most commands accept abbreviated reference names such as
3121 .Dq origin/master
3122 instead of
3123 .Dq refs/remotes/origin/master .
3124 The latter is only needed in case of ambiguity.
3125 .Pp
3126 .Cm got rebase
3127 must be used to merge changes which are visible on the
3128 .Dq origin/master
3129 branch into the
3130 .Dq master
3131 branch.
3132 This will also merge local changes, if any, with the incoming changes:
3133 .Pp
3134 .Dl $ got update -b origin/master
3135 .Dl $ got rebase master
3136 .Pp
3137 In order to make changes committed to the
3138 .Dq unified-buffer-cache
3139 visible on the
3140 .Dq master
3141 branch, the
3142 .Dq unified-buffer-cache
3143 branch must first be rebased onto the
3144 .Dq master
3145 branch:
3146 .Pp
3147 .Dl $ got update -b master
3148 .Dl $ got rebase unified-buffer-cache
3149 .Pp
3150 Changes on the
3151 .Dq unified-buffer-cache
3152 branch can now be made visible on the
3153 .Dq master
3154 branch with
3155 .Cm got integrate .
3156 Because the rebase operation switched the work tree to the
3157 .Dq unified-buffer-cache
3158 branch, the work tree must be switched back to the
3159 .Dq master
3160 branch first:
3161 .Pp
3162 .Dl $ got update -b master
3163 .Dl $ got integrate unified-buffer-cache
3164 .Pp
3165 On the
3166 .Dq master
3167 branch, log messages for local changes can now be amended with
3168 .Dq OK
3169 by other developers and any other important new information:
3170 .Pp
3171 .Dl $ got update -c origin/master
3172 .Dl $ got histedit -m
3173 .Pp
3174 If the remote repository offers write access, local changes on the
3175 .Dq master
3176 branch can be sent to the remote repository with
3177 .Cm got send .
3178 Usually,
3179 .Cm got send
3180 can be run without further arguments.
3181 The arguments shown here match defaults, provided the work tree's
3182 current branch is the
3183 .Dq master
3184 branch:
3185 .Pp
3186 .Dl $ got send -b master origin
3187 .Pp
3188 If the remote repository requires the HTTPS protocol, the
3189 .Xr git-push 1
3190 command must be used instead:
3191 .Pp
3192 .Dl $ cd /var/git/src.git
3193 .Dl $ git push origin master
3194 .Pp
3195 When making contributions to projects which use the
3196 .Dq pull request
3197 workflow, SSH protocol repository access needs to be set up first.
3198 Once an account has been created on a Git hosting site it should
3199 be possible to upload a public SSH key for repository access
3200 authentication.
3201 .Pp
3202 The
3203 .Dq pull request
3204 workflow will usually involve two remote repositories.
3205 In the real-life example below, the
3206 .Dq origin
3207 repository was forked from the
3208 .Dq upstream
3209 repository by using the Git hosting site's web interface.
3210 The
3211 .Xr got.conf 5
3212 file in the local repository describes both remote repositories:
3213 .Bd -literal -offset indent
3214 # Jelmers's repository, which accepts pull requests
3215 remote "upstream" {
3216 server git@github.com
3217 protocol ssh
3218 repository "/jelmer/dulwich"
3219 branch { "master" }
3222 # Stefan's fork, used as the default remote repository
3223 remote "origin" {
3224 server git@github.com
3225 protocol ssh
3226 repository "/stspdotname/dulwich"
3227 branch { "master" }
3229 .Ed
3230 .Pp
3231 With this configuration, Stefan can create commits on
3232 .Dq refs/heads/master
3233 and send them to the
3234 .Dq origin
3235 repository by running:
3236 .Pp
3237 .Dl $ got send -b master origin
3238 .Pp
3239 The changes can now be proposed to Jelmer by opening a pull request
3240 via the Git hosting site's web interface.
3241 If Jelmer requests further changes to be made, additional commits
3242 can be created on the
3243 .Dq master
3244 branch and be added to the pull request by running
3245 .Cd got send
3246 again.
3247 .Pp
3248 If Jelmer prefers additional commits to be
3249 .Dq squashed
3250 then the following commands can be used to achieve this:
3251 .Pp
3252 .Dl $ got update -b master
3253 .Dl $ got update -c origin/master
3254 .Dl $ got histedit -f
3255 .Dl $ got send -f -b master origin
3256 .Pp
3257 Once Jelmer has accepted the pull request, Stefan can fetch the
3258 merged changes, and possibly several other new changes, by running:
3259 .Pp
3260 .Dl $ got fetch upstream
3261 .Pp
3262 The merged changes will now be visible under the reference
3263 .Dq refs/remotes/upstream/master .
3264 The local
3265 .Dq master
3266 branch can now be rebased on top of the latest changes
3267 from upstream:
3268 .Pp
3269 .Dl $ got update -b upstream/master
3270 .Dl $ got rebase master
3271 .Pp
3272 As a final step, the forked repository's copy of the master branch needs
3273 to be kept in sync by sending the new changes there:
3274 .Pp
3275 .Dl $ got send -f -b master origin
3276 .Pp
3277 If multiple pull requests need to be managed in parallel, a separate branch
3278 must be created for each pull request with
3279 .Cm got branch .
3280 Each such branch can then be used as above, in place of
3281 .Dq refs/heads/master .
3282 Changes for any accepted pull requests will still appear under
3283 .Dq refs/remotes/upstream/master,
3284 regardless of which branch was used in the forked repository to
3285 create a pull request.
3286 .Sh SEE ALSO
3287 .Xr gotadmin 1 ,
3288 .Xr tog 1 ,
3289 .Xr git-repository 5 ,
3290 .Xr got-worktree 5 ,
3291 .Xr got.conf 5 ,
3292 .Xr gotweb 8
3293 .Sh AUTHORS
3294 .An Anthony J. Bentley Aq Mt bentley@openbsd.org
3295 .An Christian Weisgerber Aq Mt naddy@openbsd.org
3296 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
3297 .An Josh Rickmar Aq Mt jrick@zettaport.com
3298 .An Joshua Stein Aq Mt jcs@openbsd.org
3299 .An Klemens Nanni Aq Mt kn@openbsd.org
3300 .An Martin Pieuchot Aq Mt mpi@openbsd.org
3301 .An Neels Hofmeyr Aq Mt neels@hofmeyr.de
3302 .An Omar Polo Aq Mt op@openbsd.org
3303 .An Ori Bernstein Aq Mt ori@openbsd.org
3304 .An Sebastien Marie Aq Mt semarie@openbsd.org
3305 .An Stefan Sperling Aq Mt stsp@openbsd.org
3306 .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au
3307 .An Theo Buehler Aq Mt tb@openbsd.org
3308 .An Thomas Adam Aq Mt thomas@xteddy.org
3309 .An Tracey Emery Aq Mt tracey@traceyemery.net
3310 .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org
3311 .Pp
3312 Parts of
3313 .Nm ,
3314 .Xr tog 1 ,
3315 and
3316 .Xr gotweb 8
3317 were derived from code under copyright by:
3318 .Pp
3319 .An Caldera International
3320 .An Daniel Hartmeier
3321 .An Esben Norby
3322 .An Henning Brauer
3323 .An HÃ¥kan Olsson
3324 .An Ingo Schwarze
3325 .An Jean-Francois Brousseau
3326 .An Joris Vink
3327 .An Jyri J. Virkki
3328 .An Larry Wall
3329 .An Markus Friedl
3330 .An Niall O'Higgins
3331 .An Niklas Hallqvist
3332 .An Ray Lai
3333 .An Ryan McBride
3334 .An Theo de Raadt
3335 .An Todd C. Miller
3336 .An Xavier Santolaria
3337 .Pp
3338 .Nm
3339 contains code contributed to the public domain by
3340 .An Austin Appleby
3341 .Sh CAVEATS
3342 .Nm
3343 is a work-in-progress and some features remain to be implemented.
3344 .Pp
3345 At present, the user has to fall back on
3346 .Xr git 1
3347 to perform some tasks.
3348 In particular:
3349 .Bl -bullet
3350 .It
3351 Reading from remote repositories over HTTP or HTTPS protocols requires
3352 .Xr git-clone 1
3353 and
3354 .Xr git-fetch 1 .
3355 .It
3356 Writing to remote repositories over HTTP or HTTPS protocols requires
3357 .Xr git-push 1 .
3358 .It
3359 The creation of merge commits with more than two parent commits requires
3360 .Xr git-merge 1 .
3361 .It
3362 In situations where files or directories were moved around
3363 .Cm got
3364 will not automatically merge changes to new locations and
3365 .Xr git 1
3366 will usually produce better results.
3367 .El