Blob


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