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