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 .It Cm in
77 Short alias for
78 .Cm init .
79 .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
80 Create an initial commit in a repository from the file hierarchy
81 within the specified
82 .Ar directory .
83 The created commit will not have any parent commits, i.e. it will be a
84 root commit.
85 Also create a new reference which provides a branch name for the newly
86 created commit.
87 Show the path of each imported file to indicate progress.
88 .Pp
89 The
90 .Cm got import
91 command requires the
92 .Ev GOT_AUTHOR
93 environment variable to be set,
94 unless Git's
95 .Dv user.name
96 and
97 .Dv user.email
98 configuration settings can be obtained from the repository's
99 .Pa .git/config
100 file or from Git's global
101 .Pa ~/.gitconfig
102 configuration file.
103 .Pp
104 The options for
105 .Cm got import
106 are as follows:
107 .Bl -tag -width Ds
108 .It Fl b Ar branch
109 Create the specified
110 .Ar branch
111 instead of creating the default branch
112 .Dq main .
113 Use of this option is required if the
114 .Dq main
115 branch already exists.
116 .It Fl m Ar message
117 Use the specified log message when creating the new commit.
118 Without the
119 .Fl m
120 option,
121 .Cm got import
122 opens a temporary file in an editor where a log message can be written.
123 .It Fl r Ar repository-path
124 Use the repository at the specified path.
125 If not specified, assume the repository is located at or above the current
126 working directory.
127 .It Fl I Ar pattern
128 Ignore files or directories with a name which matches the specified
129 .Ar pattern .
130 This option may be specified multiple times to build a list of ignore patterns.
131 The
132 .Ar pattern
133 follows the globbing rules documented in
134 .Xr glob 7 .
135 .El
136 .It Cm im
137 Short alias for
138 .Cm import .
139 .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
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 .Pa config
193 file of the cloned repository to store the
194 .Ar repository-url
195 for future use by
196 .Cm got fetch
197 or
198 .Xr git-fetch 1 .
199 .Pp
200 The options for
201 .Cm got clone
202 are as follows:
203 .Bl -tag -width Ds
204 .It Fl a
205 Fetch all branches from the remote repository's
206 .Dq refs/heads/
207 reference namespace.
208 If this option is not specified, a branch resolved via the remote
209 repository's HEAD reference will be fetched.
210 Cannot be used together with the
211 .Fl b
212 option.
213 .It Fl b Ar branch
214 Fetch the specified
215 .Ar branch
216 from the remote repository's
217 .Dq refs/heads/
218 reference namespace.
219 This option may be specified multiple times to build a list of branches
220 to fetch.
221 If the branch corresponding to the remote repository's HEAD reference is not
222 in this list, the cloned repository's HEAD reference will be set to the first
223 branch which was fetched.
224 If this option is not specified, a branch resolved via the remote
225 repository's HEAD reference will be fetched.
226 Cannot be used together with the
227 .Fl a
228 option.
229 .It Fl l
230 List branches and tags available for fetching from the remote repository
231 and exit immediately.
232 Cannot be used together with any of the other options except
233 .Fl v .
234 .It Fl m
235 Create the cloned repository as a mirror of the original repository.
236 This is useful if the cloned repository will not be used to store
237 local changes as created by
238 .Cm got commit .
239 .Pp
240 The repository's
241 .Pa config
242 file will be set up with the
243 .Dq mirror
244 option enabled, such that
245 .Cm got fetch
246 or
247 .Xr git-fetch 1
248 will write incoming changes directly to local branches in the
249 .Dq refs/heads/
250 reference namespace, rather than to branches in the
251 .Dq refs/remotes/
252 namespace.
253 This avoids the usual requirement of having to run
254 .Cm got rebase
255 after
256 .Cm got fetch
257 in order to make incoming changes appear on local branches.
258 But maintaining local changes in the cloned repository becomes difficult
259 since local changes will be at risk of being discarded whenever incoming
260 changes are fetched.
261 .It Fl q
262 Suppress progress reporting output.
263 The same option will be passed to
264 .Xr ssh 1
265 if applicable.
266 .It Fl v
267 Verbose mode.
268 Causes
269 .Cm got clone
270 to print debugging messages to standard error output.
271 This option will be passed to
272 .Xr ssh 1
273 if applicable.
274 Multiple -v options increase the verbosity.
275 The maximum is 3.
276 .It Fl R Ar reference
277 In addition to the branches and tags that will be fetched, fetch an arbitrary
278 .Ar reference
279 from the remote repository's
280 .Dq refs/
281 namespace.
282 This option may be specified multiple times to build a list of additional
283 references to fetch.
284 The specified
285 .Ar reference
286 may either be a path to a specific reference, or a reference namespace
287 which will cause all references in this namespace to be fetched.
288 .Pp
289 Each reference will be mapped into the cloned repository's
290 .Dq refs/remotes/
291 namespace, unless the
292 .Fl m
293 option is used to mirror references directly into the cloned repository's
294 .Dq refs/
295 namespace.
296 .Pp
297 .Cm got clone
298 will refuse to fetch references from the remote repository's
299 .Dq refs/remotes/
300 or
301 .Dq refs/got/
302 namespace.
303 .El
304 .It Cm cl
305 Short alias for
306 .Cm clone .
307 .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 Op Ar remote-repository
308 Fetch new changes from a remote repository.
309 If no
310 .Ar remote-repository
311 is specified,
312 .Dq origin
313 will be used.
314 The remote repository's URL is obtained from the corresponding entry in the
315 .Pa config
316 file of the local repository, as created by
317 .Cm got clone .
318 .Pp
319 New changes will be stored in a separate pack file downloaded from the server.
320 Optionally, separate pack files stored in the repository can be combined with
321 .Xr git-repack 1 .
322 .Pp
323 By default, branch references in the
324 .Dq refs/remotes/
325 reference namespace will be updated to point at the newly fetched commits.
326 The
327 .Cm got rebase
328 command can then be used to make new changes visible on local branches in the
329 .Dq refs/heads/
330 namespace, merging incoming changes with local changes as necessary.
331 .Pp
332 If the repository was created as a mirror with
333 .Cm got clone -m
334 then all branches in the
335 .Dq refs/heads/
336 namespace will be updated directly to match the corresponding branches in
337 the remote repository.
338 If those branches contained local commits, these commits will no longer be
339 reachable via a reference and will therefore be at risk of being discarded
340 by Git's garbage collector.
341 Maintaining local changes in a mirror repository is therefore discouraged.
342 .Pp
343 In any case, references in the
344 .Dq refs/tags/
345 namespace will always be fetched and mapped directly to local references
346 in the same namespace.
347 .Pp
348 The options for
349 .Cm got fetch
350 are as follows:
351 .Bl -tag -width Ds
352 .It Fl a
353 Fetch all branches from the remote repository's
354 .Dq refs/heads/
355 reference namespace.
356 If this option is not specified, a branch resolved via the remote
357 repository's HEAD reference will be fetched.
358 Cannot be used together with the
359 .Fl b
360 option.
361 .It Fl b Ar branch
362 Fetch the specified
363 .Ar branch
364 from the remote repository's
365 .Dq refs/heads/
366 reference namespace.
367 This option may be specified multiple times to build a list of branches
368 to fetch.
369 If this option is not specified, a branch resolved via the remote
370 repository's HEAD reference will be fetched.
371 Cannot be used together with the
372 .Fl a
373 option.
374 .It Fl d
375 Delete branches and tags from the local repository which are no longer
376 present in the remote repository.
377 Only references are deleted.
378 Any commit, tree, tag, and blob objects belonging to deleted branches or
379 tags remain in the repository and may be removed separately with
380 Git's garbage collector.
381 .It Fl l
382 List branches and tags available for fetching from the remote repository
383 and exit immediately.
384 Cannot be used together with any of the other options except
385 .Fl v
386 and
387 .Fl r .
388 .It Fl t
389 Allow existing references in the
390 .Dq refs/tags
391 namespace to be updated if they have changed on the server.
392 If not specified, only new tag references will be created.
393 .It Fl r Ar repository-path
394 Use the repository at the specified path.
395 If not specified, assume the repository is located at or above the current
396 working directory.
397 If this directory is a
398 .Nm
399 work tree, use the repository path associated with this work tree.
400 .It Fl q
401 Suppress progress reporting output.
402 The same option will be passed to
403 .Xr ssh 1
404 if applicable.
405 .It Fl v
406 Verbose mode.
407 Causes
408 .Cm got fetch
409 to print debugging messages to standard error output.
410 The same option will be passed to
411 .Xr ssh 1
412 if applicable.
413 Multiple -v options increase the verbosity.
414 The maximum is 3.
415 .It Fl R Ar reference
416 In addition to the branches and tags that will be fetched, fetch an arbitrary
417 .Ar reference
418 from the remote repository's
419 .Dq refs/
420 namespace.
421 This option may be specified multiple times to build a list of additional
422 references to fetch.
423 The specified
424 .Ar reference
425 may either be a path to a specific reference, or a reference namespace
426 which will cause all references in this namespace to be fetched.
427 .Pp
428 Each reference will be mapped into the local repository's
429 .Dq refs/remotes/
430 namespace, unless the local repository was created as a mirror with
431 .Cm got clone -m
432 in which case references will be mapped directly into the local repository's
433 .Dq refs/
434 namespace.
435 .Pp
436 Once a reference has been fetched, a local branch based on it can be
437 created with
438 .Cm got branch
439 if needed.
440 .Pp
441 .Cm got fetch
442 will refuse to fetch references from the remote repository's
443 .Dq refs/remotes/
444 or
445 .Dq refs/got/
446 namespace.
447 .El
448 .It Cm fe
449 Short alias for
450 .Cm fetch .
451 .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 Ar repository-path Op Ar work-tree-path
452 Copy files from a repository into a new work tree.
453 Show the status of each affected file, using the following status codes:
454 .Bl -column YXZ description
455 .It A Ta new file was added
456 .It E Ta file already exists in work tree's meta-data
457 .El
458 .Pp
459 If the
460 .Ar work tree path
461 is not specified, either use the last component of
462 .Ar repository path ,
463 or if a
464 .Ar path prefix
465 was specified use the last component of
466 .Ar path prefix .
467 .Pp
468 The options for
469 .Cm got checkout
470 are as follows:
471 .Bl -tag -width Ds
472 .It Fl E
473 Proceed with the checkout operation even if the directory at
474 .Ar work-tree-path
475 is not empty.
476 Existing files will be left intact.
477 .It Fl b Ar branch
478 Check out files from a commit on the specified
479 .Ar branch .
480 If this option is not specified, a branch resolved via the repository's HEAD
481 reference will be used.
482 .It Fl c Ar commit
483 Check out files from the specified
484 .Ar commit
485 on the selected branch.
486 The expected argument is a commit ID SHA1 hash or an existing reference
487 or tag name which will be resolved to a commit ID.
488 An abbreviated hash argument will be expanded to a full SHA1 hash
489 automatically, provided the abbreviation is unique.
490 If this option is not specified, the most recent commit on the selected
491 branch will be used.
492 .Pp
493 If the specified
494 .Ar commit
495 is not contained in the selected branch, a different branch which contains
496 this commit must be specified with the
497 .Fl b
498 option.
499 If no such branch is known a new branch must be created for this
500 commit with
501 .Cm got branch
502 before
503 .Cm got checkout
504 can be used.
505 Checking out work trees with an unknown branch is intentionally not supported.
506 .It Fl p Ar path-prefix
507 Restrict the work tree to a subset of the repository's tree hierarchy.
508 Only files beneath the specified
509 .Ar path-prefix
510 will be checked out.
511 .El
512 .It Cm co
513 Short alias for
514 .Cm checkout .
515 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
516 Update an existing work tree to a different commit.
517 Show the status of each affected file, using the following status codes:
518 .Bl -column YXZ description
519 .It U Ta file was updated and contained no local changes
520 .It G Ta file was updated and local changes were merged cleanly
521 .It C Ta file was updated and conflicts occurred during merge
522 .It D Ta file was deleted
523 .It A Ta new file was added
524 .It \(a~ Ta versioned file is obstructed by a non-regular file
525 .It ! Ta a missing versioned file was restored
526 .El
527 .Pp
528 If no
529 .Ar path
530 is specified, update the entire work tree.
531 Otherwise, restrict the update operation to files at or within the
532 specified paths.
533 Each path is required to exist in the update operation's target commit.
534 Files in the work tree outside specified paths will remain unchanged and
535 will retain their previously recorded base commit.
536 Some
537 .Nm
538 commands may refuse to run while the work tree contains files from
539 multiple base commits.
540 The base commit of such a work tree can be made consistent by running
541 .Cm got update
542 across the entire work tree.
543 Specifying a
544 .Ar path
545 is incompatible with the
546 .Fl b
547 option.
548 .Pp
549 .Cm got update
550 cannot update paths with staged changes.
551 If changes have been staged with
552 .Cm got stage ,
553 these changes must first be committed with
554 .Cm got commit
555 or unstaged with
556 .Cm got unstage .
557 .Pp
558 The options for
559 .Cm got update
560 are as follows:
561 .Bl -tag -width Ds
562 .It Fl b Ar branch
563 Switch the work tree's branch reference to the specified
564 .Ar branch
565 before updating the work tree.
566 This option requires that all paths in the work tree are updated.
567 .It Fl c Ar commit
568 Update the work tree to the specified
569 .Ar commit .
570 The expected argument is a commit ID SHA1 hash or an existing reference
571 or tag name which will be resolved to a commit ID.
572 An abbreviated hash argument will be expanded to a full SHA1 hash
573 automatically, provided the abbreviation is unique.
574 If this option is not specified, the most recent commit on the work tree's
575 branch will be used.
576 .El
577 .It Cm up
578 Short alias for
579 .Cm update .
580 .It Cm status Op Ar path ...
581 Show the current modification status of files in a work tree,
582 using the following status codes:
583 .Bl -column YXZ description
584 .It M Ta modified file
585 .It A Ta file scheduled for addition in next commit
586 .It D Ta file scheduled for deletion in next commit
587 .It C Ta modified or added file which contains merge conflicts
588 .It ! Ta versioned file was expected on disk but is missing
589 .It \(a~ Ta versioned file is obstructed by a non-regular file
590 .It ? Ta unversioned item not tracked by
591 .Nm
592 .It m Ta modified file modes (executable bit only)
593 .It N Ta non-existent
594 .Ar path
595 specified on the command line
596 .El
597 .Pp
598 If no
599 .Ar path
600 is specified, show modifications in the entire work tree.
601 Otherwise, show modifications at or within the specified paths.
602 .Pp
603 If changes have been staged with
604 .Cm got stage ,
605 staged changes are shown in the second output column, using the following
606 status codes:
607 .Bl -column YXZ description
608 .It M Ta file modification is staged
609 .It A Ta file addition is staged
610 .It D Ta file deletion is staged
611 .El
612 .Pp
613 Changes created on top of staged changes are indicated in the first column:
614 .Bl -column YXZ description
615 .It MM Ta file was modified after earlier changes have been staged
616 .It MA Ta file was modified after having been staged for addition
617 .El
618 .Pp
619 For compatibility with
620 .Xr cvs 1
621 and
622 .Xr git 1 ,
623 .Cm got status
624 reads
625 .Xr glob 7
626 patterns from
627 .Pa .cvsignore
628 and
629 .Pa .gitignore
630 files in each traversed directory and will not display unversioned files
631 which match these patterns.
632 As an extension to
633 .Xr glob 7
634 matching rules,
635 .Cm got status
636 supports consecutive asterisks,
637 .Dq ** ,
638 which will match an arbitrary amount of directories.
639 Unlike
640 .Xr cvs 1 ,
641 .Cm got status
642 only supports a single ignore pattern per line.
643 Unlike
644 .Xr git 1 ,
645 .Cm got status
646 does not support negated ignore patterns prefixed with
647 .Dq \&! ,
648 and gives no special significance to the location of path component separators,
649 .Dq / ,
650 in a pattern.
651 .It Cm st
652 Short alias for
653 .Cm status .
654 .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 s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Op Ar path
655 Display history of a repository.
656 If a
657 .Ar path
658 is specified, show only commits which modified this path.
659 If invoked in a work tree, the
660 .Ar path
661 is interpreted relative to the current working directory,
662 and the work tree's path prefix is implicitly prepended.
663 Otherwise, the path is interpreted relative to the repository root.
664 .Pp
665 The options for
666 .Cm got log
667 are as follows:
668 .Bl -tag -width Ds
669 .It Fl b
670 Display individual commits which were merged into the current branch
671 from other branches.
672 By default,
673 .Cm got log
674 shows the linear history of the current branch only.
675 .It Fl c Ar commit
676 Start traversing history at the specified
677 .Ar commit .
678 The expected argument is a commit ID SHA1 hash or an existing reference
679 or tag name which will be resolved to a commit ID.
680 An abbreviated hash argument will be expanded to a full SHA1 hash
681 automatically, provided the abbreviation is unique.
682 If this option is not specified, default to the work tree's current branch
683 if invoked in a work tree, or to the repository's HEAD reference.
684 .It Fl C Ar number
685 Set the number of context lines shown in diffs with
686 .Fl p .
687 By default, 3 lines of context are shown.
688 .It Fl l Ar N
689 Limit history traversal to a given number of commits.
690 If this option is not specified, a default limit value of zero is used,
691 which is treated as an unbounded limit.
692 The
693 .Ev GOT_LOG_DEFAULT_LIMIT
694 environment variable may be set to change this default value.
695 .It Fl p
696 Display the patch of modifications made in each commit.
697 If a
698 .Ar path
699 is specified, only show the patch of modifications at or within this path.
700 .It Fl s Ar search-pattern
701 If specified, show only commits with a log message matched by the extended
702 regular expression
703 .Ar search-pattern .
704 Regular expression syntax is documented in
705 .Xr re_format 7 .
706 .It Fl r Ar repository-path
707 Use the repository at the specified path.
708 If not specified, assume the repository is located at or above the current
709 working directory.
710 If this directory is a
711 .Nm
712 work tree, use the repository path associated with this work tree.
713 .El
714 .It Cm diff Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path
715 When invoked within a work tree with less than two arguments, display
716 uncommitted changes in the work tree.
717 If a
718 .Ar path
719 is specified, only show changes within this path.
720 .Pp
721 If two arguments are provided, treat each argument as a reference, a tag
722 name, or an object ID SHA1 hash, and display differences between the
723 corresponding objects.
724 Both objects must be of the same type (blobs, trees, or commits).
725 An abbreviated hash argument will be expanded to a full SHA1 hash
726 automatically, provided the abbreviation is unique.
727 .Pp
728 The options for
729 .Cm got diff
730 are as follows:
731 .Bl -tag -width Ds
732 .It Fl C Ar number
733 Set the number of context lines shown in the diff.
734 By default, 3 lines of context are shown.
735 .It Fl r Ar repository-path
736 Use the repository at the specified path.
737 If not specified, assume the repository is located at or above the current
738 working directory.
739 If this directory is a
740 .Nm
741 work tree, use the repository path associated with this work tree.
742 .It Fl s
743 Show changes staged with
744 .Cm got stage
745 instead of showing local changes.
746 This option is only valid when
747 .Cm got diff
748 is invoked in a work tree.
749 .It Fl w
750 Ignore whitespace-only changes.
751 .El
752 .It Cm di
753 Short alias for
754 .Cm diff .
755 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
756 Display line-by-line history of a file at the specified path.
757 .Pp
758 The options for
759 .Cm got blame
760 are as follows:
761 .Bl -tag -width Ds
762 .It Fl c Ar commit
763 Start traversing history at the specified
764 .Ar commit .
765 The expected argument is a commit ID SHA1 hash or an existing reference
766 or tag name which will be resolved to a commit ID.
767 An abbreviated hash argument will be expanded to a full SHA1 hash
768 automatically, provided the abbreviation is unique.
769 .It Fl r Ar repository-path
770 Use the repository at the specified path.
771 If not specified, assume the repository is located at or above the current
772 working directory.
773 If this directory is a
774 .Nm
775 work tree, use the repository path associated with this work tree.
776 .El
777 .It Cm bl
778 Short alias for
779 .Cm blame .
780 .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
781 Display a listing of files and directories at the specified
782 directory path in the repository.
783 Entries shown in this listing may carry one of the following trailing
784 annotations:
785 .Bl -column YXZ description
786 .It @ Ta entry is a symbolic link
787 .It / Ta entry is a directory
788 .It * Ta entry is an executable file
789 .It $ Ta entry is a Git submodule
790 .El
791 .Pp
792 If no
793 .Ar path
794 is specified, list the repository path corresponding to the current
795 directory of the work tree, or the root directory of the repository
796 if there is no work tree.
797 .Pp
798 The options for
799 .Cm got tree
800 are as follows:
801 .Bl -tag -width Ds
802 .It Fl c Ar commit
803 List files and directories as they appear in the specified
804 .Ar commit .
805 The expected argument is a commit ID SHA1 hash or an existing reference
806 or tag name which will be resolved to a commit ID.
807 An abbreviated hash argument will be expanded to a full SHA1 hash
808 automatically, provided the abbreviation is unique.
809 .It Fl r Ar repository-path
810 Use the repository at the specified path.
811 If not specified, assume the repository is located at or above the current
812 working directory.
813 If this directory is a
814 .Nm
815 work tree, use the repository path associated with this work tree.
816 .It Fl i
817 Show object IDs of files (blob objects) and directories (tree objects).
818 .It Fl R
819 Recurse into sub-directories in the repository.
820 .El
821 .It Cm tr
822 Short alias for
823 .Cm tree .
824 .It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl c Ar object Oc Oo Fl s Ar reference Oc Oo Fl d Oc Op Ar name
825 Manage references in a repository.
826 .Pp
827 References may be listed, created, deleted, and changed.
828 When creating, deleting, or changing a reference the specified
829 .Ar name
830 must be an absolute reference name, i.e. it must begin with
831 .Dq refs/ .
832 .Pp
833 .Pp
834 The options for
835 .Cm got ref
836 are as follows:
837 .Bl -tag -width Ds
838 .It Fl r Ar repository-path
839 Use the repository at the specified path.
840 If not specified, assume the repository is located at or above the current
841 working directory.
842 If this directory is a
843 .Nm
844 work tree, use the repository path associated with this work tree.
845 .It Fl l
846 List references in the repository.
847 If no
848 .Ar name
849 is specified, list all existing references in the repository.
850 If
851 .Ar name
852 is a reference namespace, list all references in this namespace.
853 Otherwise, show only the reference with the given
854 .Ar name .
855 Cannot be used together with any other options except
856 .Fl r .
857 .It Fl c Ar object
858 Create a reference or change an existing reference.
859 The reference with the specified
860 .Ar name
861 will point at the specified
862 .Ar object.
863 The expected
864 .Ar object
865 argument is a ID SHA1 hash or an existing reference or tag name which will
866 be resolved to the ID of a corresponding commit, tree, tag, or blob object.
867 Cannot be used together with any other options except
868 .Fl r .
869 .It Fl s Ar reference
870 Create a symbolic reference, or change an existing symbolic reference.
871 The symbolic reference with the specified
872 .Ar name
873 will point at the specified
874 .Ar reference
875 which must already exist in the repository.
876 Care should be taken not to create loops between references when
877 this option is used.
878 Cannot be used together with any other options except
879 .Fl r .
880 .It Fl d
881 Delete the reference with the specified
882 .Ar name
883 from the repository.
884 Cannot be used together with any other options except
885 .Fl r .
886 .El
887 .It Cm branch Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Oo Fl n Oc Op Ar name
888 Create, list, or delete branches.
889 .Pp
890 Branches are managed via references which live in the
891 .Dq refs/heads/
892 reference namespace.
893 The
894 .Cm got branch
895 command operates on references in this namespace only.
896 .Pp
897 If invoked in a work tree without any arguments, print the name of the
898 work tree's current branch.
899 .Pp
900 If a
901 .Ar name
902 argument is passed, attempt to create a branch reference with the given name.
903 By default the new branch reference will point at the latest commit on the
904 work tree's current branch if invoked in a work tree, and otherwise to a commit
905 resolved via the repository's HEAD reference.
906 .Pp
907 If invoked in a work tree, once the branch was created successfully
908 switch the work tree's head reference to the newly created branch and
909 update files across the entire work tree, just like
910 .Cm got update -b Ar name
911 would do.
912 Show the status of each affected file, using the following status codes:
913 .Bl -column YXZ description
914 .It U Ta file was updated and contained no local changes
915 .It G Ta file was updated and local changes were merged cleanly
916 .It C Ta file was updated and conflicts occurred during merge
917 .It D Ta file was deleted
918 .It A Ta new file was added
919 .It \(a~ Ta versioned file is obstructed by a non-regular file
920 .It ! Ta a missing versioned file was restored
921 .El
922 .Pp
923 The options for
924 .Cm got branch
925 are as follows:
926 .Bl -tag -width Ds
927 .It Fl c Ar commit
928 Make a newly created branch reference point at the specified
929 .Ar commit .
930 The expected
931 .Ar commit
932 argument is a commit ID SHA1 hash or an existing reference
933 or tag name which will be resolved to a commit ID.
934 .It Fl r Ar repository-path
935 Use the repository at the specified path.
936 If not specified, assume the repository is located at or above the current
937 working directory.
938 If this directory is a
939 .Nm
940 work tree, use the repository path associated with this work tree.
941 .It Fl l
942 List all existing branches in the repository.
943 If invoked in a work tree, the work tree's current branch is shown
944 with one the following annotations:
945 .Bl -column YXZ description
946 .It * Ta work tree's base commit matches the branch tip
947 .It \(a~ Ta work tree's base commit is out-of-date
948 .El
949 .It Fl d Ar name
950 Delete the branch with the specified name from the repository.
951 Only the branch reference is deleted.
952 Any commit, tree, and blob objects belonging to the branch
953 remain in the repository and may be removed separately with
954 Git's garbage collector.
955 .It Fl n
956 Do not switch and update the work tree after creating a new branch.
957 .El
958 .It Cm br
959 Short alias for
960 .Cm branch .
961 .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
962 Manage tags in a repository.
963 .Pp
964 Tags are managed via references which live in the
965 .Dq refs/tags/
966 reference namespace.
967 The
968 .Cm got tag
969 command operates on references in this namespace only.
970 References in this namespace point at tag objects which contain a pointer
971 to another object, a tag message, as well as author and timestamp information.
972 .Pp
973 Attempt to create a tag with the given
974 .Ar name ,
975 and make this tag point at the given
976 .Ar commit .
977 If no commit is specified, default to the latest commit on the work tree's
978 current branch if invoked in a work tree, and to a commit resolved via
979 the repository's HEAD reference otherwise.
980 .Pp
981 The options for
982 .Cm got tag
983 are as follows:
984 .Bl -tag -width Ds
985 .It Fl c Ar commit
986 Make the newly created tag reference point at the specified
987 .Ar commit .
988 The expected
989 .Ar commit
990 argument is a commit ID SHA1 hash or an existing reference or tag name which
991 will be resolved to a commit ID.
992 An abbreviated hash argument will be expanded to a full SHA1 hash
993 automatically, provided the abbreviation is unique.
994 .It Fl m Ar message
995 Use the specified tag message when creating the new tag.
996 Without the
997 .Fl m
998 option,
999 .Cm got tag
1000 opens a temporary file in an editor where a tag message can be written.
1001 .It Fl r Ar repository-path
1002 Use the repository at the specified path.
1003 If not specified, assume the repository is located at or above the current
1004 working directory.
1005 If this directory is a
1006 .Nm
1007 work tree, use the repository path associated with this work tree.
1008 .It Fl l
1009 List all existing tags in the repository instead of creating a new tag.
1010 If this option is used, no other command-line arguments are allowed.
1011 .El
1012 .Pp
1013 By design, the
1014 .Cm got tag
1015 command will not delete tags or change existing tags.
1016 If a tag must be deleted, the
1017 .Cm got ref
1018 command may be used to delete a tag's reference.
1019 This should only be done if the tag has not already been copied to
1020 another repository.
1021 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
1022 Schedule unversioned files in a work tree for addition to the
1023 repository in the next commit.
1024 .Pp
1025 The options for
1026 .Cm got add
1027 are as follows:
1028 .Bl -tag -width Ds
1029 .It Fl R
1030 Permit recursion into directories.
1031 If this option is not specified,
1032 .Cm got add
1033 will refuse to run if a specified
1034 .Ar path
1035 is a directory.
1036 .It Fl I
1037 With -R, add files even if they match a
1038 .Cm got status
1039 ignore pattern.
1040 .El
1041 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Ar path ...
1042 Remove versioned files from a work tree and schedule them for deletion
1043 from the repository in the next commit.
1044 .Pp
1045 The options for
1046 .Cm got remove
1047 are as follows:
1048 .Bl -tag -width Ds
1049 .It Fl f
1050 Perform the operation even if a file contains uncommitted modifications.
1051 .It Fl k
1052 Keep affected files on disk.
1053 .It Fl R
1054 Permit recursion into directories.
1055 If this option is not specified,
1056 .Cm got remove
1057 will refuse to run if a specified
1058 .Ar path
1059 is a directory.
1060 .El
1061 .It Cm rm
1062 Short alias for
1063 .Cm remove .
1064 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
1065 Revert any uncommitted changes in files at the specified paths.
1066 File contents will be overwritten with those contained in the
1067 work tree's base commit.
1068 There is no way to bring discarded changes back after
1069 .Cm got revert !
1070 .Pp
1071 If a file was added with
1072 .Cm got add
1073 it will become an unversioned file again.
1074 If a file was deleted with
1075 .Cm got remove
1076 it will be restored.
1077 .Pp
1078 The options for
1079 .Cm got revert
1080 are as follows:
1081 .Bl -tag -width Ds
1082 .It Fl p
1083 Instead of reverting all changes in files, interactively select or reject
1084 changes to revert based on
1085 .Dq y
1086 (revert change),
1087 .Dq n
1088 (keep change), and
1089 .Dq q
1090 (quit reverting this file) responses.
1091 If a file is in modified status, individual patches derived from the
1092 modified file content can be reverted.
1093 Files in added or deleted status may only be reverted in their entirety.
1094 .It Fl F Ar response-script
1095 With the
1096 .Fl p
1097 option, read
1098 .Dq y ,
1099 .Dq n ,
1100 and
1101 .Dq q
1102 responses line-by-line from the specified
1103 .Ar response-script
1104 file instead of prompting interactively.
1105 .It Fl R
1106 Permit recursion into directories.
1107 If this option is not specified,
1108 .Cm got revert
1109 will refuse to run if a specified
1110 .Ar path
1111 is a directory.
1112 .El
1113 .It Cm rv
1114 Short alias for
1115 .Cm revert .
1116 .It Cm commit Oo Fl m Ar message Oc Op Ar path ...
1117 Create a new commit in the repository from changes in a work tree
1118 and use this commit as the new base commit for the work tree.
1119 If no
1120 .Ar path
1121 is specified, commit all changes in the work tree.
1122 Otherwise, commit changes at or within the specified paths.
1123 .Pp
1124 If changes have been explicitly staged for commit with
1125 .Cm got stage ,
1126 only commit staged changes and reject any specified paths which
1127 have not been staged.
1128 .Pp
1129 Show the status of each affected file, using the following status codes:
1130 .Bl -column YXZ description
1131 .It M Ta modified file
1132 .It D Ta file was deleted
1133 .It A Ta new file was added
1134 .It m Ta modified file modes (executable bit only)
1135 .El
1136 .Pp
1137 Files which are not part of the new commit will retain their previously
1138 recorded base commit.
1139 Some
1140 .Nm
1141 commands may refuse to run while the work tree contains files from
1142 multiple base commits.
1143 The base commit of such a work tree can be made consistent by running
1144 .Cm got update
1145 across the entire work tree.
1146 .Pp
1147 The
1148 .Cm got commit
1149 command requires the
1150 .Ev GOT_AUTHOR
1151 environment variable to be set,
1152 unless Git's
1153 .Dv user.name
1154 and
1155 .Dv user.email
1156 configuration settings can be
1157 obtained from the repository's
1158 .Pa .git/config
1159 file or from Git's global
1160 .Pa ~/.gitconfig
1161 configuration file.
1162 .Pp
1163 The options for
1164 .Cm got commit
1165 are as follows:
1166 .Bl -tag -width Ds
1167 .It Fl m Ar message
1168 Use the specified log message when creating the new commit.
1169 Without the
1170 .Fl m
1171 option,
1172 .Cm got commit
1173 opens a temporary file in an editor where a log message can be written.
1174 .El
1175 .Pp
1176 .Cm got commit
1177 will refuse to run if certain preconditions are not met.
1178 If the work tree's current branch is not in the
1179 .Dq refs/heads/
1180 reference namespace, new commits may not be created on this branch.
1181 Local changes may only be committed if they are based on file content
1182 found in the most recent commit on the work tree's branch.
1183 If a path is found to be out of date,
1184 .Cm got update
1185 must be used first in order to merge local changes with changes made
1186 in the repository.
1187 .It Cm ci
1188 Short alias for
1189 .Cm commit .
1190 .It Cm cherrypick Ar commit
1191 Merge changes from a single
1192 .Ar commit
1193 into the work tree.
1194 The specified
1195 .Ar commit
1196 must be on a different branch than the work tree's base commit.
1197 The expected argument is a reference or a commit ID SHA1 hash.
1198 An abbreviated hash argument will be expanded to a full SHA1 hash
1199 automatically, provided the abbreviation is unique.
1200 .Pp
1201 Show the status of each affected file, using the following status codes:
1202 .Bl -column YXZ description
1203 .It G Ta file was merged
1204 .It C Ta file was merged and conflicts occurred during merge
1205 .It ! Ta changes destined for a missing file were not merged
1206 .It D Ta file was deleted
1207 .It d Ta file's deletion was obstructed by local modifications
1208 .It A Ta new file was added
1209 .It \(a~ Ta changes destined for a non-regular file were not merged
1210 .El
1211 .Pp
1212 The merged changes will appear as local changes in the work tree, which
1213 may be viewed with
1214 .Cm got diff ,
1215 amended manually or with further
1216 .Cm got cherrypick
1217 commands,
1218 committed with
1219 .Cm got commit ,
1220 or discarded again with
1221 .Cm got revert .
1222 .Pp
1223 .Cm got cherrypick
1224 will refuse to run if certain preconditions are not met.
1225 If the work tree contains multiple base commits it must first be updated
1226 to a single base commit with
1227 .Cm got update .
1228 If the work tree already contains files with merge conflicts, these
1229 conflicts must be resolved first.
1230 .It Cm cy
1231 Short alias for
1232 .Cm cherrypick .
1233 .It Cm backout Ar commit
1234 Reverse-merge changes from a single
1235 .Ar commit
1236 into the work tree.
1237 The specified
1238 .Ar commit
1239 must be on the same branch as the work tree's base commit.
1240 The expected argument is a reference or a commit ID SHA1 hash.
1241 An abbreviated hash argument will be expanded to a full SHA1 hash
1242 automatically, provided the abbreviation is unique.
1243 .Pp
1244 Show the status of each affected file, using the following status codes:
1245 .Bl -column YXZ description
1246 .It G Ta file was merged
1247 .It C Ta file was merged and conflicts occurred during merge
1248 .It ! Ta changes destined for a missing file were not merged
1249 .It D Ta file was deleted
1250 .It d Ta file's deletion was obstructed by local modifications
1251 .It A Ta new file was added
1252 .It \(a~ Ta changes destined for a non-regular file were not merged
1253 .El
1254 .Pp
1255 The reverse-merged changes will appear as local changes in the work tree,
1256 which may be viewed with
1257 .Cm got diff ,
1258 amended manually or with further
1259 .Cm got backout
1260 commands,
1261 committed with
1262 .Cm got commit ,
1263 or discarded again with
1264 .Cm got revert .
1265 .Pp
1266 .Cm got backout
1267 will refuse to run if certain preconditions are not met.
1268 If the work tree contains multiple base commits it must first be updated
1269 to a single base commit with
1270 .Cm got update .
1271 If the work tree already contains files with merge conflicts, these
1272 conflicts must be resolved first.
1273 .It Cm bo
1274 Short alias for
1275 .Cm backout .
1276 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
1277 Rebase commits on the specified
1278 .Ar branch
1279 onto the tip of the current branch of the work tree.
1280 The
1281 .Ar branch
1282 must share common ancestry with the work tree's current branch.
1283 Rebasing begins with the first descendant commit of the youngest
1284 common ancestor commit shared by the specified
1285 .Ar branch
1286 and the work tree's current branch, and stops once the tip commit
1287 of the specified
1288 .Ar branch
1289 has been rebased.
1290 .Pp
1291 When
1292 .Cm got rebase
1293 is used as intended, the specified
1294 .Ar branch
1295 represents a local commit history and may already contain changes
1296 that are not yet visible in any other repositories.
1297 The work tree's current branch, which must be set with
1298 .Cm got update -b
1299 before starting the
1300 .Cm rebase
1301 operation, represents a branch from a remote repository which shares
1302 a common history with the specified
1303 .Ar branch
1304 but has progressed, and perhaps diverged, due to commits added to the
1305 remote repository.
1306 .Pp
1307 Rebased commits are accumulated on a temporary branch which the work tree
1308 will remain switched to throughout the entire rebase operation.
1309 Commits on this branch represent the same changes with the same log
1310 messages as their counterparts on the original
1311 .Ar branch ,
1312 but with different commit IDs.
1313 Once rebasing has completed successfully, the temporary branch becomes
1314 the new version of the specified
1315 .Ar branch
1316 and the work tree is automatically switched to it.
1317 .Pp
1318 While rebasing commits, show the status of each affected file,
1319 using the following status codes:
1320 .Bl -column YXZ description
1321 .It G Ta file was merged
1322 .It C Ta file was merged and conflicts occurred during merge
1323 .It ! Ta changes destined for a missing file were not merged
1324 .It D Ta file was deleted
1325 .It d Ta file's deletion was obstructed by local modifications
1326 .It A Ta new file was added
1327 .It \(a~ Ta changes destined for a non-regular file were not merged
1328 .El
1329 .Pp
1330 If merge conflicts occur the rebase operation is interrupted and may
1331 be continued once conflicts have been resolved.
1332 Alternatively, the rebase operation may be aborted which will leave
1333 .Ar branch
1334 unmodified and the work tree switched back to its original branch.
1335 .Pp
1336 If a merge conflict is resolved in a way which renders the merged
1337 change into a no-op change, the corresponding commit will be elided
1338 when the rebase operation continues.
1339 .Pp
1340 .Cm got rebase
1341 will refuse to run if certain preconditions are not met.
1342 If the work tree is not yet fully updated to the tip commit of its
1343 branch then the work tree must first be updated with
1344 .Cm got update .
1345 If changes have been staged with
1346 .Cm got stage ,
1347 these changes must first be committed with
1348 .Cm got commit
1349 or unstaged with
1350 .Cm got unstage .
1351 If the work tree contains local changes, these changes must first be
1352 committed with
1353 .Cm got commit
1354 or reverted with
1355 .Cm got revert .
1356 If the
1357 .Ar branch
1358 contains changes to files outside of the work tree's path prefix,
1359 the work tree cannot be used to rebase this branch.
1360 .Pp
1361 The
1362 .Cm got update
1363 and
1364 .Cm got commit
1365 commands will refuse to run while a rebase operation is in progress.
1366 Other commands which manipulate the work tree may be used for
1367 conflict resolution purposes.
1368 .Pp
1369 The options for
1370 .Cm got rebase
1371 are as follows:
1372 .Bl -tag -width Ds
1373 .It Fl a
1374 Abort an interrupted rebase operation.
1375 If this option is used, no other command-line arguments are allowed.
1376 .It Fl c
1377 Continue an interrupted rebase operation.
1378 If this option is used, no other command-line arguments are allowed.
1379 .El
1380 .It Cm rb
1381 Short alias for
1382 .Cm rebase .
1383 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc
1384 Edit commit history between the work tree's current base commit and
1385 the tip commit of the work tree's current branch.
1386 .Pp
1387 Before starting a
1388 .Cm histedit
1389 operation the work tree's current branch must be set with
1390 .Cm got update -b
1391 to the branch which should be edited, unless this branch is already the
1392 current branch of the work tree.
1393 The tip of this branch represents the upper bound (inclusive) of commits
1394 touched by the
1395 .Cm histedit
1396 operation.
1397 .Pp
1398 Furthermore, the work tree's base commit
1399 must be set with
1400 .Cm got update -c
1401 to a point in this branch's commit history where editing should begin.
1402 This commit represents the lower bound (non-inclusive) of commits touched
1403 by the
1404 .Cm histedit
1405 operation.
1406 .Pp
1407 Editing of commit history is controlled via a
1408 .Ar histedit script
1409 which can be written in an editor based on a template, passed on the
1410 command line, or generated with the
1411 .Fl m
1412 option if only log messages need to be edited.
1413 .Pp
1414 The format of the histedit script is line-based.
1415 Each line in the script begins with a command name, followed by
1416 whitespace and an argument.
1417 For most commands, the expected argument is a commit ID SHA1 hash.
1418 Any remaining text on the line is ignored.
1419 Lines which begin with the
1420 .Sq #
1421 character are ignored entirely.
1422 .Pp
1423 The available commands are as follows:
1424 .Bl -column YXZ pick-commit
1425 .It pick Ar commit Ta Use the specified commit as it is.
1426 .It edit Ar commit Ta Use the specified commit but once changes have been
1427 merged into the work tree interrupt the histedit operation for amending.
1428 .It fold Ar commit Ta Combine the specified commit with the next commit
1429 listed further below that will be used.
1430 .It drop Ar commit Ta Remove this commit from the edited history.
1431 .It mesg Ar log-message Ta Use the specified single-line log message for
1432 the commit on the previous line.
1433 If the log message argument is left empty, open an editor where a new
1434 log message can be written.
1435 .El
1436 .Pp
1437 Every commit in the history being edited must be mentioned in the script.
1438 Lines may be re-ordered to change the order of commits in the edited history.
1439 No commit may be listed more than once.
1440 .Pp
1441 Edited commits are accumulated on a temporary branch which the work tree
1442 will remain switched to throughout the entire histedit operation.
1443 Once history editing has completed successfully, the temporary branch becomes
1444 the new version of the work tree's branch and the work tree is automatically
1445 switched to it.
1446 .Pp
1447 While merging commits, show the status of each affected file,
1448 using the following status codes:
1449 .Bl -column YXZ description
1450 .It G Ta file was merged
1451 .It C Ta file was merged and conflicts occurred during merge
1452 .It ! Ta changes destined for a missing file were not merged
1453 .It D Ta file was deleted
1454 .It d Ta file's deletion was obstructed by local modifications
1455 .It A Ta new file was added
1456 .It \(a~ Ta changes destined for a non-regular file were not merged
1457 .El
1458 .Pp
1459 If merge conflicts occur the histedit operation is interrupted and may
1460 be continued once conflicts have been resolved.
1461 Alternatively, the histedit operation may be aborted which will leave
1462 the work tree switched back to its original branch.
1463 .Pp
1464 If a merge conflict is resolved in a way which renders the merged
1465 change into a no-op change, the corresponding commit will be elided
1466 when the histedit operation continues.
1467 .Pp
1468 .Cm got histedit
1469 will refuse to run if certain preconditions are not met.
1470 If the work tree's current branch is not in the
1471 .Dq refs/heads/
1472 reference namespace, the history of the branch may not be edited.
1473 If the work tree contains multiple base commits it must first be updated
1474 to a single base commit with
1475 .Cm got update .
1476 If changes have been staged with
1477 .Cm got stage ,
1478 these changes must first be committed with
1479 .Cm got commit
1480 or unstaged with
1481 .Cm got unstage .
1482 If the work tree contains local changes, these changes must first be
1483 committed with
1484 .Cm got commit
1485 or reverted with
1486 .Cm got revert .
1487 If the edited history contains changes to files outside of the work tree's
1488 path prefix, the work tree cannot be used to edit the history of this branch.
1489 .Pp
1490 The
1491 .Cm got update ,
1492 .Cm got rebase ,
1493 and
1494 .Cm got integrate
1495 commands will refuse to run while a histedit operation is in progress.
1496 Other commands which manipulate the work tree may be used, and the
1497 .Cm got commit
1498 command may be used to commit arbitrary changes to the temporary branch
1499 while the histedit operation is interrupted.
1500 .Pp
1501 The options for
1502 .Cm got histedit
1503 are as follows:
1504 .Bl -tag -width Ds
1505 .It Fl a
1506 Abort an interrupted histedit operation.
1507 If this option is used, no other command-line arguments are allowed.
1508 .It Fl c
1509 Continue an interrupted histedit operation.
1510 If this option is used, no other command-line arguments are allowed.
1511 .It Fl F Ar histedit-script
1512 Use the specified
1513 .Ar histedit-script
1514 instead of opening a temporary file in an editor where a histedit script
1515 can be written.
1516 .It Fl m
1517 Edit log messages only.
1518 This option is a quick equivalent to a histedit script which edits
1519 only log messages but otherwise leaves every picked commit as-is.
1520 The
1521 .Fl m
1522 option can only be used when starting a new histedit operation.
1523 If this option is used, no other command-line arguments are allowed.
1524 .El
1525 .It Cm he
1526 Short alias for
1527 .Cm histedit .
1528 .It Cm integrate Ar branch
1529 Integrate the specified
1530 .Ar branch
1531 into the work tree's current branch.
1532 Files in the work tree are updated to match the contents on the integrated
1533 .Ar branch ,
1534 and the reference of the work tree's branch is changed to point at the
1535 head commit of the integrated
1536 .Ar branch .
1537 .Pp
1538 Both branches can be considered equivalent after integration since they
1539 will be pointing at the same commit.
1540 Both branches remain available for future work, if desired.
1541 In case the integrated
1542 .Ar branch
1543 is no longer needed it may be deleted with
1544 .Cm got branch -d .
1545 .Pp
1546 Show the status of each affected file, using the following status codes:
1547 .Bl -column YXZ description
1548 .It U Ta file was updated
1549 .It D Ta file was deleted
1550 .It A Ta new file was added
1551 .It \(a~ Ta versioned file is obstructed by a non-regular file
1552 .It ! Ta a missing versioned file was restored
1553 .El
1554 .Pp
1555 .Cm got integrate
1556 will refuse to run if certain preconditions are not met.
1557 Most importantly, the
1558 .Ar branch
1559 must have been rebased onto the work tree's current branch with
1560 .Cm got rebase
1561 before it can be integrated, in order to linearize commit history and
1562 resolve merge conflicts.
1563 If the work tree contains multiple base commits it must first be updated
1564 to a single base commit with
1565 .Cm got update .
1566 If changes have been staged with
1567 .Cm got stage ,
1568 these changes must first be committed with
1569 .Cm got commit
1570 or unstaged with
1571 .Cm got unstage .
1572 If the work tree contains local changes, these changes must first be
1573 committed with
1574 .Cm got commit
1575 or reverted with
1576 .Cm got revert .
1577 .It Cm ig
1578 Short alias for
1579 .Cm integrate .
1580 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1581 Stage local changes for inclusion in the next commit.
1582 If no
1583 .Ar path
1584 is specified, stage all changes in the work tree.
1585 Otherwise, stage changes at or within the specified paths.
1586 Paths may be staged if they are added, modified, or deleted according to
1587 .Cm got status .
1588 .Pp
1589 Show the status of each affected file, using the following status codes:
1590 .Bl -column YXZ description
1591 .It A Ta file addition has been staged
1592 .It M Ta file modification has been staged
1593 .It D Ta file deletion has been staged
1594 .El
1595 .Pp
1596 Staged file contents are saved in newly created blob objects in the repository.
1597 These blobs will be referred to by tree objects once staged changes have been
1598 committed.
1599 .Pp
1600 Staged changes affect the behaviour of
1601 .Cm got commit ,
1602 .Cm got status ,
1603 and
1604 .Cm got diff .
1605 While paths with staged changes exist, the
1606 .Cm got commit
1607 command will refuse to commit any paths which do not have staged changes.
1608 Local changes created on top of staged changes can only be committed if
1609 the path is staged again, or if the staged changes are committed first.
1610 The
1611 .Cm got status
1612 command will show both local changes and staged changes.
1613 The
1614 .Cm got diff
1615 command is able to display local changes relative to staged changes,
1616 and to display staged changes relative to the repository.
1617 The
1618 .Cm got revert
1619 command cannot revert staged changes but may be used to revert
1620 local changes created on top of staged changes.
1621 .Pp
1622 The options for
1623 .Cm got stage
1624 are as follows:
1625 .Bl -tag -width Ds
1626 .It Fl l
1627 Instead of staging new changes, list paths which are already staged,
1628 along with the IDs of staged blob objects and stage status codes.
1629 If paths were provided in the command line show the staged paths
1630 among the specified paths.
1631 Otherwise, show all staged paths.
1632 .It Fl p
1633 Instead of staging the entire content of a changed file, interactively
1634 select or reject changes for staging based on
1635 .Dq y
1636 (stage change),
1637 .Dq n
1638 (reject change), and
1639 .Dq q
1640 (quit staging this file) responses.
1641 If a file is in modified status, individual patches derived from the
1642 modified file content can be staged.
1643 Files in added or deleted status may only be staged or rejected in
1644 their entirety.
1645 .It Fl F Ar response-script
1646 With the
1647 .Fl p
1648 option, read
1649 .Dq y ,
1650 .Dq n ,
1651 and
1652 .Dq q
1653 responses line-by-line from the specified
1654 .Ar response-script
1655 file instead of prompting interactively.
1656 .El
1657 .Pp
1658 .Cm got stage
1659 will refuse to run if certain preconditions are not met.
1660 If a file contains merge conflicts, these conflicts must be resolved first.
1661 If a file is found to be out of date relative to the head commit on the
1662 work tree's current branch, the file must be updated with
1663 .Cm got update
1664 before it can be staged (however, this does not prevent the file from
1665 becoming out-of-date at some point after having been staged).
1666 .Pp
1667 The
1668 .Cm got update ,
1669 .Cm got rebase ,
1670 and
1671 .Cm got histedit
1672 commands will refuse to run while staged changes exist.
1673 If staged changes cannot be committed because a staged path
1674 is out of date, the path must be unstaged with
1675 .Cm got unstage
1676 before it can be updated with
1677 .Cm got update ,
1678 and may then be staged again if necessary.
1679 .It Cm sg
1680 Short alias for
1681 .Cm stage .
1682 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1683 Merge staged changes back into the work tree and put affected paths
1684 back into non-staged status.
1685 If no
1686 .Ar path
1687 is specified, unstage all staged changes across the entire work tree.
1688 Otherwise, unstage changes at or within the specified paths.
1689 .Pp
1690 Show the status of each affected file, using the following status codes:
1691 .Bl -column YXZ description
1692 .It G Ta file was unstaged
1693 .It C Ta file was unstaged and conflicts occurred during merge
1694 .It ! Ta changes destined for a missing file were not merged
1695 .It D Ta file was staged as deleted and still is deleted
1696 .It d Ta file's deletion was obstructed by local modifications
1697 .It \(a~ Ta changes destined for a non-regular file were not merged
1698 .El
1699 .Pp
1700 The options for
1701 .Cm got unstage
1702 are as follows:
1703 .Bl -tag -width Ds
1704 .It Fl p
1705 Instead of unstaging the entire content of a changed file, interactively
1706 select or reject changes for unstaging based on
1707 .Dq y
1708 (unstage change),
1709 .Dq n
1710 (keep change staged), and
1711 .Dq q
1712 (quit unstaging this file) responses.
1713 If a file is staged in modified status, individual patches derived from the
1714 staged file content can be unstaged.
1715 Files staged in added or deleted status may only be unstaged in their entirety.
1716 .It Fl F Ar response-script
1717 With the
1718 .Fl p
1719 option, read
1720 .Dq y ,
1721 .Dq n ,
1722 and
1723 .Dq q
1724 responses line-by-line from the specified
1725 .Ar response-script
1726 file instead of prompting interactively.
1727 .El
1728 .It Cm ug
1729 Short alias for
1730 .Cm unstage .
1731 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1732 Parse and print contents of objects to standard output in a line-based
1733 text format.
1734 Content of commit, tree, and tag objects is printed in a way similar
1735 to the actual content stored in such objects.
1736 Blob object contents are printed as they would appear in files on disk.
1737 .Pp
1738 Attempt to interpret each argument as a reference, a tag name, or
1739 an object ID SHA1 hash.
1740 References will be resolved to an object ID.
1741 Tag names will resolved to a tag object.
1742 An abbreviated hash argument will be expanded to a full SHA1 hash
1743 automatically, provided the abbreviation is unique.
1744 .Pp
1745 If none of the above interpretations produce a valid result, or if the
1746 .Fl P
1747 option is used, attempt to interpret the argument as a path which will
1748 be resolved to the ID of an object found at this path in the repository.
1749 .Pp
1750 The options for
1751 .Cm got cat
1752 are as follows:
1753 .Bl -tag -width Ds
1754 .It Fl c Ar commit
1755 Look up paths in the specified
1756 .Ar commit .
1757 If this option is not used, paths are looked up in the commit resolved
1758 via the repository's HEAD reference.
1759 The expected argument is a commit ID SHA1 hash or an existing reference
1760 or tag name which will be resolved to a commit ID.
1761 An abbreviated hash argument will be expanded to a full SHA1 hash
1762 automatically, provided the abbreviation is unique.
1763 .It Fl r Ar repository-path
1764 Use the repository at the specified path.
1765 If not specified, assume the repository is located at or above the current
1766 working directory.
1767 If this directory is a
1768 .Nm
1769 work tree, use the repository path associated with this work tree.
1770 .It Fl P
1771 Interpret all arguments as paths only.
1772 This option can be used to resolve ambiguity in cases where paths
1773 look like tag names, reference names, or object IDs.
1774 .El
1775 .El
1776 .Sh ENVIRONMENT
1777 .Bl -tag -width GOT_AUTHOR
1778 .It Ev GOT_AUTHOR
1779 The author's name and email address for
1780 .Cm got commit
1781 and
1782 .Cm got import ,
1783 for example:
1784 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1785 Because
1786 .Xr git 1
1787 may fail to parse commits without an email address in author data,
1788 .Nm
1789 attempts to reject
1790 .Ev GOT_AUTHOR
1791 environment variables with a missing email address.
1792 .Pp
1793 If present, Git's
1794 .Dv user.name
1795 and
1796 .Dv user.email
1797 configuration settings in the repository's
1798 .Pa .git/config
1799 file will override the value of
1800 .Ev GOT_AUTHOR .
1801 However, the
1802 .Dv user.name
1803 and
1804 .Dv user.email
1805 configuration settings contained in Git's global
1806 .Pa ~/.gitconfig
1807 configuration file will be used only if the
1808 .Ev GOT_AUTHOR
1809 environment variable is
1810 .Em not
1811 set.
1812 .It Ev VISUAL , EDITOR
1813 The editor spawned by
1814 .Cm got commit ,
1815 .Cm got import ,
1817 .Cm got tag .
1818 .It Ev GOT_LOG_DEFAULT_LIMIT
1819 The default limit on the number of commits traversed by
1820 .Cm got log .
1821 If set to zero, the limit is unbounded.
1822 This variable will be silently ignored if it is set to a non-numeric value.
1823 .El
1824 .Sh EXIT STATUS
1825 .Ex -std got
1826 .Sh EXAMPLES
1827 Clone an existing Git repository for use with
1828 .Nm .
1829 .Pp
1830 .Dl $ cd /var/git/
1831 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1832 .Pp
1833 Use of HTTP URLs currently requires
1834 .Xr git 1 :
1835 .Pp
1836 .Dl $ cd /var/git/
1837 .Dl $ git clone --bare https://github.com/openbsd/src.git
1838 .Pp
1839 Alternatively, for quick and dirty local testing of
1840 .Nm
1841 a new Git repository could be created and populated with files,
1842 e.g. from a temporary CVS checkout located at
1843 .Pa /tmp/src :
1844 .Pp
1845 .Dl $ got init /var/git/src.git
1846 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1847 .Pp
1848 Check out a work tree from the Git repository to /usr/src:
1849 .Pp
1850 .Dl $ got checkout /var/git/src.git /usr/src
1851 .Pp
1852 View local changes in a work tree directory:
1853 .Pp
1854 .Dl $ got status
1855 .Dl $ got diff | less
1856 .Pp
1857 Interactively revert selected local changes in a work tree directory:
1858 .Pp
1859 .Dl $ got revert -p -R\ .
1860 .Pp
1861 In a work tree or a git repository directory, list all branch references:
1862 .Pp
1863 .Dl $ got branch -l
1864 .Pp
1865 In a work tree or a git repository directory, create a new branch called
1866 .Dq unified-buffer-cache
1867 which is forked off the
1868 .Dq master
1869 branch:
1870 .Pp
1871 .Dl $ got branch unified-buffer-cache master
1872 .Pp
1873 Switch an existing work tree to the branch
1874 .Dq unified-buffer-cache .
1875 Local changes in the work tree will be preserved and merged if necessary:
1876 .Pp
1877 .Dl $ got update -b unified-buffer-cache
1878 .Pp
1879 Create a new commit from local changes in a work tree directory.
1880 This new commit will become the head commit of the work tree's current branch:
1881 .Pp
1882 .Dl $ got commit
1883 .Pp
1884 In a work tree or a git repository directory, view changes committed in
1885 the 3 most recent commits to the work tree's branch, or the branch resolved
1886 via the repository's HEAD reference, respectively:
1887 .Pp
1888 .Dl $ got log -p -l 3
1889 .Pp
1890 In a work tree or a git repository directory, log the history of a subdirectory:
1891 .Pp
1892 .Dl $ got log sys/uvm
1893 .Pp
1894 While operating inside a work tree, paths are specified relative to the current
1895 working directory, so this command will log the subdirectory
1896 .Pa sys/uvm :
1897 .Pp
1898 .Dl $ cd sys/uvm && got log '.'
1899 .Pp
1900 And this command has the same effect:
1901 .Pp
1902 .Dl $ cd sys/dev/usb && got log ../../uvm
1903 .Pp
1904 Add new files and remove obsolete files in a work tree directory:
1905 .Pp
1906 .Dl $ got add sys/uvm/uvm_ubc.c
1907 .Dl $ got remove sys/uvm/uvm_vnode.c
1908 .Pp
1909 Create a new commit from local changes in a work tree directory
1910 with a pre-defined log message.
1911 .Pp
1912 .Dl $ got commit -m 'unify the buffer cache'
1913 .Pp
1914 Update any work tree checked out from the
1915 .Dq unified-buffer-cache
1916 branch to the latest commit on this branch:
1917 .Pp
1918 .Dl $ got update
1919 .Pp
1920 Roll file content on the unified-buffer-cache branch back by one commit,
1921 and then fetch the rolled-back change into the work tree as a local change
1922 to be amended and perhaps committed again:
1923 .Pp
1924 .Dl $ got backout unified-buffer-cache
1925 .Dl $ got commit -m 'roll back previous'
1926 .Dl $ # now back out the previous backout :-)
1927 .Dl $ got backout unified-buffer-cache
1928 .Pp
1929 Fetch new upstream commits into the local repository's
1930 .Dq origin/master
1931 branch:
1932 .Pp
1933 .Dl $ cd /usr/src
1934 .Dl $ got fetch
1935 .Pp
1936 In a repository created with a HTTP URL and
1937 .Cm git clone --bare
1938 the
1939 .Xr git-fetch 1
1940 command must be used instead:
1941 .Pp
1942 .Dl $ cd /var/git/src.git
1943 .Dl $ git fetch origin master:refs/remotes/origin/master
1944 .Pp
1945 Rebase the local
1946 .Dq master
1947 branch to merge the new changes that are now visible on the
1948 .Dq origin/master
1949 branch:
1950 .Pp
1951 .Dl $ cd /usr/src
1952 .Dl $ got update -b origin/master
1953 .Dl $ got rebase master
1954 .Pp
1955 Rebase the
1956 .Dq unified-buffer-cache
1957 branch on top of the new head commit of the
1958 .Dq master
1959 branch.
1960 .Pp
1961 .Dl $ got update -b master
1962 .Dl $ got rebase unified-buffer-cache
1963 .Pp
1964 Create a patch from all changes on the unified-buffer-cache branch.
1965 The patch can be mailed out for review and applied to
1966 .Ox Ns 's
1967 CVS tree:
1968 .Pp
1969 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
1970 .Pp
1971 Edit the entire commit history of the
1972 .Dq unified-buffer-cache
1973 branch:
1974 .Pp
1975 .Dl $ got update -b unified-buffer-cache
1976 .Dl $ got update -c master
1977 .Dl $ got histedit
1978 .Pp
1979 In order to merge changes committed to the
1980 .Dq unified-buffer-cache
1981 branch back into the
1982 .Dq master
1983 branch, the
1984 .Dq unified-buffer-cache
1985 branch must first be rebased onto the
1986 .Dq master
1987 branch:
1988 .Pp
1989 .Dl $ got update -b master
1990 .Dl $ got rebase unified-buffer-cache
1991 .Pp
1992 Changes on the
1993 .Dq unified-buffer-cache
1994 branch can now be made visible on the
1995 .Dq master
1996 branch with
1997 .Cm got integrate .
1998 Because the rebase operation switched the work tree to the
1999 .Dq unified-buffer-cache
2000 branch, the work tree must be switched back to the
2001 .Dq master
2002 branch before the
2003 .Dq unified-buffer-cache
2004 branch can be integrated into
2005 .Dq master :
2006 .Pp
2007 .Dl $ got update -b master
2008 .Dl $ got integrate unified-buffer-cache
2009 .Pp
2010 Additional steps may be necessary if local changes need to be pushed back
2011 to the remote repository, which currently requires
2012 .Cm git push .
2013 Before working against existing branches in a repository cloned with
2014 .Cm git clone --bare
2015 instead of
2016 .Cm got clone ,
2017 a Git
2018 .Dq refspec
2019 must be configured to map all references in the remote repository
2020 into the
2021 .Dq refs/remotes
2022 namespace of the local repository.
2023 This can achieved by setting Git's
2024 .Pa remote.origin.fetch
2025 configuration variable to the value
2026 .Dq +refs/heads/*:refs/remotes/origin/*
2027 with the
2028 .Cm git config
2029 command:
2030 .Pp
2031 .Dl $ cd /var/git/repo
2032 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
2033 .Pp
2034 Additionally, the
2035 .Dq mirror
2036 option must be disabled:
2037 .Pp
2038 .Dl $ cd /var/git/repo
2039 .Dl $ git config remote.origin.mirror false
2040 .Pp
2041 Alternatively, the following
2042 .Xr git-fetch 1
2043 configuration item can be added manually to the Git repository's
2044 .Pa config
2045 file:
2046 .Pp
2047 .Dl [remote "origin"]
2048 .Dl url = ...
2049 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
2050 .Dl mirror = false
2051 .Pp
2052 This configuration leaves the local repository's
2053 .Dq refs/heads
2054 namespace free for use by local branches checked out with
2055 .Cm got checkout
2056 and, if needed, created with
2057 .Cm got branch .
2058 .Pp
2059 Branches in the
2060 .Dq remotes/origin
2061 namespace can now be updated with incoming changes from the remote
2062 repository with
2063 .Cm got fetch
2065 .Xr git-fetch 1
2066 without extra command line arguments:
2067 .Pp
2068 .Dl $ cd /var/git/repo
2069 .Dl $ git fetch
2070 .Pp
2071 To make changes fetched from the remote repository appear on the
2072 .Dq master
2073 branch, the
2074 .Dq master
2075 branch must be rebased onto the
2076 .Dq origin/master
2077 branch.
2078 This will also merge local changes, if any, with the incoming changes:
2079 .Pp
2080 .Dl $ got update -b origin/master
2081 .Dl $ got rebase master
2082 .Pp
2083 On the
2084 .Dq master
2085 branch, log messages for local changes can now be amended with
2086 .Dq OK
2087 by other developers and any other important new information:
2088 .Pp
2089 .Dl $ got update -c origin/master
2090 .Dl $ got histedit -m
2091 .Pp
2092 Local changes on the
2093 .Dq master
2094 branch can then be pushed to the remote
2095 repository with
2096 .Cm git push :
2097 .Pp
2098 .Dl $ cd /var/git/repo
2099 .Dl $ git push origin master
2100 .Sh SEE ALSO
2101 .Xr tog 1 ,
2102 .Xr git-repository 5 ,
2103 .Xr got-worktree 5
2104 .Sh AUTHORS
2105 .An Stefan Sperling Aq Mt stsp@openbsd.org
2106 .An Martin Pieuchot Aq Mt mpi@openbsd.org
2107 .An Joshua Stein Aq Mt jcs@openbsd.org
2108 .An Ori Bernstein Aq Mt ori@openbsd.org
2109 .Sh CAVEATS
2110 .Nm
2111 is a work-in-progress and many commands remain to be implemented.
2112 At present, the user has to fall back on
2113 .Xr git 1
2114 to perform many tasks, in particular tasks related to repository
2115 administration and tasks which require a network connection.