2 .\" Copyright (c) 2017 Martin Pieuchot
3 .\" Copyright (c) 2018, 2019, 2020 Stefan Sperling
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.
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.
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 .
38 version control system because every copy of a repository is writeable.
39 Modifications made to files can be synchronized between repositories
44 must be checked out from the repository for modification.
45 Checked out files are stored in a
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
52 provides global and command-specific options.
53 Global options must precede the command name, and are as follows:
54 .Bl -tag -width tenletters
56 Display usage information and exit immediately.
58 Display program version and exit immediately.
64 .Bl -tag -width checkout
65 .It Cm init Ar repository-path
66 Create a new empty repository at the specified
73 command must be used to populate the empty repository before
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
83 The created commit will not have any parent commits, i.e. it will be a
85 Also create a new reference which provides a branch name for the newly
87 Show the path of each imported file to indicate progress.
93 environment variable to be set,
98 configuration settings can be obtained from the repository's
100 file or from Git's global
111 instead of creating the default branch
113 Use of this option is required if the
115 branch already exists.
117 Use the specified log message when creating the new commit.
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
128 Ignore files or directories with a name which matches the specified
130 This option may be specified multiple times to build a list of ignore patterns.
133 follows the globbing rules documented in
139 .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
140 Copy files from a repository into a new work tree.
141 Show the status of each affected file, using the following status codes:
142 .Bl -column YXZ description
143 .It A Ta new file was added
144 .It E Ta file already exists in work tree's meta-data
149 is not specified, either use the last component of
150 .Ar repository path ,
153 was specified use the last component of
161 Proceed with the checkout operation even if the directory at
164 Existing files will be left intact.
166 Check out files from a commit on the specified
168 If this option is not specified, a branch resolved via the repository's HEAD
169 reference will be used.
171 Check out files from the specified
173 on the selected branch.
174 The expected argument is a commit ID SHA1 hash or an existing reference
175 or tag name which will be resolved to a commit ID.
176 An abbreviated hash argument will be expanded to a full SHA1 hash
177 automatically, provided the abbreviation is unique.
178 If this option is not specified, the most recent commit on the selected
183 is not contained in the selected branch, a different branch which contains
184 this commit must be specified with the
187 If no such branch is known a new branch must be created for this
193 Checking out work trees with an unknown branch is intentionally not supported.
194 .It Fl p Ar path-prefix
195 Restrict the work tree to a subset of the repository's tree hierarchy.
196 Only files beneath the specified
203 .It Cm clone Ar repository-URL Op Ar target-directory
204 Clone a Git repository at the specified
207 .Ar target-directory .
210 is specified the directory name will be derived from the name of the
213 will refuse to run if the
219 specifies a protocol scheme, a server hostname, and a path to the repository
221 .Lk scheme://hostname/path/to/repository
223 The following protocol schemes are supported:
224 .Bl -tag -width git+ssh
226 The Git protocol as implemented by the
229 This protocol is discouraged since it supports neither authentication nor
232 The Git protocol wrapped in an authenticated and encrypted
235 With this protocol the hostname may contain an embedded username for
240 Short alias for git+ssh.
242 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
243 Update an existing work tree to a different commit.
244 Show the status of each affected file, using the following status codes:
245 .Bl -column YXZ description
246 .It U Ta file was updated and contained no local changes
247 .It G Ta file was updated and local changes were merged cleanly
248 .It C Ta file was updated and conflicts occurred during merge
249 .It D Ta file was deleted
250 .It A Ta new file was added
251 .It \(a~ Ta versioned file is obstructed by a non-regular file
252 .It ! Ta a missing versioned file was restored
257 is specified, update the entire work tree.
258 Otherwise, restrict the update operation to files at or within the
260 Each path is required to exist in the update operation's target commit.
261 Files in the work tree outside specified paths will remain unchanged and
262 will retain their previously recorded base commit.
265 commands may refuse to run while the work tree contains files from
266 multiple base commits.
267 The base commit of such a work tree can be made consistent by running
269 across the entire work tree.
272 is incompatible with the
277 cannot update paths with staged changes.
278 If changes have been staged with
280 these changes must first be committed with
290 Switch the work tree's branch reference to the specified
292 before updating the work tree.
293 This option requires that all paths in the work tree are updated.
295 Update the work tree to the specified
297 The expected argument is a commit ID SHA1 hash or an existing reference
298 or tag name which will be resolved to a commit ID.
299 An abbreviated hash argument will be expanded to a full SHA1 hash
300 automatically, provided the abbreviation is unique.
301 If this option is not specified, the most recent commit on the work tree's
307 .It Cm status Op Ar path ...
308 Show the current modification status of files in a work tree,
309 using the following status codes:
310 .Bl -column YXZ description
311 .It M Ta modified file
312 .It A Ta file scheduled for addition in next commit
313 .It D Ta file scheduled for deletion in next commit
314 .It C Ta modified or added file which contains merge conflicts
315 .It ! Ta versioned file was expected on disk but is missing
316 .It \(a~ Ta versioned file is obstructed by a non-regular file
317 .It ? Ta unversioned item not tracked by
319 .It m Ta modified file modes (executable bit only)
320 .It N Ta non-existent
322 specified on the command line
327 is specified, show modifications in the entire work tree.
328 Otherwise, show modifications at or within the specified paths.
330 If changes have been staged with
332 staged changes are shown in the second output column, using the following
334 .Bl -column YXZ description
335 .It M Ta file modification is staged
336 .It A Ta file addition is staged
337 .It D Ta file deletion is staged
340 Changes created on top of staged changes are indicated in the first column:
341 .Bl -column YXZ description
342 .It MM Ta file was modified after earlier changes have been staged
343 .It MA Ta file was modified after having been staged for addition
346 For compatibility with
357 files in each traversed directory and will not display unversioned files
358 which match these patterns.
363 supports consecutive asterisks,
365 which will match an arbitrary amount of directories.
369 only supports a single ignore pattern per line.
373 does not support negated ignore patterns prefixed with
375 and gives no special significance to the location of path component separators,
381 .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
382 Display history of a repository.
385 is specified, show only commits which modified this path.
386 If invoked in a work tree, the
388 is interpreted relative to the current working directory,
389 and the work tree's path prefix is implicitly prepended.
390 Otherwise, the path is interpreted relative to the repository root.
397 Display individual commits which were merged into the current branch
401 shows the linear history of the current branch only.
403 Start traversing history at the specified
405 The expected argument is a commit ID SHA1 hash or an existing reference
406 or tag name which will be resolved to a commit ID.
407 An abbreviated hash argument will be expanded to a full SHA1 hash
408 automatically, provided the abbreviation is unique.
409 If this option is not specified, default to the work tree's current branch
410 if invoked in a work tree, or to the repository's HEAD reference.
412 Set the number of context lines shown in diffs with
414 By default, 3 lines of context are shown.
416 Limit history traversal to a given number of commits.
417 If this option is not specified, a default limit value of zero is used,
418 which is treated as an unbounded limit.
420 .Ev GOT_LOG_DEFAULT_LIMIT
421 environment variable may be set to change this default value.
423 Display the patch of modifications made in each commit.
426 is specified, only show the patch of modifications at or within this path.
427 .It Fl s Ar search-pattern
428 If specified, show only commits with a log message matched by the extended
431 Regular expression syntax is documented in
433 .It Fl r Ar repository-path
434 Use the repository at the specified path.
435 If not specified, assume the repository is located at or above the current
437 If this directory is a
439 work tree, use the repository path associated with this work tree.
441 .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
442 When invoked within a work tree with less than two arguments, display
443 uncommitted changes in the work tree.
446 is specified, only show changes within this path.
448 If two arguments are provided, treat each argument as a reference, a tag
449 name, or an object ID SHA1 hash, and display differences between the
450 corresponding objects.
451 Both objects must be of the same type (blobs, trees, or commits).
452 An abbreviated hash argument will be expanded to a full SHA1 hash
453 automatically, provided the abbreviation is unique.
460 Set the number of context lines shown in the diff.
461 By default, 3 lines of context are shown.
462 .It Fl r Ar repository-path
463 Use the repository at the specified path.
464 If not specified, assume the repository is located at or above the current
466 If this directory is a
468 work tree, use the repository path associated with this work tree.
470 Show changes staged with
472 instead of showing local changes.
473 This option is only valid when
475 is invoked in a work tree.
477 Ignore whitespace-only changes.
482 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
483 Display line-by-line history of a file at the specified path.
490 Start traversing history at the specified
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 .It Fl r Ar repository-path
497 Use the repository at the specified path.
498 If not specified, assume the repository is located at or above the current
500 If this directory is a
502 work tree, use the repository path associated with this work tree.
507 .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
508 Display a listing of files and directories at the specified
509 directory path in the repository.
510 Entries shown in this listing may carry one of the following trailing
512 .Bl -column YXZ description
513 .It @ Ta entry is a symbolic link
514 .It / Ta entry is a directory
515 .It * Ta entry is an executable file
516 .It $ Ta entry is a Git submodule
521 is specified, list the repository path corresponding to the current
522 directory of the work tree, or the root directory of the repository
523 if there is no work tree.
530 List files and directories as they appear in the specified
532 The expected argument is a commit ID SHA1 hash or an existing reference
533 or tag name which will be resolved to a commit ID.
534 An abbreviated hash argument will be expanded to a full SHA1 hash
535 automatically, provided the abbreviation is unique.
536 .It Fl r Ar repository-path
537 Use the repository at the specified path.
538 If not specified, assume the repository is located at or above the current
540 If this directory is a
542 work tree, use the repository path associated with this work tree.
544 Show object IDs of files (blob objects) and directories (tree objects).
546 Recurse into sub-directories in the repository.
551 .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
552 Manage references in a repository.
554 If no options are passed, expect two arguments and attempt to create,
555 or update, the reference with the given
557 and make it point at the given
559 The name must be an absolute reference name, i.e. it must begin with
561 The target may be an object ID SHA1 hash or an existing reference which
562 will be resolved to an object ID.
563 An abbreviated hash argument will be expanded to a full SHA1 hash
564 automatically, provided the abbreviation is unique.
570 .It Fl r Ar repository-path
571 Use the repository at the specified path.
572 If not specified, assume the repository is located at or above the current
574 If this directory is a
576 work tree, use the repository path associated with this work tree.
578 List all existing references in the repository.
580 Delete the reference with the specified name from the repository.
582 Create a symbolic reference pointing at the specified
584 which must be an existing reference.
585 Care should be taken not to create loops between references when
588 .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
589 Create, list, or delete branches.
591 Branches are managed via references which live in the
596 command operates on references in this namespace only.
598 If invoked in a work tree without any arguments, print the name of the
599 work tree's current branch.
603 argument is passed, attempt to create a branch reference with the given name.
604 By default the new branch reference will point at the latest commit on the
605 work tree's current branch if invoked in a work tree, and otherwise to a commit
606 resolved via the repository's HEAD reference.
608 If invoked in a work tree, once the branch was created successfully
609 switch the work tree's head reference to the newly created branch and
610 update files across the entire work tree, just like
611 .Cm got update -b Ar name
613 Show the status of each affected file, using the following status codes:
614 .Bl -column YXZ description
615 .It U Ta file was updated and contained no local changes
616 .It G Ta file was updated and local changes were merged cleanly
617 .It C Ta file was updated and conflicts occurred during merge
618 .It D Ta file was deleted
619 .It A Ta new file was added
620 .It \(a~ Ta versioned file is obstructed by a non-regular file
621 .It ! Ta a missing versioned file was restored
629 Make a newly created branch reference point at the specified
633 argument is a commit ID SHA1 hash or an existing reference
634 or tag name which will be resolved to a commit ID.
635 .It Fl r Ar repository-path
636 Use the repository at the specified path.
637 If not specified, assume the repository is located at or above the current
639 If this directory is a
641 work tree, use the repository path associated with this work tree.
643 List all existing branches in the repository.
644 If invoked in a work tree, the work tree's current branch is shown
645 with one the following annotations:
646 .Bl -column YXZ description
647 .It * Ta work tree's base commit matches the branch tip
648 .It \(a~ Ta work tree's base commit is out-of-date
651 Delete the branch with the specified name from the repository.
652 Only the branch reference is deleted.
653 Any commit, tree, and blob objects belonging to the branch
654 remain in the repository and may be removed separately with
655 Git's garbage collector.
657 Do not switch and update the work tree after creating a new branch.
662 .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
663 Manage tags in a repository.
665 Tags are managed via references which live in the
670 command operates on references in this namespace only.
671 References in this namespace point at tag objects which contain a pointer
672 to another object, a tag message, as well as author and timestamp information.
674 Attempt to create a tag with the given
676 and make this tag point at the given
678 If no commit is specified, default to the latest commit on the work tree's
679 current branch if invoked in a work tree, and to a commit resolved via
680 the repository's HEAD reference otherwise.
687 Make the newly created tag reference point at the specified
691 argument is a commit ID SHA1 hash or an existing reference or tag name which
692 will be resolved to a commit ID.
693 An abbreviated hash argument will be expanded to a full SHA1 hash
694 automatically, provided the abbreviation is unique.
696 Use the specified tag message when creating the new tag.
701 opens a temporary file in an editor where a tag message can be written.
702 .It Fl r Ar repository-path
703 Use the repository at the specified path.
704 If not specified, assume the repository is located at or above the current
706 If this directory is a
708 work tree, use the repository path associated with this work tree.
710 List all existing tags in the repository instead of creating a new tag.
711 If this option is used, no other command-line arguments are allowed.
716 command will not delete tags or change existing tags.
717 If a tag must be deleted, the
719 command may be used to delete a tag's reference.
720 This should only be done if the tag has not already been copied to
722 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
723 Schedule unversioned files in a work tree for addition to the
724 repository in the next commit.
731 Permit recursion into directories.
732 If this option is not specified,
734 will refuse to run if a specified
738 With -R, add files even if they match a
742 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Ar path ...
743 Remove versioned files from a work tree and schedule them for deletion
744 from the repository in the next commit.
751 Perform the operation even if a file contains uncommitted modifications.
753 Keep affected files on disk.
755 Permit recursion into directories.
756 If this option is not specified,
758 will refuse to run if a specified
765 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
766 Revert any uncommitted changes in files at the specified paths.
767 File contents will be overwritten with those contained in the
768 work tree's base commit.
769 There is no way to bring discarded changes back after
772 If a file was added with
774 it will become an unversioned file again.
775 If a file was deleted with
784 Instead of reverting all changes in files, interactively select or reject
785 changes to revert based on
791 (quit reverting this file) responses.
792 If a file is in modified status, individual patches derived from the
793 modified file content can be reverted.
794 Files in added or deleted status may only be reverted in their entirety.
795 .It Fl F Ar response-script
803 responses line-by-line from the specified
805 file instead of prompting interactively.
807 Permit recursion into directories.
808 If this option is not specified,
810 will refuse to run if a specified
817 .It Cm commit Oo Fl m Ar message Oc Op Ar path ...
818 Create a new commit in the repository from changes in a work tree
819 and use this commit as the new base commit for the work tree.
822 is specified, commit all changes in the work tree.
823 Otherwise, commit changes at or within the specified paths.
825 If changes have been explicitly staged for commit with
827 only commit staged changes and reject any specified paths which
828 have not been staged.
830 Show the status of each affected file, using the following status codes:
831 .Bl -column YXZ description
832 .It M Ta modified file
833 .It D Ta file was deleted
834 .It A Ta new file was added
835 .It m Ta modified file modes (executable bit only)
838 Files which are not part of the new commit will retain their previously
839 recorded base commit.
842 commands may refuse to run while the work tree contains files from
843 multiple base commits.
844 The base commit of such a work tree can be made consistent by running
846 across the entire work tree.
852 environment variable to be set,
857 configuration settings can be
858 obtained from the repository's
860 file or from Git's global
869 Use the specified log message when creating the new commit.
874 opens a temporary file in an editor where a log message can be written.
878 will refuse to run if certain preconditions are not met.
879 If the work tree's current branch is not in the
881 reference namespace, new commits may not be created on this branch.
882 Local changes may only be committed if they are based on file content
883 found in the most recent commit on the work tree's branch.
884 If a path is found to be out of date,
886 must be used first in order to merge local changes with changes made
891 .It Cm cherrypick Ar commit
892 Merge changes from a single
897 must be on a different branch than the work tree's base commit.
898 The expected argument is a reference or a commit ID SHA1 hash.
899 An abbreviated hash argument will be expanded to a full SHA1 hash
900 automatically, provided the abbreviation is unique.
902 Show the status of each affected file, using the following status codes:
903 .Bl -column YXZ description
904 .It G Ta file was merged
905 .It C Ta file was merged and conflicts occurred during merge
906 .It ! Ta changes destined for a missing file were not merged
907 .It D Ta file was deleted
908 .It d Ta file's deletion was obstructed by local modifications
909 .It A Ta new file was added
910 .It \(a~ Ta changes destined for a non-regular file were not merged
913 The merged changes will appear as local changes in the work tree, which
916 amended manually or with further
921 or discarded again with
925 will refuse to run if certain preconditions are not met.
926 If the work tree contains multiple base commits it must first be updated
927 to a single base commit with
929 If the work tree already contains files with merge conflicts, these
930 conflicts must be resolved first.
934 .It Cm backout Ar commit
935 Reverse-merge changes from a single
940 must be on the same branch as the work tree's base commit.
941 The expected argument is a reference or a commit ID SHA1 hash.
942 An abbreviated hash argument will be expanded to a full SHA1 hash
943 automatically, provided the abbreviation is unique.
945 Show the status of each affected file, using the following status codes:
946 .Bl -column YXZ description
947 .It G Ta file was merged
948 .It C Ta file was merged and conflicts occurred during merge
949 .It ! Ta changes destined for a missing file were not merged
950 .It D Ta file was deleted
951 .It d Ta file's deletion was obstructed by local modifications
952 .It A Ta new file was added
953 .It \(a~ Ta changes destined for a non-regular file were not merged
956 The reverse-merged changes will appear as local changes in the work tree,
957 which may be viewed with
959 amended manually or with further
964 or discarded again with
968 will refuse to run if certain preconditions are not met.
969 If the work tree contains multiple base commits it must first be updated
970 to a single base commit with
972 If the work tree already contains files with merge conflicts, these
973 conflicts must be resolved first.
977 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
978 Rebase commits on the specified
980 onto the tip of the current branch of the work tree.
983 must share common ancestry with the work tree's current branch.
984 Rebasing begins with the first descendant commit of the youngest
985 common ancestor commit shared by the specified
987 and the work tree's current branch, and stops once the tip commit
994 is used as intended, the specified
996 represents a local commit history and may already contain changes
997 that are not yet visible in any other repositories.
998 The work tree's current branch, which must be set with
1002 operation, represents a branch from a remote repository which shares
1003 a common history with the specified
1005 but has progressed, and perhaps diverged, due to commits added to the
1008 Rebased commits are accumulated on a temporary branch which the work tree
1009 will remain switched to throughout the entire rebase operation.
1010 Commits on this branch represent the same changes with the same log
1011 messages as their counterparts on the original
1013 but with different commit IDs.
1014 Once rebasing has completed successfully, the temporary branch becomes
1015 the new version of the specified
1017 and the work tree is automatically switched to it.
1019 While rebasing commits, show the status of each affected file,
1020 using the following status codes:
1021 .Bl -column YXZ description
1022 .It G Ta file was merged
1023 .It C Ta file was merged and conflicts occurred during merge
1024 .It ! Ta changes destined for a missing file were not merged
1025 .It D Ta file was deleted
1026 .It d Ta file's deletion was obstructed by local modifications
1027 .It A Ta new file was added
1028 .It \(a~ Ta changes destined for a non-regular file were not merged
1031 If merge conflicts occur the rebase operation is interrupted and may
1032 be continued once conflicts have been resolved.
1033 Alternatively, the rebase operation may be aborted which will leave
1035 unmodified and the work tree switched back to its original branch.
1037 If a merge conflict is resolved in a way which renders the merged
1038 change into a no-op change, the corresponding commit will be elided
1039 when the rebase operation continues.
1042 will refuse to run if certain preconditions are not met.
1043 If the work tree is not yet fully updated to the tip commit of its
1044 branch then the work tree must first be updated with
1046 If changes have been staged with
1048 these changes must first be committed with
1052 If the work tree contains local changes, these changes must first be
1059 contains changes to files outside of the work tree's path prefix,
1060 the work tree cannot be used to rebase this branch.
1066 commands will refuse to run while a rebase operation is in progress.
1067 Other commands which manipulate the work tree may be used for
1068 conflict resolution purposes.
1075 Abort an interrupted rebase operation.
1076 If this option is used, no other command-line arguments are allowed.
1078 Continue an interrupted rebase operation.
1079 If this option is used, no other command-line arguments are allowed.
1084 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc
1085 Edit commit history between the work tree's current base commit and
1086 the tip commit of the work tree's current branch.
1090 operation the work tree's current branch must be set with
1092 to the branch which should be edited, unless this branch is already the
1093 current branch of the work tree.
1094 The tip of this branch represents the upper bound (inclusive) of commits
1099 Furthermore, the work tree's base commit
1102 to a point in this branch's commit history where editing should begin.
1103 This commit represents the lower bound (non-inclusive) of commits touched
1108 Editing of commit history is controlled via a
1110 which can be written in an editor based on a template, passed on the
1111 command line, or generated with the
1113 option if only log messages need to be edited.
1115 The format of the histedit script is line-based.
1116 Each line in the script begins with a command name, followed by
1117 whitespace and an argument.
1118 For most commands, the expected argument is a commit ID SHA1 hash.
1119 Any remaining text on the line is ignored.
1120 Lines which begin with the
1122 character are ignored entirely.
1124 The available commands are as follows:
1125 .Bl -column YXZ pick-commit
1126 .It pick Ar commit Ta Use the specified commit as it is.
1127 .It edit Ar commit Ta Use the specified commit but once changes have been
1128 merged into the work tree interrupt the histedit operation for amending.
1129 .It fold Ar commit Ta Combine the specified commit with the next commit
1130 listed further below that will be used.
1131 .It drop Ar commit Ta Remove this commit from the edited history.
1132 .It mesg Ar log-message Ta Use the specified single-line log message for
1133 the commit on the previous line.
1134 If the log message argument is left empty, open an editor where a new
1135 log message can be written.
1138 Every commit in the history being edited must be mentioned in the script.
1139 Lines may be re-ordered to change the order of commits in the edited history.
1140 No commit may be listed more than once.
1142 Edited commits are accumulated on a temporary branch which the work tree
1143 will remain switched to throughout the entire histedit operation.
1144 Once history editing has completed successfully, the temporary branch becomes
1145 the new version of the work tree's branch and the work tree is automatically
1148 While merging commits, show the status of each affected file,
1149 using the following status codes:
1150 .Bl -column YXZ description
1151 .It G Ta file was merged
1152 .It C Ta file was merged and conflicts occurred during merge
1153 .It ! Ta changes destined for a missing file were not merged
1154 .It D Ta file was deleted
1155 .It d Ta file's deletion was obstructed by local modifications
1156 .It A Ta new file was added
1157 .It \(a~ Ta changes destined for a non-regular file were not merged
1160 If merge conflicts occur the histedit operation is interrupted and may
1161 be continued once conflicts have been resolved.
1162 Alternatively, the histedit operation may be aborted which will leave
1163 the work tree switched back to its original branch.
1165 If a merge conflict is resolved in a way which renders the merged
1166 change into a no-op change, the corresponding commit will be elided
1167 when the histedit operation continues.
1170 will refuse to run if certain preconditions are not met.
1171 If the work tree's current branch is not in the
1173 reference namespace, the history of the branch may not be edited.
1174 If the work tree contains multiple base commits it must first be updated
1175 to a single base commit with
1177 If changes have been staged with
1179 these changes must first be committed with
1183 If the work tree contains local changes, these changes must first be
1188 If the edited history contains changes to files outside of the work tree's
1189 path prefix, the work tree cannot be used to edit the history of this branch.
1196 commands will refuse to run while a histedit operation is in progress.
1197 Other commands which manipulate the work tree may be used, and the
1199 command may be used to commit arbitrary changes to the temporary branch
1200 while the histedit operation is interrupted.
1207 Abort an interrupted histedit operation.
1208 If this option is used, no other command-line arguments are allowed.
1210 Continue an interrupted histedit operation.
1211 If this option is used, no other command-line arguments are allowed.
1212 .It Fl F Ar histedit-script
1215 instead of opening a temporary file in an editor where a histedit script
1218 Edit log messages only.
1219 This option is a quick equivalent to a histedit script which edits
1220 only log messages but otherwise leaves every picked commit as-is.
1223 option can only be used when starting a new histedit operation.
1224 If this option is used, no other command-line arguments are allowed.
1229 .It Cm integrate Ar branch
1230 Integrate the specified
1232 into the work tree's current branch.
1233 Files in the work tree are updated to match the contents on the integrated
1235 and the reference of the work tree's branch is changed to point at the
1236 head commit of the integrated
1239 Both branches can be considered equivalent after integration since they
1240 will be pointing at the same commit.
1241 Both branches remain available for future work, if desired.
1242 In case the integrated
1244 is no longer needed it may be deleted with
1247 Show the status of each affected file, using the following status codes:
1248 .Bl -column YXZ description
1249 .It U Ta file was updated
1250 .It D Ta file was deleted
1251 .It A Ta new file was added
1252 .It \(a~ Ta versioned file is obstructed by a non-regular file
1253 .It ! Ta a missing versioned file was restored
1257 will refuse to run if certain preconditions are not met.
1258 Most importantly, the
1260 must have been rebased onto the work tree's current branch with
1262 before it can be integrated, in order to linearize commit history and
1263 resolve merge conflicts.
1264 If the work tree contains multiple base commits it must first be updated
1265 to a single base commit with
1267 If changes have been staged with
1269 these changes must first be committed with
1273 If the work tree contains local changes, these changes must first be
1281 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1282 Stage local changes for inclusion in the next commit.
1285 is specified, stage all changes in the work tree.
1286 Otherwise, stage changes at or within the specified paths.
1287 Paths may be staged if they are added, modified, or deleted according to
1290 Show the status of each affected file, using the following status codes:
1291 .Bl -column YXZ description
1292 .It A Ta file addition has been staged
1293 .It M Ta file modification has been staged
1294 .It D Ta file deletion has been staged
1297 Staged file contents are saved in newly created blob objects in the repository.
1298 These blobs will be referred to by tree objects once staged changes have been
1301 Staged changes affect the behaviour of
1306 While paths with staged changes exist, the
1308 command will refuse to commit any paths which do not have staged changes.
1309 Local changes created on top of staged changes can only be committed if
1310 the path is staged again, or if the staged changes are committed first.
1313 command will show both local changes and staged changes.
1316 command is able to display local changes relative to staged changes,
1317 and to display staged changes relative to the repository.
1320 command cannot revert staged changes but may be used to revert
1321 local changes created on top of staged changes.
1328 Instead of staging new changes, list paths which are already staged,
1329 along with the IDs of staged blob objects and stage status codes.
1330 If paths were provided in the command line show the staged paths
1331 among the specified paths.
1332 Otherwise, show all staged paths.
1334 Instead of staging the entire content of a changed file, interactively
1335 select or reject changes for staging based on
1339 (reject change), and
1341 (quit staging this file) responses.
1342 If a file is in modified status, individual patches derived from the
1343 modified file content can be staged.
1344 Files in added or deleted status may only be staged or rejected in
1346 .It Fl F Ar response-script
1354 responses line-by-line from the specified
1356 file instead of prompting interactively.
1360 will refuse to run if certain preconditions are not met.
1361 If a file contains merge conflicts, these conflicts must be resolved first.
1362 If a file is found to be out of date relative to the head commit on the
1363 work tree's current branch, the file must be updated with
1365 before it can be staged (however, this does not prevent the file from
1366 becoming out-of-date at some point after having been staged).
1373 commands will refuse to run while staged changes exist.
1374 If staged changes cannot be committed because a staged path
1375 is out of date, the path must be unstaged with
1377 before it can be updated with
1379 and may then be staged again if necessary.
1383 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1384 Merge staged changes back into the work tree and put affected paths
1385 back into non-staged status.
1388 is specified, unstage all staged changes across the entire work tree.
1389 Otherwise, unstage changes at or within the specified paths.
1391 Show the status of each affected file, using the following status codes:
1392 .Bl -column YXZ description
1393 .It G Ta file was unstaged
1394 .It C Ta file was unstaged and conflicts occurred during merge
1395 .It ! Ta changes destined for a missing file were not merged
1396 .It D Ta file was staged as deleted and still is deleted
1397 .It d Ta file's deletion was obstructed by local modifications
1398 .It \(a~ Ta changes destined for a non-regular file were not merged
1406 Instead of unstaging the entire content of a changed file, interactively
1407 select or reject changes for unstaging based on
1411 (keep change staged), and
1413 (quit unstaging this file) responses.
1414 If a file is staged in modified status, individual patches derived from the
1415 staged file content can be unstaged.
1416 Files staged in added or deleted status may only be unstaged in their entirety.
1417 .It Fl F Ar response-script
1425 responses line-by-line from the specified
1427 file instead of prompting interactively.
1432 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1433 Parse and print contents of objects to standard output in a line-based
1435 Content of commit, tree, and tag objects is printed in a way similar
1436 to the actual content stored in such objects.
1437 Blob object contents are printed as they would appear in files on disk.
1439 Attempt to interpret each argument as a reference, a tag name, or
1440 an object ID SHA1 hash.
1441 References will be resolved to an object ID.
1442 Tag names will resolved to a tag object.
1443 An abbreviated hash argument will be expanded to a full SHA1 hash
1444 automatically, provided the abbreviation is unique.
1446 If none of the above interpretations produce a valid result, or if the
1448 option is used, attempt to interpret the argument as a path which will
1449 be resolved to the ID of an object found at this path in the repository.
1456 Look up paths in the specified
1458 If this option is not used, paths are looked up in the commit resolved
1459 via the repository's HEAD reference.
1460 The expected argument is a commit ID SHA1 hash or an existing reference
1461 or tag name which will be resolved to a commit ID.
1462 An abbreviated hash argument will be expanded to a full SHA1 hash
1463 automatically, provided the abbreviation is unique.
1464 .It Fl r Ar repository-path
1465 Use the repository at the specified path.
1466 If not specified, assume the repository is located at or above the current
1468 If this directory is a
1470 work tree, use the repository path associated with this work tree.
1472 Interpret all arguments as paths only.
1473 This option can be used to resolve ambiguity in cases where paths
1474 look like tag names, reference names, or object IDs.
1478 .Bl -tag -width GOT_AUTHOR
1480 The author's name and email address for
1485 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1488 may fail to parse commits without an email address in author data,
1492 environment variables with a missing email address.
1498 configuration settings in the repository's
1500 file will override the value of
1506 configuration settings contained in Git's global
1508 configuration file will be used only if the
1510 environment variable is
1513 .It Ev VISUAL , EDITOR
1514 The editor spawned by
1519 .It Ev GOT_LOG_DEFAULT_LIMIT
1520 The default limit on the number of commits traversed by
1522 If set to zero, the limit is unbounded.
1523 This variable will be silently ignored if it is set to a non-numeric value.
1528 Clone an existing Git repository for use with
1532 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1534 Use of HTTP URLs currently requires
1538 .Dl $ git clone --bare https://github.com/openbsd/src.git
1540 Alternatively, for quick and dirty local testing of
1542 a new Git repository could be created and populated with files,
1543 e.g. from a temporary CVS checkout located at
1546 .Dl $ got init /var/git/src.git
1547 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1549 Check out a work tree from the Git repository to /usr/src:
1551 .Dl $ got checkout /var/git/src.git /usr/src
1553 View local changes in a work tree directory:
1556 .Dl $ got diff | less
1558 Interactively revert selected local changes in a work tree directory:
1560 .Dl $ got revert -p -R\ .
1562 In a work tree or a git repository directory, list all branch references:
1566 In a work tree or a git repository directory, create a new branch called
1567 .Dq unified-buffer-cache
1568 which is forked off the
1572 .Dl $ got branch unified-buffer-cache master
1574 Switch an existing work tree to the branch
1575 .Dq unified-buffer-cache .
1576 Local changes in the work tree will be preserved and merged if necessary:
1578 .Dl $ got update -b unified-buffer-cache
1580 Create a new commit from local changes in a work tree directory.
1581 This new commit will become the head commit of the work tree's current branch:
1585 In a work tree or a git repository directory, view changes committed in
1586 the 3 most recent commits to the work tree's branch, or the branch resolved
1587 via the repository's HEAD reference, respectively:
1589 .Dl $ got log -p -l 3
1591 In a work tree or a git repository directory, log the history of a subdirectory:
1593 .Dl $ got log sys/uvm
1595 While operating inside a work tree, paths are specified relative to the current
1596 working directory, so this command will log the subdirectory
1599 .Dl $ cd sys/uvm && got log '.'
1601 And this command has the same effect:
1603 .Dl $ cd sys/dev/usb && got log ../../uvm
1605 Add new files and remove obsolete files in a work tree directory:
1607 .Dl $ got add sys/uvm/uvm_ubc.c
1608 .Dl $ got remove sys/uvm/uvm_vnode.c
1610 Create a new commit from local changes in a work tree directory
1611 with a pre-defined log message.
1613 .Dl $ got commit -m 'unify the buffer cache'
1615 Update any work tree checked out from the
1616 .Dq unified-buffer-cache
1617 branch to the latest commit on this branch:
1621 Roll file content on the unified-buffer-cache branch back by one commit,
1622 and then fetch the rolled-back change into the work tree as a local change
1623 to be amended and perhaps committed again:
1625 .Dl $ got backout unified-buffer-cache
1626 .Dl $ got commit -m 'roll back previous'
1627 .Dl $ # now back out the previous backout :-)
1628 .Dl $ got backout unified-buffer-cache
1630 Fetch new upstream commits into the local repository's master branch.
1631 This step currently requires
1634 .Dl $ cd /var/git/src.git
1635 .Dl $ git fetch origin master:master
1638 .Dq unified-buffer-cache
1639 branch on top of the new head commit of the
1643 .Dl $ got update -b master
1644 .Dl $ got rebase unified-buffer-cache
1646 Create a patch from all changes on the unified-buffer-cache branch.
1647 The patch can be mailed out for review and applied to
1651 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
1653 Edit the entire commit history of the
1654 .Dq unified-buffer-cache
1657 .Dl $ got update -b unified-buffer-cache
1658 .Dl $ got update -c master
1661 Additional steps are necessary if local changes need to be pushed back
1662 to the remote repository, which currently requires
1666 Before working against existing branches in a repository cloned with
1667 .Dq git clone --bare ,
1670 must be configured to map all references in the remote repository
1673 namespace of the local repository.
1674 This can achieved by setting Git's
1675 .Pa remote.origin.fetch
1676 configuration variable to the value
1677 .Dq +refs/heads/*:refs/remotes/origin/*
1682 .Dl $ cd /var/git/repo
1683 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
1685 Alternatively, the following
1687 configuration item can be added manually to the Git repository's
1691 .Dl [remote "origin"]
1693 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
1695 This configuration leaves the local repository's
1697 namespace free for use by local branches checked out with
1699 and, if needed, created with
1704 namespace can be updated with incoming changes from the remote
1708 .Dl $ cd /var/git/repo
1711 To make changes fetched from the remote repository appear on the
1715 branch must be rebased onto the
1718 This will also merge local changes, if any, with the incoming changes:
1720 .Dl $ got update -b origin/master
1721 .Dl $ got rebase master
1725 branch, log messages for local changes can now be amended with
1727 by other developers and any other important new information:
1729 .Dl $ got update -c origin/master
1730 .Dl $ got histedit -m
1732 Local changes on the
1734 branch can then be pushed to the remote
1738 .Dl $ cd /var/git/repo
1739 .Dl $ git push origin master
1741 In order to merge changes committed to the
1742 .Dq unified-buffer-cache
1743 branch back into the
1746 .Dq unified-buffer-cache
1747 branch must first be rebased onto the
1751 .Dl $ got update -b master
1752 .Dl $ got rebase unified-buffer-cache
1755 .Dq unified-buffer-cache
1756 branch can now be made visible on the
1760 Because the rebase operation switched the work tree to the
1761 .Dq unified-buffer-cache
1762 branch, the work tree must be switched back to the
1765 .Dq unified-buffer-cache
1766 branch can be integrated into
1769 .Dl $ got update -b master
1770 .Dl $ got integrate unified-buffer-cache
1773 .Xr git-repository 5 ,
1776 .An Stefan Sperling Aq Mt stsp@openbsd.org
1777 .An Martin Pieuchot Aq Mt mpi@openbsd.org
1778 .An Joshua Stein Aq Mt jcs@openbsd.org
1779 .An Ori Bernstein Aq Mt ori@openbsd.org
1782 is a work-in-progress and many commands remain to be implemented.
1783 At present, the user has to fall back on
1785 to perform many tasks, in particular tasks related to repository
1786 administration and tasks which require a network connection.