Blob


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