Blob


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