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