Blob


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