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 clone Oo Fl a Oc Oo Fl q Oc Oo Fl v Oc Ar repository-URL Op Ar target-directory
140 Clone a Git repository at the specified
143 .Ar target-directory .
146 is specified the directory name will be derived from the name of the
149 will refuse to run if the
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
158 .Lk scheme://hostname:port/path/to/repository
160 The following protocol schemes are supported:
161 .Bl -tag -width git+ssh
163 The Git protocol as implemented by the
166 This protocol is discouraged since it supports neither authentication nor
169 The Git protocol wrapped in an authenticated and encrypted
172 With this protocol the hostname may contain an embedded username for
177 Short alias for git+ssh.
181 creates a remote repository entry in the
183 file of the cloned repository to store the
195 Fetch all branches from the remote repository.
196 If this option is not specified, a branch resolved via the repository's HEAD
197 reference will be fetched.
199 Create the cloned repository as a mirror of the original repository.
200 This is useful if the cloned repository will not be used to store
201 local changes as created by
206 file will be set up with the
208 option enabled, such that
212 will write incoming changes directly to branches in the
214 reference namespace, rather than to branches in the
217 This avoids the usual requirement of having to run
221 in order to make incoming changes appear on branches in the
224 But maintaining custom branches with local changes in the cloned
225 repository becomes difficult since local changes are at risk of
226 being discarded whenever incoming changes are fetched.
228 Suppress progress reporting output.
229 The same option will be passed to
233 Increase the verbosity of progress reporting output.
234 The same option will be passed to
237 Multiple -v options increase the verbosity.
243 .It Cm fetch Oo Fl a Oc Oo Fl r Ar repository-path Oc Oo Fl q Oc Oo Fl v Oc Op Ar remote-repository-name
244 Fetch new changes from a remote repository.
246 .Ar remote-repository-name
247 is specified the name
250 The remote repository's URL is obtained from the corresponding entry in the
252 file of the repository, as created by
255 Branch references in the
257 reference namespace will be updated to point at the newly fetched commits,
260 command can then be used to make new changes visible on branches in the
262 reference namespace, merging incoming changes with local changes as necessary.
264 However, if the repository is configured as a mirror then all references will
265 be updated as needed to match the corresponding references in the remote
266 repository, including branches in the
269 If those branches contained local commits, these will no longer be reachable
270 via a reference and will therefore be at risk of being discarded by Git's
273 In any case, existing references in the
275 namespace will always be changed to match tags contained in the remote
283 Fetch all branches from the remote repository.
284 If this option is not specified, a branch resolved via the repository's HEAD
285 reference will be fetched.
286 .It Fl r Ar repository-path
287 Use the repository at the specified path.
288 If not specified, assume the repository is located at or above the current
290 If this directory is a
292 work tree, use the repository path associated with this work tree.
294 Suppress progress reporting output.
295 The same option will be passed to
299 Increase the verbosity of progress reporting output.
300 The same option will be passed to
303 Multiple -v options increase the verbosity.
309 .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
310 Copy files from a repository into a new work tree.
311 Show the status of each affected file, using the following status codes:
312 .Bl -column YXZ description
313 .It A Ta new file was added
314 .It E Ta file already exists in work tree's meta-data
319 is not specified, either use the last component of
320 .Ar repository path ,
323 was specified use the last component of
331 Proceed with the checkout operation even if the directory at
334 Existing files will be left intact.
336 Check out files from a commit on the specified
338 If this option is not specified, a branch resolved via the repository's HEAD
339 reference will be used.
341 Check out files from the specified
343 on the selected branch.
344 The expected argument is a commit ID SHA1 hash or an existing reference
345 or tag name which will be resolved to a commit ID.
346 An abbreviated hash argument will be expanded to a full SHA1 hash
347 automatically, provided the abbreviation is unique.
348 If this option is not specified, the most recent commit on the selected
353 is not contained in the selected branch, a different branch which contains
354 this commit must be specified with the
357 If no such branch is known a new branch must be created for this
363 Checking out work trees with an unknown branch is intentionally not supported.
364 .It Fl p Ar path-prefix
365 Restrict the work tree to a subset of the repository's tree hierarchy.
366 Only files beneath the specified
373 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
374 Update an existing work tree to a different commit.
375 Show the status of each affected file, using the following status codes:
376 .Bl -column YXZ description
377 .It U Ta file was updated and contained no local changes
378 .It G Ta file was updated and local changes were merged cleanly
379 .It C Ta file was updated and conflicts occurred during merge
380 .It D Ta file was deleted
381 .It A Ta new file was added
382 .It \(a~ Ta versioned file is obstructed by a non-regular file
383 .It ! Ta a missing versioned file was restored
388 is specified, update the entire work tree.
389 Otherwise, restrict the update operation to files at or within the
391 Each path is required to exist in the update operation's target commit.
392 Files in the work tree outside specified paths will remain unchanged and
393 will retain their previously recorded base commit.
396 commands may refuse to run while the work tree contains files from
397 multiple base commits.
398 The base commit of such a work tree can be made consistent by running
400 across the entire work tree.
403 is incompatible with the
408 cannot update paths with staged changes.
409 If changes have been staged with
411 these changes must first be committed with
421 Switch the work tree's branch reference to the specified
423 before updating the work tree.
424 This option requires that all paths in the work tree are updated.
426 Update the work tree to the specified
428 The expected argument is a commit ID SHA1 hash or an existing reference
429 or tag name which will be resolved to a commit ID.
430 An abbreviated hash argument will be expanded to a full SHA1 hash
431 automatically, provided the abbreviation is unique.
432 If this option is not specified, the most recent commit on the work tree's
438 .It Cm status Op Ar path ...
439 Show the current modification status of files in a work tree,
440 using the following status codes:
441 .Bl -column YXZ description
442 .It M Ta modified file
443 .It A Ta file scheduled for addition in next commit
444 .It D Ta file scheduled for deletion in next commit
445 .It C Ta modified or added file which contains merge conflicts
446 .It ! Ta versioned file was expected on disk but is missing
447 .It \(a~ Ta versioned file is obstructed by a non-regular file
448 .It ? Ta unversioned item not tracked by
450 .It m Ta modified file modes (executable bit only)
451 .It N Ta non-existent
453 specified on the command line
458 is specified, show modifications in the entire work tree.
459 Otherwise, show modifications at or within the specified paths.
461 If changes have been staged with
463 staged changes are shown in the second output column, using the following
465 .Bl -column YXZ description
466 .It M Ta file modification is staged
467 .It A Ta file addition is staged
468 .It D Ta file deletion is staged
471 Changes created on top of staged changes are indicated in the first column:
472 .Bl -column YXZ description
473 .It MM Ta file was modified after earlier changes have been staged
474 .It MA Ta file was modified after having been staged for addition
477 For compatibility with
488 files in each traversed directory and will not display unversioned files
489 which match these patterns.
494 supports consecutive asterisks,
496 which will match an arbitrary amount of directories.
500 only supports a single ignore pattern per line.
504 does not support negated ignore patterns prefixed with
506 and gives no special significance to the location of path component separators,
512 .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
513 Display history of a repository.
516 is specified, show only commits which modified this path.
517 If invoked in a work tree, the
519 is interpreted relative to the current working directory,
520 and the work tree's path prefix is implicitly prepended.
521 Otherwise, the path is interpreted relative to the repository root.
528 Display individual commits which were merged into the current branch
532 shows the linear history of the current branch only.
534 Start traversing history at the specified
536 The expected argument is a commit ID SHA1 hash or an existing reference
537 or tag name which will be resolved to a commit ID.
538 An abbreviated hash argument will be expanded to a full SHA1 hash
539 automatically, provided the abbreviation is unique.
540 If this option is not specified, default to the work tree's current branch
541 if invoked in a work tree, or to the repository's HEAD reference.
543 Set the number of context lines shown in diffs with
545 By default, 3 lines of context are shown.
547 Limit history traversal to a given number of commits.
548 If this option is not specified, a default limit value of zero is used,
549 which is treated as an unbounded limit.
551 .Ev GOT_LOG_DEFAULT_LIMIT
552 environment variable may be set to change this default value.
554 Display the patch of modifications made in each commit.
557 is specified, only show the patch of modifications at or within this path.
558 .It Fl s Ar search-pattern
559 If specified, show only commits with a log message matched by the extended
562 Regular expression syntax is documented in
564 .It Fl r Ar repository-path
565 Use the repository at the specified path.
566 If not specified, assume the repository is located at or above the current
568 If this directory is a
570 work tree, use the repository path associated with this work tree.
572 .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
573 When invoked within a work tree with less than two arguments, display
574 uncommitted changes in the work tree.
577 is specified, only show changes within this path.
579 If two arguments are provided, treat each argument as a reference, a tag
580 name, or an object ID SHA1 hash, and display differences between the
581 corresponding objects.
582 Both objects must be of the same type (blobs, trees, or commits).
583 An abbreviated hash argument will be expanded to a full SHA1 hash
584 automatically, provided the abbreviation is unique.
591 Set the number of context lines shown in the diff.
592 By default, 3 lines of context are shown.
593 .It Fl r Ar repository-path
594 Use the repository at the specified path.
595 If not specified, assume the repository is located at or above the current
597 If this directory is a
599 work tree, use the repository path associated with this work tree.
601 Show changes staged with
603 instead of showing local changes.
604 This option is only valid when
606 is invoked in a work tree.
608 Ignore whitespace-only changes.
613 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
614 Display line-by-line history of a file at the specified path.
621 Start traversing history at the specified
623 The expected argument is a commit ID SHA1 hash or an existing reference
624 or tag name which will be resolved to a commit ID.
625 An abbreviated hash argument will be expanded to a full SHA1 hash
626 automatically, provided the abbreviation is unique.
627 .It Fl r Ar repository-path
628 Use the repository at the specified path.
629 If not specified, assume the repository is located at or above the current
631 If this directory is a
633 work tree, use the repository path associated with this work tree.
638 .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
639 Display a listing of files and directories at the specified
640 directory path in the repository.
641 Entries shown in this listing may carry one of the following trailing
643 .Bl -column YXZ description
644 .It @ Ta entry is a symbolic link
645 .It / Ta entry is a directory
646 .It * Ta entry is an executable file
647 .It $ Ta entry is a Git submodule
652 is specified, list the repository path corresponding to the current
653 directory of the work tree, or the root directory of the repository
654 if there is no work tree.
661 List files and directories as they appear in the specified
663 The expected argument is a commit ID SHA1 hash or an existing reference
664 or tag name which will be resolved to a commit ID.
665 An abbreviated hash argument will be expanded to a full SHA1 hash
666 automatically, provided the abbreviation is unique.
667 .It Fl r Ar repository-path
668 Use the repository at the specified path.
669 If not specified, assume the repository is located at or above the current
671 If this directory is a
673 work tree, use the repository path associated with this work tree.
675 Show object IDs of files (blob objects) and directories (tree objects).
677 Recurse into sub-directories in the repository.
682 .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
683 Manage references in a repository.
685 If no options are passed, expect two arguments and attempt to create,
686 or update, the reference with the given
688 and make it point at the given
690 The name must be an absolute reference name, i.e. it must begin with
692 The target may be an object ID SHA1 hash or an existing reference which
693 will be resolved to an object ID.
694 An abbreviated hash argument will be expanded to a full SHA1 hash
695 automatically, provided the abbreviation is unique.
701 .It Fl r Ar repository-path
702 Use the repository at the specified path.
703 If not specified, assume the repository is located at or above the current
705 If this directory is a
707 work tree, use the repository path associated with this work tree.
709 List all existing references in the repository.
711 Delete the reference with the specified name from the repository.
713 Create a symbolic reference pointing at the specified
715 which must be an existing reference.
716 Care should be taken not to create loops between references when
719 .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
720 Create, list, or delete branches.
722 Branches are managed via references which live in the
727 command operates on references in this namespace only.
729 If invoked in a work tree without any arguments, print the name of the
730 work tree's current branch.
734 argument is passed, attempt to create a branch reference with the given name.
735 By default the new branch reference will point at the latest commit on the
736 work tree's current branch if invoked in a work tree, and otherwise to a commit
737 resolved via the repository's HEAD reference.
739 If invoked in a work tree, once the branch was created successfully
740 switch the work tree's head reference to the newly created branch and
741 update files across the entire work tree, just like
742 .Cm got update -b Ar name
744 Show the status of each affected file, using the following status codes:
745 .Bl -column YXZ description
746 .It U Ta file was updated and contained no local changes
747 .It G Ta file was updated and local changes were merged cleanly
748 .It C Ta file was updated and conflicts occurred during merge
749 .It D Ta file was deleted
750 .It A Ta new file was added
751 .It \(a~ Ta versioned file is obstructed by a non-regular file
752 .It ! Ta a missing versioned file was restored
760 Make a newly created branch reference point at the specified
764 argument is a commit ID SHA1 hash or an existing reference
765 or tag name which will be resolved to a commit ID.
766 .It Fl r Ar repository-path
767 Use the repository at the specified path.
768 If not specified, assume the repository is located at or above the current
770 If this directory is a
772 work tree, use the repository path associated with this work tree.
774 List all existing branches in the repository.
775 If invoked in a work tree, the work tree's current branch is shown
776 with one the following annotations:
777 .Bl -column YXZ description
778 .It * Ta work tree's base commit matches the branch tip
779 .It \(a~ Ta work tree's base commit is out-of-date
782 Delete the branch with the specified name from the repository.
783 Only the branch reference is deleted.
784 Any commit, tree, and blob objects belonging to the branch
785 remain in the repository and may be removed separately with
786 Git's garbage collector.
788 Do not switch and update the work tree after creating a new branch.
793 .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
794 Manage tags in a repository.
796 Tags are managed via references which live in the
801 command operates on references in this namespace only.
802 References in this namespace point at tag objects which contain a pointer
803 to another object, a tag message, as well as author and timestamp information.
805 Attempt to create a tag with the given
807 and make this tag point at the given
809 If no commit is specified, default to the latest commit on the work tree's
810 current branch if invoked in a work tree, and to a commit resolved via
811 the repository's HEAD reference otherwise.
818 Make the newly created tag reference point at the specified
822 argument is a commit ID SHA1 hash or an existing reference or tag name which
823 will be resolved to a commit ID.
824 An abbreviated hash argument will be expanded to a full SHA1 hash
825 automatically, provided the abbreviation is unique.
827 Use the specified tag message when creating the new tag.
832 opens a temporary file in an editor where a tag message can be written.
833 .It Fl r Ar repository-path
834 Use the repository at the specified path.
835 If not specified, assume the repository is located at or above the current
837 If this directory is a
839 work tree, use the repository path associated with this work tree.
841 List all existing tags in the repository instead of creating a new tag.
842 If this option is used, no other command-line arguments are allowed.
847 command will not delete tags or change existing tags.
848 If a tag must be deleted, the
850 command may be used to delete a tag's reference.
851 This should only be done if the tag has not already been copied to
853 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
854 Schedule unversioned files in a work tree for addition to the
855 repository in the next commit.
862 Permit recursion into directories.
863 If this option is not specified,
865 will refuse to run if a specified
869 With -R, add files even if they match a
873 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Ar path ...
874 Remove versioned files from a work tree and schedule them for deletion
875 from the repository in the next commit.
882 Perform the operation even if a file contains uncommitted modifications.
884 Keep affected files on disk.
886 Permit recursion into directories.
887 If this option is not specified,
889 will refuse to run if a specified
896 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
897 Revert any uncommitted changes in files at the specified paths.
898 File contents will be overwritten with those contained in the
899 work tree's base commit.
900 There is no way to bring discarded changes back after
903 If a file was added with
905 it will become an unversioned file again.
906 If a file was deleted with
915 Instead of reverting all changes in files, interactively select or reject
916 changes to revert based on
922 (quit reverting this file) responses.
923 If a file is in modified status, individual patches derived from the
924 modified file content can be reverted.
925 Files in added or deleted status may only be reverted in their entirety.
926 .It Fl F Ar response-script
934 responses line-by-line from the specified
936 file instead of prompting interactively.
938 Permit recursion into directories.
939 If this option is not specified,
941 will refuse to run if a specified
948 .It Cm commit Oo Fl m Ar message Oc Op Ar path ...
949 Create a new commit in the repository from changes in a work tree
950 and use this commit as the new base commit for the work tree.
953 is specified, commit all changes in the work tree.
954 Otherwise, commit changes at or within the specified paths.
956 If changes have been explicitly staged for commit with
958 only commit staged changes and reject any specified paths which
959 have not been staged.
961 Show the status of each affected file, using the following status codes:
962 .Bl -column YXZ description
963 .It M Ta modified file
964 .It D Ta file was deleted
965 .It A Ta new file was added
966 .It m Ta modified file modes (executable bit only)
969 Files which are not part of the new commit will retain their previously
970 recorded base commit.
973 commands may refuse to run while the work tree contains files from
974 multiple base commits.
975 The base commit of such a work tree can be made consistent by running
977 across the entire work tree.
983 environment variable to be set,
988 configuration settings can be
989 obtained from the repository's
991 file or from Git's global
1000 Use the specified log message when creating the new commit.
1005 opens a temporary file in an editor where a log message can be written.
1009 will refuse to run if certain preconditions are not met.
1010 If the work tree's current branch is not in the
1012 reference namespace, new commits may not be created on this branch.
1013 Local changes may only be committed if they are based on file content
1014 found in the most recent commit on the work tree's branch.
1015 If a path is found to be out of date,
1017 must be used first in order to merge local changes with changes made
1022 .It Cm cherrypick Ar commit
1023 Merge changes from a single
1028 must be on a different branch than the work tree's base commit.
1029 The expected argument is a reference or a commit ID SHA1 hash.
1030 An abbreviated hash argument will be expanded to a full SHA1 hash
1031 automatically, provided the abbreviation is unique.
1033 Show the status of each affected file, using the following status codes:
1034 .Bl -column YXZ description
1035 .It G Ta file was merged
1036 .It C Ta file was merged and conflicts occurred during merge
1037 .It ! Ta changes destined for a missing file were not merged
1038 .It D Ta file was deleted
1039 .It d Ta file's deletion was obstructed by local modifications
1040 .It A Ta new file was added
1041 .It \(a~ Ta changes destined for a non-regular file were not merged
1044 The merged changes will appear as local changes in the work tree, which
1047 amended manually or with further
1052 or discarded again with
1056 will refuse to run if certain preconditions are not met.
1057 If the work tree contains multiple base commits it must first be updated
1058 to a single base commit with
1060 If the work tree already contains files with merge conflicts, these
1061 conflicts must be resolved first.
1065 .It Cm backout Ar commit
1066 Reverse-merge changes from a single
1071 must be on the same branch as the work tree's base commit.
1072 The expected argument is a reference or a commit ID SHA1 hash.
1073 An abbreviated hash argument will be expanded to a full SHA1 hash
1074 automatically, provided the abbreviation is unique.
1076 Show the status of each affected file, using the following status codes:
1077 .Bl -column YXZ description
1078 .It G Ta file was merged
1079 .It C Ta file was merged and conflicts occurred during merge
1080 .It ! Ta changes destined for a missing file were not merged
1081 .It D Ta file was deleted
1082 .It d Ta file's deletion was obstructed by local modifications
1083 .It A Ta new file was added
1084 .It \(a~ Ta changes destined for a non-regular file were not merged
1087 The reverse-merged changes will appear as local changes in the work tree,
1088 which may be viewed with
1090 amended manually or with further
1095 or discarded again with
1099 will refuse to run if certain preconditions are not met.
1100 If the work tree contains multiple base commits it must first be updated
1101 to a single base commit with
1103 If the work tree already contains files with merge conflicts, these
1104 conflicts must be resolved first.
1108 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
1109 Rebase commits on the specified
1111 onto the tip of the current branch of the work tree.
1114 must share common ancestry with the work tree's current branch.
1115 Rebasing begins with the first descendant commit of the youngest
1116 common ancestor commit shared by the specified
1118 and the work tree's current branch, and stops once the tip commit
1125 is used as intended, the specified
1127 represents a local commit history and may already contain changes
1128 that are not yet visible in any other repositories.
1129 The work tree's current branch, which must be set with
1133 operation, represents a branch from a remote repository which shares
1134 a common history with the specified
1136 but has progressed, and perhaps diverged, due to commits added to the
1139 Rebased commits are accumulated on a temporary branch which the work tree
1140 will remain switched to throughout the entire rebase operation.
1141 Commits on this branch represent the same changes with the same log
1142 messages as their counterparts on the original
1144 but with different commit IDs.
1145 Once rebasing has completed successfully, the temporary branch becomes
1146 the new version of the specified
1148 and the work tree is automatically switched to it.
1150 While rebasing commits, show the status of each affected file,
1151 using the following status codes:
1152 .Bl -column YXZ description
1153 .It G Ta file was merged
1154 .It C Ta file was merged and conflicts occurred during merge
1155 .It ! Ta changes destined for a missing file were not merged
1156 .It D Ta file was deleted
1157 .It d Ta file's deletion was obstructed by local modifications
1158 .It A Ta new file was added
1159 .It \(a~ Ta changes destined for a non-regular file were not merged
1162 If merge conflicts occur the rebase operation is interrupted and may
1163 be continued once conflicts have been resolved.
1164 Alternatively, the rebase operation may be aborted which will leave
1166 unmodified and the work tree switched back to its original branch.
1168 If a merge conflict is resolved in a way which renders the merged
1169 change into a no-op change, the corresponding commit will be elided
1170 when the rebase operation continues.
1173 will refuse to run if certain preconditions are not met.
1174 If the work tree is not yet fully updated to the tip commit of its
1175 branch then the work tree must first be updated 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
1190 contains changes to files outside of the work tree's path prefix,
1191 the work tree cannot be used to rebase this branch.
1197 commands will refuse to run while a rebase operation is in progress.
1198 Other commands which manipulate the work tree may be used for
1199 conflict resolution purposes.
1206 Abort an interrupted rebase operation.
1207 If this option is used, no other command-line arguments are allowed.
1209 Continue an interrupted rebase operation.
1210 If this option is used, no other command-line arguments are allowed.
1215 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc
1216 Edit commit history between the work tree's current base commit and
1217 the tip commit of the work tree's current branch.
1221 operation the work tree's current branch must be set with
1223 to the branch which should be edited, unless this branch is already the
1224 current branch of the work tree.
1225 The tip of this branch represents the upper bound (inclusive) of commits
1230 Furthermore, the work tree's base commit
1233 to a point in this branch's commit history where editing should begin.
1234 This commit represents the lower bound (non-inclusive) of commits touched
1239 Editing of commit history is controlled via a
1241 which can be written in an editor based on a template, passed on the
1242 command line, or generated with the
1244 option if only log messages need to be edited.
1246 The format of the histedit script is line-based.
1247 Each line in the script begins with a command name, followed by
1248 whitespace and an argument.
1249 For most commands, the expected argument is a commit ID SHA1 hash.
1250 Any remaining text on the line is ignored.
1251 Lines which begin with the
1253 character are ignored entirely.
1255 The available commands are as follows:
1256 .Bl -column YXZ pick-commit
1257 .It pick Ar commit Ta Use the specified commit as it is.
1258 .It edit Ar commit Ta Use the specified commit but once changes have been
1259 merged into the work tree interrupt the histedit operation for amending.
1260 .It fold Ar commit Ta Combine the specified commit with the next commit
1261 listed further below that will be used.
1262 .It drop Ar commit Ta Remove this commit from the edited history.
1263 .It mesg Ar log-message Ta Use the specified single-line log message for
1264 the commit on the previous line.
1265 If the log message argument is left empty, open an editor where a new
1266 log message can be written.
1269 Every commit in the history being edited must be mentioned in the script.
1270 Lines may be re-ordered to change the order of commits in the edited history.
1271 No commit may be listed more than once.
1273 Edited commits are accumulated on a temporary branch which the work tree
1274 will remain switched to throughout the entire histedit operation.
1275 Once history editing has completed successfully, the temporary branch becomes
1276 the new version of the work tree's branch and the work tree is automatically
1279 While merging commits, show the status of each affected file,
1280 using the following status codes:
1281 .Bl -column YXZ description
1282 .It G Ta file was merged
1283 .It C Ta file was merged and conflicts occurred during merge
1284 .It ! Ta changes destined for a missing file were not merged
1285 .It D Ta file was deleted
1286 .It d Ta file's deletion was obstructed by local modifications
1287 .It A Ta new file was added
1288 .It \(a~ Ta changes destined for a non-regular file were not merged
1291 If merge conflicts occur the histedit operation is interrupted and may
1292 be continued once conflicts have been resolved.
1293 Alternatively, the histedit operation may be aborted which will leave
1294 the work tree switched back to its original branch.
1296 If a merge conflict is resolved in a way which renders the merged
1297 change into a no-op change, the corresponding commit will be elided
1298 when the histedit operation continues.
1301 will refuse to run if certain preconditions are not met.
1302 If the work tree's current branch is not in the
1304 reference namespace, the history of the branch may not be edited.
1305 If the work tree contains multiple base commits it must first be updated
1306 to a single base commit with
1308 If changes have been staged with
1310 these changes must first be committed with
1314 If the work tree contains local changes, these changes must first be
1319 If the edited history contains changes to files outside of the work tree's
1320 path prefix, the work tree cannot be used to edit the history of this branch.
1327 commands will refuse to run while a histedit operation is in progress.
1328 Other commands which manipulate the work tree may be used, and the
1330 command may be used to commit arbitrary changes to the temporary branch
1331 while the histedit operation is interrupted.
1338 Abort an interrupted histedit operation.
1339 If this option is used, no other command-line arguments are allowed.
1341 Continue an interrupted histedit operation.
1342 If this option is used, no other command-line arguments are allowed.
1343 .It Fl F Ar histedit-script
1346 instead of opening a temporary file in an editor where a histedit script
1349 Edit log messages only.
1350 This option is a quick equivalent to a histedit script which edits
1351 only log messages but otherwise leaves every picked commit as-is.
1354 option can only be used when starting a new histedit operation.
1355 If this option is used, no other command-line arguments are allowed.
1360 .It Cm integrate Ar branch
1361 Integrate the specified
1363 into the work tree's current branch.
1364 Files in the work tree are updated to match the contents on the integrated
1366 and the reference of the work tree's branch is changed to point at the
1367 head commit of the integrated
1370 Both branches can be considered equivalent after integration since they
1371 will be pointing at the same commit.
1372 Both branches remain available for future work, if desired.
1373 In case the integrated
1375 is no longer needed it may be deleted with
1378 Show the status of each affected file, using the following status codes:
1379 .Bl -column YXZ description
1380 .It U Ta file was updated
1381 .It D Ta file was deleted
1382 .It A Ta new file was added
1383 .It \(a~ Ta versioned file is obstructed by a non-regular file
1384 .It ! Ta a missing versioned file was restored
1388 will refuse to run if certain preconditions are not met.
1389 Most importantly, the
1391 must have been rebased onto the work tree's current branch with
1393 before it can be integrated, in order to linearize commit history and
1394 resolve merge conflicts.
1395 If the work tree contains multiple base commits it must first be updated
1396 to a single base commit with
1398 If changes have been staged with
1400 these changes must first be committed with
1404 If the work tree contains local changes, these changes must first be
1412 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1413 Stage local changes for inclusion in the next commit.
1416 is specified, stage all changes in the work tree.
1417 Otherwise, stage changes at or within the specified paths.
1418 Paths may be staged if they are added, modified, or deleted according to
1421 Show the status of each affected file, using the following status codes:
1422 .Bl -column YXZ description
1423 .It A Ta file addition has been staged
1424 .It M Ta file modification has been staged
1425 .It D Ta file deletion has been staged
1428 Staged file contents are saved in newly created blob objects in the repository.
1429 These blobs will be referred to by tree objects once staged changes have been
1432 Staged changes affect the behaviour of
1437 While paths with staged changes exist, the
1439 command will refuse to commit any paths which do not have staged changes.
1440 Local changes created on top of staged changes can only be committed if
1441 the path is staged again, or if the staged changes are committed first.
1444 command will show both local changes and staged changes.
1447 command is able to display local changes relative to staged changes,
1448 and to display staged changes relative to the repository.
1451 command cannot revert staged changes but may be used to revert
1452 local changes created on top of staged changes.
1459 Instead of staging new changes, list paths which are already staged,
1460 along with the IDs of staged blob objects and stage status codes.
1461 If paths were provided in the command line show the staged paths
1462 among the specified paths.
1463 Otherwise, show all staged paths.
1465 Instead of staging the entire content of a changed file, interactively
1466 select or reject changes for staging based on
1470 (reject change), and
1472 (quit staging this file) responses.
1473 If a file is in modified status, individual patches derived from the
1474 modified file content can be staged.
1475 Files in added or deleted status may only be staged or rejected in
1477 .It Fl F Ar response-script
1485 responses line-by-line from the specified
1487 file instead of prompting interactively.
1491 will refuse to run if certain preconditions are not met.
1492 If a file contains merge conflicts, these conflicts must be resolved first.
1493 If a file is found to be out of date relative to the head commit on the
1494 work tree's current branch, the file must be updated with
1496 before it can be staged (however, this does not prevent the file from
1497 becoming out-of-date at some point after having been staged).
1504 commands will refuse to run while staged changes exist.
1505 If staged changes cannot be committed because a staged path
1506 is out of date, the path must be unstaged with
1508 before it can be updated with
1510 and may then be staged again if necessary.
1514 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
1515 Merge staged changes back into the work tree and put affected paths
1516 back into non-staged status.
1519 is specified, unstage all staged changes across the entire work tree.
1520 Otherwise, unstage changes at or within the specified paths.
1522 Show the status of each affected file, using the following status codes:
1523 .Bl -column YXZ description
1524 .It G Ta file was unstaged
1525 .It C Ta file was unstaged and conflicts occurred during merge
1526 .It ! Ta changes destined for a missing file were not merged
1527 .It D Ta file was staged as deleted and still is deleted
1528 .It d Ta file's deletion was obstructed by local modifications
1529 .It \(a~ Ta changes destined for a non-regular file were not merged
1537 Instead of unstaging the entire content of a changed file, interactively
1538 select or reject changes for unstaging based on
1542 (keep change staged), and
1544 (quit unstaging this file) responses.
1545 If a file is staged in modified status, individual patches derived from the
1546 staged file content can be unstaged.
1547 Files staged in added or deleted status may only be unstaged in their entirety.
1548 .It Fl F Ar response-script
1556 responses line-by-line from the specified
1558 file instead of prompting interactively.
1563 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
1564 Parse and print contents of objects to standard output in a line-based
1566 Content of commit, tree, and tag objects is printed in a way similar
1567 to the actual content stored in such objects.
1568 Blob object contents are printed as they would appear in files on disk.
1570 Attempt to interpret each argument as a reference, a tag name, or
1571 an object ID SHA1 hash.
1572 References will be resolved to an object ID.
1573 Tag names will resolved to a tag object.
1574 An abbreviated hash argument will be expanded to a full SHA1 hash
1575 automatically, provided the abbreviation is unique.
1577 If none of the above interpretations produce a valid result, or if the
1579 option is used, attempt to interpret the argument as a path which will
1580 be resolved to the ID of an object found at this path in the repository.
1587 Look up paths in the specified
1589 If this option is not used, paths are looked up in the commit resolved
1590 via the repository's HEAD reference.
1591 The expected argument is a commit ID SHA1 hash or an existing reference
1592 or tag name which will be resolved to a commit ID.
1593 An abbreviated hash argument will be expanded to a full SHA1 hash
1594 automatically, provided the abbreviation is unique.
1595 .It Fl r Ar repository-path
1596 Use the repository at the specified path.
1597 If not specified, assume the repository is located at or above the current
1599 If this directory is a
1601 work tree, use the repository path associated with this work tree.
1603 Interpret all arguments as paths only.
1604 This option can be used to resolve ambiguity in cases where paths
1605 look like tag names, reference names, or object IDs.
1609 .Bl -tag -width GOT_AUTHOR
1611 The author's name and email address for
1616 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1619 may fail to parse commits without an email address in author data,
1623 environment variables with a missing email address.
1629 configuration settings in the repository's
1631 file will override the value of
1637 configuration settings contained in Git's global
1639 configuration file will be used only if the
1641 environment variable is
1644 .It Ev VISUAL , EDITOR
1645 The editor spawned by
1650 .It Ev GOT_LOG_DEFAULT_LIMIT
1651 The default limit on the number of commits traversed by
1653 If set to zero, the limit is unbounded.
1654 This variable will be silently ignored if it is set to a non-numeric value.
1655 .It Ev GOT_FETCH_DEBUG
1656 Enables protocol tracing on standard error output during
1664 Clone an existing Git repository for use with
1668 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1670 Use of HTTP URLs currently requires
1674 .Dl $ git clone --bare https://github.com/openbsd/src.git
1676 Alternatively, for quick and dirty local testing of
1678 a new Git repository could be created and populated with files,
1679 e.g. from a temporary CVS checkout located at
1682 .Dl $ got init /var/git/src.git
1683 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1685 Check out a work tree from the Git repository to /usr/src:
1687 .Dl $ got checkout /var/git/src.git /usr/src
1689 View local changes in a work tree directory:
1692 .Dl $ got diff | less
1694 Interactively revert selected local changes in a work tree directory:
1696 .Dl $ got revert -p -R\ .
1698 In a work tree or a git repository directory, list all branch references:
1702 In a work tree or a git repository directory, create a new branch called
1703 .Dq unified-buffer-cache
1704 which is forked off the
1708 .Dl $ got branch unified-buffer-cache master
1710 Switch an existing work tree to the branch
1711 .Dq unified-buffer-cache .
1712 Local changes in the work tree will be preserved and merged if necessary:
1714 .Dl $ got update -b unified-buffer-cache
1716 Create a new commit from local changes in a work tree directory.
1717 This new commit will become the head commit of the work tree's current branch:
1721 In a work tree or a git repository directory, view changes committed in
1722 the 3 most recent commits to the work tree's branch, or the branch resolved
1723 via the repository's HEAD reference, respectively:
1725 .Dl $ got log -p -l 3
1727 In a work tree or a git repository directory, log the history of a subdirectory:
1729 .Dl $ got log sys/uvm
1731 While operating inside a work tree, paths are specified relative to the current
1732 working directory, so this command will log the subdirectory
1735 .Dl $ cd sys/uvm && got log '.'
1737 And this command has the same effect:
1739 .Dl $ cd sys/dev/usb && got log ../../uvm
1741 Add new files and remove obsolete files in a work tree directory:
1743 .Dl $ got add sys/uvm/uvm_ubc.c
1744 .Dl $ got remove sys/uvm/uvm_vnode.c
1746 Create a new commit from local changes in a work tree directory
1747 with a pre-defined log message.
1749 .Dl $ got commit -m 'unify the buffer cache'
1751 Update any work tree checked out from the
1752 .Dq unified-buffer-cache
1753 branch to the latest commit on this branch:
1757 Roll file content on the unified-buffer-cache branch back by one commit,
1758 and then fetch the rolled-back change into the work tree as a local change
1759 to be amended and perhaps committed again:
1761 .Dl $ got backout unified-buffer-cache
1762 .Dl $ got commit -m 'roll back previous'
1763 .Dl $ # now back out the previous backout :-)
1764 .Dl $ got backout unified-buffer-cache
1766 Fetch new upstream commits into the local repository's
1773 In a repository created with a HTTP URL and
1774 .Cm git clone --bare
1777 command must be used instead:
1779 .Dl $ cd /var/git/src.git
1780 .Dl $ git fetch origin master:refs/remotes/origin/master
1784 branch to merge the new changes that are now visible on the
1789 .Dl $ got update -b origin/master
1790 .Dl $ got rebase master
1793 .Dq unified-buffer-cache
1794 branch on top of the new head commit of the
1798 .Dl $ got update -b master
1799 .Dl $ got rebase unified-buffer-cache
1801 Create a patch from all changes on the unified-buffer-cache branch.
1802 The patch can be mailed out for review and applied to
1806 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
1808 Edit the entire commit history of the
1809 .Dq unified-buffer-cache
1812 .Dl $ got update -b unified-buffer-cache
1813 .Dl $ got update -c master
1816 In order to merge changes committed to the
1817 .Dq unified-buffer-cache
1818 branch back into the
1821 .Dq unified-buffer-cache
1822 branch must first be rebased onto the
1826 .Dl $ got update -b master
1827 .Dl $ got rebase unified-buffer-cache
1830 .Dq unified-buffer-cache
1831 branch can now be made visible on the
1835 Because the rebase operation switched the work tree to the
1836 .Dq unified-buffer-cache
1837 branch, the work tree must be switched back to the
1840 .Dq unified-buffer-cache
1841 branch can be integrated into
1844 .Dl $ got update -b master
1845 .Dl $ got integrate unified-buffer-cache
1847 Additional steps may be necessary if local changes need to be pushed back
1848 to the remote repository, which currently requires
1850 Before working against existing branches in a repository cloned with
1851 .Cm git clone --bare
1856 must be configured to map all references in the remote repository
1859 namespace of the local repository.
1860 This can achieved by setting Git's
1861 .Pa remote.origin.fetch
1862 configuration variable to the value
1863 .Dq +refs/heads/*:refs/remotes/origin/*
1868 .Dl $ cd /var/git/repo
1869 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
1872 option must be disabled:
1874 .Dl $ cd /var/git/repo
1875 .Dl $ git config remote.origin.mirror false
1877 Alternatively, the following
1879 configuration item can be added manually to the Git repository's
1883 .Dl [remote "origin"]
1885 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
1888 This configuration leaves the local repository's
1890 namespace free for use by local branches checked out with
1892 and, if needed, created with
1897 namespace can now be updated with incoming changes from the remote
1902 without extra command line arguments:
1904 .Dl $ cd /var/git/repo
1907 To make changes fetched from the remote repository appear on the
1911 branch must be rebased onto the
1914 This will also merge local changes, if any, with the incoming changes:
1916 .Dl $ got update -b origin/master
1917 .Dl $ got rebase master
1921 branch, log messages for local changes can now be amended with
1923 by other developers and any other important new information:
1925 .Dl $ got update -c origin/master
1926 .Dl $ got histedit -m
1928 Local changes on the
1930 branch can then be pushed to the remote
1934 .Dl $ cd /var/git/repo
1935 .Dl $ git push origin master
1938 .Xr git-repository 5 ,
1941 .An Stefan Sperling Aq Mt stsp@openbsd.org
1942 .An Martin Pieuchot Aq Mt mpi@openbsd.org
1943 .An Joshua Stein Aq Mt jcs@openbsd.org
1944 .An Ori Bernstein Aq Mt ori@openbsd.org
1947 is a work-in-progress and many commands remain to be implemented.
1948 At present, the user has to fall back on
1950 to perform many tasks, in particular tasks related to repository
1951 administration and tasks which require a network connection.