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