Blob


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