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