Blob


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