Blob


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