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