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