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