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