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