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