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
77 .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
79 Create an initial commit in a repository from the file hierarchy
82 The created commit will not have any parent commits, i.e. it will be a
84 Also create a new reference which provides a branch name for the newly
86 Show the path of each imported file to indicate progress.
92 environment variable to be set,
93 unless an author has been configured in
99 configuration settings can be obtained from the repository's
101 file or from Git's global
112 instead of creating the default branch
114 Use of this option is required if the
116 branch already exists.
118 Use the specified log message when creating the new commit.
123 opens a temporary file in an editor where a log message can be written.
124 .It Fl r Ar repository-path
125 Use the repository at the specified path.
126 If not specified, assume the repository is located at or above the current
129 Ignore files or directories with a name which matches the specified
131 This option may be specified multiple times to build a list of ignore patterns.
134 follows the globbing rules documented in
138 .It Cm clone Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl l Oc Oo Fl m Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Ar repository-URL Op Ar directory
140 Clone a Git repository at the specified
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 Use of this protocol is discouraged since it supports neither authentication
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.
180 Objects in the cloned repository are stored in a pack file which is downloaded
182 This pack file will then be indexed to facilitate access to the objects stored
184 If any objects in the pack file are stored in deltified form, all deltas will
185 be fully resolved in order to compute the ID of such objects.
186 This can take some time.
187 More details about the pack file format are documented in
188 .Xr git-repository 5 .
191 creates a remote repository entry in the
195 files of the cloned repository to store the
201 arguments for future use by
211 Fetch all branches from the remote repository's
213 reference namespace and set
214 .Cm fetch-all-branches
215 in the cloned repository's
217 file for future use by
219 If this option is not specified, a branch resolved via the remote
220 repository's HEAD reference will be fetched.
221 Cannot be used together with the
227 from the remote repository's
230 This option may be specified multiple times to build a list of branches
232 If the branch corresponding to the remote repository's HEAD reference is not
233 in this list, the cloned repository's HEAD reference will be set to the first
234 branch which was fetched.
235 If this option is not specified, a branch resolved via the remote
236 repository's HEAD reference will be fetched.
237 Cannot be used together with the
241 List branches and tags available for fetching from the remote repository
242 and exit immediately.
243 Cannot be used together with any of the other options except
248 Create the cloned repository as a mirror of the original repository.
249 This is useful if the cloned repository will not be used to store
250 locally created commits.
256 files will be set up with the
258 option enabled, such that
262 will write incoming changes directly to branches in the
264 reference namespace, rather than to branches in the
267 This avoids the usual requirement of having to run
271 in order to make incoming changes appear on branches in the
274 But maintaining custom changes in the cloned repository becomes difficult
275 since such changes will be at risk of being discarded whenever incoming
278 Suppress progress reporting output.
279 The same option will be passed to
286 to print debugging messages to standard error output.
287 This option will be passed to
290 Multiple -v options increase the verbosity.
292 .It Fl R Ar reference
293 In addition to the branches and tags that will be fetched, fetch an arbitrary
295 from the remote repository's
298 This option may be specified multiple times to build a list of additional
302 may either be a path to a specific reference, or a reference namespace
303 which will cause all references in this namespace to be fetched.
305 Each reference will be mapped into the cloned repository's
307 namespace, unless the
309 option is used to mirror references directly into the cloned repository's
314 will refuse to fetch references from the remote repository's
321 .It Cm fetch Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl d Oc Oo Fl l Oc Oo Fl r Ar repository-path Oc Oo Fl t Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Oo Fl X Oc Op Ar remote-repository
323 Fetch new changes from a remote repository.
325 .Ar remote-repository
329 The remote repository's URL is obtained from the corresponding entry in
333 file of the local repository, as created by
336 New changes will be stored in a separate pack file downloaded from the server.
337 Optionally, separate pack files stored in the repository can be combined with
340 By default, branch references in the
342 reference namespace will be updated to point at the newly fetched commits.
345 command can then be used to make new changes visible on branches in the
347 namespace, merging incoming changes with the changes on those branches
350 If the repository was created as a mirror with
352 then all branches in the
354 namespace will be updated directly to match the corresponding branches in
355 the remote repository.
356 If those branches contained local commits, these commits will no longer be
357 reachable via a reference and will therefore be at risk of being discarded
358 by Git's garbage collector or
359 .Cm gotadmin cleanup .
360 Maintaining custom changes in a mirror repository is therefore discouraged.
362 In any case, references in the
364 namespace will always be fetched and mapped directly to local references
365 in the same namespace.
372 Fetch all branches from the remote repository's
375 This option can be enabled by default for specific repositories in
377 If this option is not specified, a branch resolved via the remote
378 repository's HEAD reference will be fetched.
379 Cannot be used together with the
385 from the remote repository's
388 This option may be specified multiple times to build a list of branches
390 If this option is not specified, a branch resolved via the remote
391 repository's HEAD reference will be fetched.
392 Cannot be used together with the
396 Delete branches and tags from the local repository which are no longer
397 present in the remote repository.
398 Only references are deleted.
399 Any commit, tree, tag, and blob objects belonging to deleted branches or
400 tags remain in the repository and may be removed separately with
401 Git's garbage collector or
402 .Cm gotadmin cleanup .
404 List branches and tags available for fetching from the remote repository
405 and exit immediately.
406 Cannot be used together with any of the other options except
412 Allow existing references in the
414 namespace to be updated if they have changed on the server.
415 If not specified, only new tag references will be created.
416 .It Fl r Ar repository-path
417 Use the repository at the specified path.
418 If not specified, assume the repository is located at or above the current
420 If this directory is a
422 work tree, use the repository path associated with this work tree.
424 Suppress progress reporting output.
425 The same option will be passed to
432 to print debugging messages to standard error output.
433 The same option will be passed to
436 Multiple -v options increase the verbosity.
438 .It Fl R Ar reference
439 In addition to the branches and tags that will be fetched, fetch an arbitrary
441 from the remote repository's
444 This option may be specified multiple times to build a list of additional
448 may either be a path to a specific reference, or a reference namespace
449 which will cause all references in this namespace to be fetched.
451 Each reference will be mapped into the local repository's
453 namespace, unless the local repository was created as a mirror with
455 in which case references will be mapped directly into the local repository's
459 Once a reference has been fetched, a branch based on it can be created with
464 will refuse to fetch references from the remote repository's
470 Delete all references which correspond to a particular
471 .Ar remote-repository
472 instead of fetching new changes.
473 This can be useful when a remote repository is being removed from
479 .Ar remote-repository
480 argument is mandatory and no other options except
487 Only references are deleted.
488 Any commit, tree, tag, and blob objects fetched from a remote repository
489 will generally be stored in pack files and may be removed separately with
491 and Git's garbage collector.
494 .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 Oo Fl q Oc Ar repository-path Op Ar work-tree-path
496 Copy files from a repository into a new work tree.
497 Show the status of each affected file, using the following status codes:
498 .Bl -column YXZ description
499 .It A Ta new file was added
500 .It E Ta file already exists in work tree's meta-data
505 is not specified, either use the last component of
506 .Ar repository path ,
509 was specified use the last component of
517 Proceed with the checkout operation even if the directory at
520 Existing files will be left intact.
522 Check out files from a commit on the specified
524 If this option is not specified, a branch resolved via the repository's HEAD
525 reference will be used.
527 Check out files from the specified
529 on the selected branch.
530 The expected argument is a commit ID SHA1 hash or an existing reference
531 or tag name which will be resolved to a commit ID.
532 An abbreviated hash argument will be expanded to a full SHA1 hash
533 automatically, provided the abbreviation is unique.
534 If this option is not specified, the most recent commit on the selected
539 is not contained in the selected branch, a different branch which contains
540 this commit must be specified with the
543 If no such branch is known a new branch must be created for this
549 Checking out work trees with an unknown branch is intentionally not supported.
550 .It Fl p Ar path-prefix
551 Restrict the work tree to a subset of the repository's tree hierarchy.
552 Only files beneath the specified
556 Silence progress output.
559 .It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Oo Fl q Oc Op Ar path ...
561 Update an existing work tree to a different
563 Change existing files in the work tree as necessary to match file contents
565 Preserve any local changes in the work tree and merge them with the
568 Files which already contain merge conflicts will not be updated to avoid
569 further complications.
570 Such files will be updated when
572 is run again after merge conflicts have been resolved.
573 If the conflicting changes are no longer needed affected files can be
580 Show the status of each affected file, using the following status codes:
581 .Bl -column YXZ description
582 .It U Ta file was updated and contained no local changes
583 .It G Ta file was updated and local changes were merged cleanly
584 .It C Ta file was updated and conflicts occurred during merge
585 .It D Ta file was deleted
586 .It A Ta new file was added
587 .It \(a~ Ta versioned file is obstructed by a non-regular file
588 .It ! Ta a missing versioned file was restored
589 .It # Ta file was not updated because it contains merge conflicts
590 .It ? Ta changes destined for an unversioned file were not merged
595 is specified, update the entire work tree.
596 Otherwise, restrict the update operation to files at or within the
598 Each path is required to exist in the update operation's target commit.
599 Files in the work tree outside specified paths will remain unchanged and
600 will retain their previously recorded base commit.
603 commands may refuse to run while the work tree contains files from
604 multiple base commits.
605 The base commit of such a work tree can be made consistent by running
607 across the entire work tree.
610 is incompatible with the
615 cannot update paths with staged changes.
616 If changes have been staged with
618 these changes must first be committed with
628 Switch the work tree's branch reference to the specified
630 before updating the work tree.
631 This option requires that all paths in the work tree are updated.
633 As usual, any local changes in the work tree will be preserved.
634 This can be useful when switching to a newly created branch in order
635 to commit existing local changes to this branch.
637 Any local changes must be dealt with separately in order to obtain a
638 work tree with pristine file contents corresponding exactly to the specified
640 Such changes could first be committed to a different branch with
642 or could be discarded with
645 Update the work tree to the specified
647 The expected argument is a commit ID SHA1 hash or an existing reference
648 or tag name which will be resolved to a commit ID.
649 An abbreviated hash argument will be expanded to a full SHA1 hash
650 automatically, provided the abbreviation is unique.
651 If this option is not specified, the most recent commit on the work tree's
654 Silence progress output.
657 .It Cm status Oo Fl I Oc Oo Fl s Ar status-codes Oc Oo Fl S Ar status-codes Oc Op Ar path ...
659 Show the current modification status of files in a work tree,
660 using the following status codes:
661 .Bl -column YXZ description
662 .It M Ta modified file
663 .It A Ta file scheduled for addition in next commit
664 .It D Ta file scheduled for deletion in next commit
665 .It C Ta modified or added file which contains merge conflicts
666 .It ! Ta versioned file was expected on disk but is missing
667 .It \(a~ Ta versioned file is obstructed by a non-regular file
668 .It ? Ta unversioned item not tracked by
670 .It m Ta modified file modes (executable bit only)
671 .It N Ta non-existent
673 specified on the command line
678 is specified, show modifications in the entire work tree.
679 Otherwise, show modifications at or within the specified paths.
681 If changes have been staged with
683 staged changes are shown in the second output column, using the following
685 .Bl -column YXZ description
686 .It M Ta file modification is staged
687 .It A Ta file addition is staged
688 .It D Ta file deletion is staged
691 Changes created on top of staged changes are indicated in the first column:
692 .Bl -column YXZ description
693 .It MM Ta file was modified after earlier changes have been staged
694 .It MA Ta file was modified after having been staged for addition
702 Show unversioned files even if they match an ignore pattern.
703 .It Fl s Ar status-codes
704 Only show files with a modification status matching any of the
705 single-character status codes contained in the
708 Any combination of codes from the above list of possible status codes
710 For staged files, status codes displayed in either column will be matched.
711 Cannot be used together with the
714 .It Fl S Ar status-codes
715 Suppress the output of files with a modification status matching any of the
716 single-character status codes contained in the
719 Any combination of codes from the above list of possible status codes
721 For staged files, status codes displayed in either column will be matched.
722 Cannot be used together with the
727 For compatibility with
738 files in each traversed directory and will not display unversioned files
739 which match these patterns.
744 supports consecutive asterisks,
746 which will match an arbitrary amount of directories.
750 only supports a single ignore pattern per line.
754 does not support negated ignore patterns prefixed with
756 and gives no special significance to the location of path component separators,
759 .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 P Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Oo Fl R Oc Oo Fl x Ar commit Oc Op Ar path
760 Display history of a repository.
763 is specified, show only commits which modified this path.
764 If invoked in a work tree, the
766 is interpreted relative to the current working directory,
767 and the work tree's path prefix is implicitly prepended.
768 Otherwise, the path is interpreted relative to the repository root.
775 Display individual commits which were merged into the current branch
779 shows the linear history of the current branch only.
781 Start traversing history at the specified
783 The expected argument is a commit ID SHA1 hash or an existing reference
784 or tag name which will be resolved to a commit ID.
785 An abbreviated hash argument will be expanded to a full SHA1 hash
786 automatically, provided the abbreviation is unique.
787 If this option is not specified, default to the work tree's current branch
788 if invoked in a work tree, or to the repository's HEAD reference.
790 Set the number of context lines shown in diffs with
792 By default, 3 lines of context are shown.
794 Limit history traversal to a given number of commits.
795 If this option is not specified, a default limit value of zero is used,
796 which is treated as an unbounded limit.
798 .Ev GOT_LOG_DEFAULT_LIMIT
799 environment variable may be set to change this default value.
801 Display the patch of modifications made in each commit.
804 is specified, only show the patch of modifications at or within this path.
806 Display the list of file paths changed in each commit, using the following
808 .Bl -column YXZ description
809 .It M Ta modified file
810 .It D Ta file was deleted
811 .It A Ta new file was added
812 .It m Ta modified file modes (executable bit only)
814 .It Fl s Ar search-pattern
815 If specified, show only commits with a log message matched by the extended
818 When used together with
820 then the file paths changed by a commit can be matched as well.
821 Regular expression syntax is documented in
823 .It Fl r Ar repository-path
824 Use the repository at the specified path.
825 If not specified, assume the repository is located at or above the current
827 If this directory is a
829 work tree, use the repository path associated with this work tree.
831 Determine a set of commits to display as usual, but display these commits
834 Stop traversing commit history immediately after the specified
837 This option has no effect if the specified
842 .It Cm diff Oo Fl a Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl P Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path ...
844 When invoked within a work tree without any arguments, display all
845 local changes in the work tree.
848 arguments are specified, only show changes within the specified paths.
850 If two arguments are provided, treat each argument as a reference, a tag
851 name, or an object ID SHA1 hash, and display differences between the
852 corresponding objects.
853 Both objects must be of the same type (blobs, trees, or commits).
854 An abbreviated hash argument will be expanded to a full SHA1 hash
855 automatically, provided the abbreviation is unique.
856 If none of these interpretations produce a valid result or if the
861 is running in a work tree, attempt to interpret the two arguments as paths.
868 Treat file contents as ASCII text even if binary data is detected.
870 Show differences between commits in the repository.
871 This options may be used up to two times.
872 When used only once, show differences between the specified
874 and its first parent commit.
875 When used twice, show differences between the two specified commits.
877 The expected argument is a commit ID SHA1 hash or an existing reference
878 or tag name which will be resolved to a commit ID.
879 An abbreviated hash argument will be expanded to a full SHA1 hash
880 automatically, provided the abbreviation is unique.
884 option is used, all non-option arguments will be interpreted as paths.
887 arguments are provided, only show differences for the specified paths.
889 Cannot be used together with the
893 Set the number of context lines shown in the diff.
894 By default, 3 lines of context are shown.
895 .It Fl r Ar repository-path
896 Use the repository at the specified path.
897 If not specified, assume the repository is located at or above the current
899 If this directory is a
901 work tree, use the repository path associated with this work tree.
903 Show changes staged with
905 instead of showing local changes in the work tree.
906 This option is only valid when
908 is invoked in a work tree.
910 Interpret all arguments as paths only.
911 This option can be used to resolve ambiguity in cases where paths
912 look like tag names, reference names, or object IDs.
913 This option is only valid when
915 is invoked in a work tree.
917 Ignore whitespace-only changes.
920 .It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
922 Display line-by-line history of a file at the specified path.
929 Start traversing history at the specified
931 The expected argument is a commit ID SHA1 hash or an existing reference
932 or tag name which will be resolved to a commit ID.
933 An abbreviated hash argument will be expanded to a full SHA1 hash
934 automatically, provided the abbreviation is unique.
935 .It Fl r Ar repository-path
936 Use the repository at the specified path.
937 If not specified, assume the repository is located at or above the current
939 If this directory is a
941 work tree, use the repository path associated with this work tree.
944 .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
946 Display a listing of files and directories at the specified
947 directory path in the repository.
948 Entries shown in this listing may carry one of the following trailing
950 .Bl -column YXZ description
951 .It @ Ta entry is a symbolic link
952 .It / Ta entry is a directory
953 .It * Ta entry is an executable file
954 .It $ Ta entry is a Git submodule
957 Symbolic link entries are also annotated with the target path of the link.
961 is specified, list the repository path corresponding to the current
962 directory of the work tree, or the root directory of the repository
963 if there is no work tree.
970 List files and directories as they appear in the specified
972 The expected argument is a commit ID SHA1 hash or an existing reference
973 or tag name which will be resolved to a commit ID.
974 An abbreviated hash argument will be expanded to a full SHA1 hash
975 automatically, provided the abbreviation is unique.
976 .It Fl r Ar repository-path
977 Use the repository at the specified path.
978 If not specified, assume the repository is located at or above the current
980 If this directory is a
982 work tree, use the repository path associated with this work tree.
984 Show object IDs of files (blob objects) and directories (tree objects).
986 Recurse into sub-directories in the repository.
988 .It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl t Oc Oo Fl c Ar object Oc Oo Fl s Ar reference Oc Oo Fl d Oc Op Ar name
989 Manage references in a repository.
991 References may be listed, created, deleted, and changed.
992 When creating, deleting, or changing a reference the specified
994 must be an absolute reference name, i.e. it must begin with
1001 .It Fl r Ar repository-path
1002 Use the repository at the specified path.
1003 If not specified, assume the repository is located at or above the current
1005 If this directory is a
1007 work tree, use the repository path associated with this work tree.
1009 List references in the repository.
1012 is specified, list all existing references in the repository.
1015 is a reference namespace, list all references in this namespace.
1016 Otherwise, show only the reference with the given
1018 Cannot be used together with any other options except
1023 Sort listed references by modification time (most recently modified first)
1024 instead of sorting by lexicographical order.
1025 Use of this option requires the
1027 option to be used as well.
1029 Create a reference or change an existing reference.
1030 The reference with the specified
1032 will point at the specified
1036 argument is a ID SHA1 hash or an existing reference or tag name which will
1037 be resolved to the ID of a corresponding commit, tree, tag, or blob object.
1038 Cannot be used together with any other options except
1040 .It Fl s Ar reference
1041 Create a symbolic reference, or change an existing symbolic reference.
1042 The symbolic reference with the specified
1044 will point at the specified
1046 which must already exist in the repository.
1047 Care should be taken not to create loops between references when
1048 this option is used.
1049 Cannot be used together with any other options except
1052 Delete the reference with the specified
1054 from the repository.
1055 Any commit, tree, tag, and blob objects belonging to deleted references
1056 remain in the repository and may be removed separately with
1057 Git's garbage collector or
1058 .Cm gotadmin cleanup .
1059 Cannot be used together with any other options except
1063 .It Cm branch Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl t Oc Oo Fl d Ar name Oc Oo Fl n Oc Op Ar name
1065 Create, list, or delete branches.
1067 Local branches are managed via references which live in the
1069 reference namespace.
1072 command creates references in this namespace only.
1074 When deleting branches the specified
1078 reference namespace first.
1079 If no corresponding branch is found the
1081 namespace will be searched next.
1083 If invoked in a work tree without any arguments, print the name of the
1084 work tree's current branch.
1088 argument is passed, attempt to create a branch reference with the given name.
1089 By default the new branch reference will point at the latest commit on the
1090 work tree's current branch if invoked in a work tree, and otherwise to a commit
1091 resolved via the repository's HEAD reference.
1093 If invoked in a work tree, once the branch was created successfully
1094 switch the work tree's head reference to the newly created branch and
1095 update files across the entire work tree, just like
1096 .Cm got update -b Ar name
1098 Show the status of each affected file, using the following status codes:
1099 .Bl -column YXZ description
1100 .It U Ta file was updated and contained no local changes
1101 .It G Ta file was updated and local changes were merged cleanly
1102 .It C Ta file was updated and conflicts occurred during merge
1103 .It D Ta file was deleted
1104 .It A Ta new file was added
1105 .It \(a~ Ta versioned file is obstructed by a non-regular file
1106 .It ! Ta a missing versioned file was restored
1114 Make a newly created branch reference point at the specified
1118 argument is a commit ID SHA1 hash or an existing reference
1119 or tag name which will be resolved to a commit ID.
1120 .It Fl r Ar repository-path
1121 Use the repository at the specified path.
1122 If not specified, assume the repository is located at or above the current
1124 If this directory is a
1126 work tree, use the repository path associated with this work tree.
1128 List all existing branches in the repository, including copies of remote
1129 repositories' branches in the
1131 reference namespace.
1133 If invoked in a work tree, the work tree's current branch is shown
1134 with one the following annotations:
1135 .Bl -column YXZ description
1136 .It * Ta work tree's base commit matches the branch tip
1137 .It \(a~ Ta work tree's base commit is out-of-date
1140 Sort listed branches by modification time (most recently modified first)
1141 instead of sorting by lexicographical order.
1144 reference namespace are listed before branches in
1147 Use of this option requires the
1149 option to be used as well.
1151 Delete the branch with the specified
1157 reference namespace.
1159 Only the branch reference is deleted.
1160 Any commit, tree, and blob objects belonging to the branch
1161 remain in the repository and may be removed separately with
1162 Git's garbage collector or
1163 .Cm gotadmin cleanup .
1165 Do not switch and update the work tree after creating a new branch.
1167 .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
1168 Manage tags in a repository.
1170 Tags are managed via references which live in the
1172 reference namespace.
1175 command operates on references in this namespace only.
1176 References in this namespace point at tag objects which contain a pointer
1177 to another object, a tag message, as well as author and timestamp information.
1179 Attempt to create a tag with the given
1181 and make this tag point at the given
1183 If no commit is specified, default to the latest commit on the work tree's
1184 current branch if invoked in a work tree, and to a commit resolved via
1185 the repository's HEAD reference otherwise.
1192 Make the newly created tag reference point at the specified
1196 argument is a commit ID SHA1 hash or an existing reference or tag name which
1197 will be resolved to a commit ID.
1198 An abbreviated hash argument will be expanded to a full SHA1 hash
1199 automatically, provided the abbreviation is unique.
1201 Use the specified tag message when creating the new tag.
1206 opens a temporary file in an editor where a tag message can be written.
1207 .It Fl r Ar repository-path
1208 Use the repository at the specified path.
1209 If not specified, assume the repository is located at or above the current
1211 If this directory is a
1213 work tree, use the repository path associated with this work tree.
1215 List all existing tags in the repository instead of creating a new tag.
1216 If this option is used, no other command-line arguments are allowed.
1221 command will not delete tags or change existing tags.
1222 If a tag must be deleted, the
1224 command may be used to delete a tag's reference.
1225 This should only be done if the tag has not already been copied to
1227 .It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
1228 Schedule unversioned files in a work tree for addition to the
1229 repository in the next commit.
1230 By default, files which match a
1232 ignore pattern will not be added.
1239 Permit recursion into directories.
1240 If this option is not specified,
1242 will refuse to run if a specified
1246 Add files even if they match a
1251 .It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Oo Fl s Ar status-codes Oc Ar path ...
1253 Remove versioned files from a work tree and schedule them for deletion
1254 from the repository in the next commit.
1261 Perform the operation even if a file contains local modifications,
1262 and do not raise an error if a specified
1264 does not exist on disk.
1266 Keep affected files on disk.
1268 Permit recursion into directories.
1269 If this option is not specified,
1271 will refuse to run if a specified
1274 .It Fl s Ar status-codes
1275 Only delete files with a modification status matching one of the
1276 single-character status codes contained in the
1279 The following status codes may be specified:
1280 .Bl -column YXZ description
1281 .It M Ta modified file (this implies the
1284 .It ! Ta versioned file expected on disk but missing
1288 .It Cm patch Oo Fl n Oc Op Ar patchfile
1292 to files in a work tree.
1293 Files added or removed by a patch will be scheduled for addition or removal in
1296 The patch must be in the unified diff format as produced by
1300 when invoked with the
1305 argument is provided, read unified diff data from standard input instead.
1309 contains multiple patches then attempt to apply each of them in sequence.
1311 Show the status of each affected file, using the following status codes:
1312 .Bl -column XYZ description
1313 .It M Ta file was modified
1314 .It D Ta file was deleted
1315 .It A Ta file was added
1316 .It # Ta failed to patch the file
1319 If a change does not match at its exact line number, attempt to
1320 apply it somewhere else in the file if a good spot can be found.
1321 Otherwise, the patch will fail to apply.
1325 will refuse to apply a patch if certain preconditions are not met.
1326 Files to be deleted must already be under version control, and must
1327 not have been scheduled for deletion already.
1328 Files to be added must not yet be under version control and must not
1329 already be present on disk.
1330 Files to be modified must already be under version control and may not
1331 contain conflict markers.
1333 If an error occurs, the
1335 operation will be aborted.
1336 Any changes made to the work tree up to this point will be left behind.
1337 Such changes can be viewed with
1339 and can be reverted with
1348 Do not make any modifications to the work tree.
1349 This can be used to check whether a patch would apply without issues.
1352 contains diffs that affect the same file multiple times the results
1353 displayed may be incorrect.
1356 .It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
1358 Revert any local changes in files at the specified paths in a work tree.
1359 File contents will be overwritten with those contained in the
1360 work tree's base commit.
1361 There is no way to bring discarded changes back after
1364 If a file was added with
1366 it will become an unversioned file again.
1367 If a file was deleted with
1369 it will be restored.
1376 Instead of reverting all changes in files, interactively select or reject
1377 changes to revert based on
1383 (quit reverting this file) responses.
1384 If a file is in modified status, individual patches derived from the
1385 modified file content can be reverted.
1386 Files in added or deleted status may only be reverted in their entirety.
1387 .It Fl F Ar response-script
1395 responses line-by-line from the specified
1397 file instead of prompting interactively.
1399 Permit recursion into directories.
1400 If this option is not specified,
1402 will refuse to run if a specified
1407 .It Cm commit Oo Fl F Ar path Oc Oo Fl m Ar message Oc Oo Fl N Oc Oo Fl S Oc Op Ar path ...
1409 Create a new commit in the repository from changes in a work tree
1410 and use this commit as the new base commit for the work tree.
1413 is specified, commit all changes in the work tree.
1414 Otherwise, commit changes at or within the specified paths.
1416 If changes have been explicitly staged for commit with
1418 only commit staged changes and reject any specified paths which
1419 have not been staged.
1422 opens a temporary file in an editor where a log message can be written
1430 options are used together.
1432 Show the status of each affected file, using the following status codes:
1433 .Bl -column YXZ description
1434 .It M Ta modified file
1435 .It D Ta file was deleted
1436 .It A Ta new file was added
1437 .It m Ta modified file modes (executable bit only)
1440 Files which are not part of the new commit will retain their previously
1441 recorded base commit.
1444 commands may refuse to run while the work tree contains files from
1445 multiple base commits.
1446 The base commit of such a work tree can be made consistent by running
1448 across the entire work tree.
1452 command requires the
1454 environment variable to be set,
1455 unless an author has been configured in
1461 configuration settings can be
1462 obtained from the repository's
1464 file or from Git's global
1473 Use the prepared log message stored in the file found at
1475 when creating the new commit.
1477 opens a temporary file in an editor where the prepared log message can be
1478 reviewed and edited further if needed.
1479 Cannot be used together with the
1483 Use the specified log message when creating the new commit.
1484 Cannot be used together with the
1488 This option prevents
1490 from opening the commit message in an editor.
1491 It has no effect unless it is used together with the
1493 option and is intended for non-interactive use such as scripting.
1495 Allow the addition of symbolic links which point outside of the path space
1496 that is under version control.
1499 will reject such symbolic links due to safety concerns.
1502 may decide to represent such a symbolic link as a regular file which contains
1503 the link's target path, rather than creating an actual symbolic link which
1504 points outside of the work tree.
1505 Use of this option is discouraged because external mechanisms such as
1507 are better suited for managing symbolic links to paths not under
1512 will refuse to run if certain preconditions are not met.
1513 If the work tree's current branch is not in the
1515 reference namespace, new commits may not be created on this branch.
1516 Local changes may only be committed if they are based on file content
1517 found in the most recent commit on the work tree's branch.
1518 If a path is found to be out of date,
1520 must be used first in order to merge local changes with changes made
1523 .It Cm send Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl d Ar branch Oc Oo Fl f Oc Oo Fl r Ar repository-path Oc Oo Fl t Ar tag Oc Oo Fl T Oc Oo Fl q Oc Oo Fl v Oc Op Ar remote-repository
1525 Send new changes to a remote repository.
1527 .Ar remote-repository
1531 The remote repository's URL is obtained from the corresponding entry in
1535 file of the local repository, as created by
1538 All objects corresponding to new changes will be written to a temporary
1539 pack file which is then uploaded to the server.
1540 Upon success, references in the
1542 reference namespace of the local repository will be updated to point at
1543 the commits which have been sent.
1545 By default, changes will only be sent if they are based on up-to-date
1546 copies of relevant branches in the remote repository.
1547 If any changes to be sent are based on out-of-date copies or would
1548 otherwise break linear history of existing branches, new changes must
1549 be fetched from the server with
1551 and local branches must be rebased with
1558 option can be used to make exceptions to these requirements.
1565 Send all branches from the local repository's
1567 reference namespace.
1570 option is equivalent to listing all branches with multiple
1573 Cannot be used together with the
1579 from the local repository's
1581 reference namespace.
1582 This option may be specified multiple times to build a list of branches
1584 If this option is not specified, default to the work tree's current branch
1585 if invoked in a work tree, or to the repository's HEAD reference.
1586 Cannot be used together with the
1590 Delete the specified
1592 from the remote repository's
1594 reference namespace.
1595 This option may be specified multiple times to build a list of branches
1598 Only references are deleted.
1599 Any commit, tree, tag, and blob objects belonging to deleted branches
1600 may become subject to deletion by Git's garbage collector running on
1603 Requesting deletion of branches results in an error if the server
1604 does not support this feature or disallows the deletion of branches
1605 based on its configuration.
1607 Attempt to force the server to overwrite existing branches or tags
1608 in the remote repository, even when
1612 would usually be required before changes can be sent.
1613 The server may reject forced requests regardless, depending on its
1616 Any commit, tree, tag, and blob objects belonging to overwritten branches
1617 or tags may become subject to deletion by Git's garbage collector running
1622 reference namespace is globally shared between all repositories.
1625 option to overwrite tags is discouraged because it can lead to
1626 inconsistencies between the tags present in different repositories.
1627 In general, creating a new tag with a different name is recommended
1628 instead of overwriting an existing tag.
1632 option is particularly discouraged if changes being sent are based
1633 on an out-of-date copy of a branch in the remote repository.
1634 Instead of using the
1636 option, new changes should
1639 and local branches should be rebased with
1641 followed by another attempt to send the changes.
1645 option should only be needed in situations where the remote repository's
1646 copy of a branch or tag is known to be out-of-date and is considered
1648 The risks of creating inconsistencies between different repositories
1649 should also be taken into account.
1650 .It Fl r Ar repository-path
1651 Use the repository at the specified path.
1652 If not specified, assume the repository is located at or above the current
1654 If this directory is a
1656 work tree, use the repository path associated with this work tree.
1660 from the local repository's
1662 reference namespace, in addition to any branches that are being sent.
1665 option may be specified multiple times to build a list of tags to send.
1666 No tags will be sent if the
1670 Raise an error if the specified
1672 already exists in the remote repository, unless the
1674 option is used to overwrite the server's copy of the tag.
1675 In general, creating a new tag with a different name is recommended
1676 instead of overwriting an existing tag.
1678 Cannot be used together with the
1682 Attempt to send all tags from the local repository's
1684 reference namespace.
1687 option is equivalent to listing all tags with multiple
1690 Cannot be used together with the
1694 Suppress progress reporting output.
1695 The same option will be passed to
1702 to print debugging messages to standard error output.
1703 The same option will be passed to
1706 Multiple -v options increase the verbosity.
1710 .It Cm cherrypick Ar commit
1712 Merge changes from a single
1717 should be on a different branch than the work tree's base commit.
1718 The expected argument is a reference or a commit ID SHA1 hash.
1719 An abbreviated hash argument will be expanded to a full SHA1 hash
1720 automatically, provided the abbreviation is unique.
1722 Show the status of each affected file, using the following status codes:
1723 .Bl -column YXZ description
1724 .It G Ta file was merged
1725 .It C Ta file was merged and conflicts occurred during merge
1726 .It ! Ta changes destined for a missing file were not merged
1727 .It D Ta file was deleted
1728 .It d Ta file's deletion was prevented by local modifications
1729 .It A Ta new file was added
1730 .It \(a~ Ta changes destined for a non-regular file were not merged
1731 .It ? Ta changes destined for an unversioned file were not merged
1734 The merged changes will appear as local changes in the work tree, which
1737 amended manually or with further
1742 or discarded again with
1746 will refuse to run if certain preconditions are not met.
1747 If the work tree contains multiple base commits it must first be updated
1748 to a single base commit with
1750 If any relevant files already contain merge conflicts, these
1751 conflicts must be resolved first.
1753 .It Cm backout Ar commit
1755 Reverse-merge changes from a single
1760 should be on the same branch as the work tree's base commit.
1761 The expected argument is a reference or a commit ID SHA1 hash.
1762 An abbreviated hash argument will be expanded to a full SHA1 hash
1763 automatically, provided the abbreviation is unique.
1765 Show the status of each affected file, using the following status codes:
1766 .Bl -column YXZ description
1767 .It G Ta file was merged
1768 .It C Ta file was merged and conflicts occurred during merge
1769 .It ! Ta changes destined for a missing file were not merged
1770 .It D Ta file was deleted
1771 .It d Ta file's deletion was prevented by local modifications
1772 .It A Ta new file was added
1773 .It \(a~ Ta changes destined for a non-regular file were not merged
1774 .It ? Ta changes destined for an unversioned file were not merged
1777 The reverse-merged changes will appear as local changes in the work tree,
1778 which may be viewed with
1780 amended manually or with further
1785 or discarded again with
1789 will refuse to run if certain preconditions are not met.
1790 If the work tree contains multiple base commits it must first be updated
1791 to a single base commit with
1793 If any relevant files already contain merge conflicts, these
1794 conflicts must be resolved first.
1796 .It Cm rebase Oo Fl a Oc Oo Fl c Oc Oo Fl l Oc Oo Fl X Oc Op Ar branch
1798 Rebase commits on the specified
1800 onto the tip of the current branch of the work tree.
1803 must share common ancestry with the work tree's current branch.
1804 Rebasing begins with the first descendant commit of the youngest
1805 common ancestor commit shared by the specified
1807 and the work tree's current branch, and stops once the tip commit
1814 is used as intended, the specified
1816 represents a local commit history and may already contain changes
1817 that are not yet visible in any other repositories.
1818 The work tree's current branch, which must be set with
1822 operation, represents a branch from a remote repository which shares
1823 a common history with the specified
1825 but has progressed, and perhaps diverged, due to commits added to the
1828 Rebased commits are accumulated on a temporary branch which the work tree
1829 will remain switched to throughout the entire rebase operation.
1830 Commits on this branch represent the same changes with the same log
1831 messages as their counterparts on the original
1833 but with different commit IDs.
1834 Once rebasing has completed successfully, the temporary branch becomes
1835 the new version of the specified
1837 and the work tree is automatically switched to it.
1839 Old commits in their pre-rebase state are automatically backed up in the
1840 .Dq refs/got/backup/rebase
1841 reference namespace.
1842 As long as these references are not removed older versions of rebased
1843 commits will remain in the repository and can be viewed with the
1846 Removal of these references makes objects which become unreachable via
1847 any reference subject to removal by Git's garbage collector or
1848 .Cm gotadmin cleanup .
1850 While rebasing commits, show the status of each affected file,
1851 using the following status codes:
1852 .Bl -column YXZ description
1853 .It G Ta file was merged
1854 .It C Ta file was merged and conflicts occurred during merge
1855 .It ! Ta changes destined for a missing file were not merged
1856 .It D Ta file was deleted
1857 .It d Ta file's deletion was prevented by local modifications
1858 .It A Ta new file was added
1859 .It \(a~ Ta changes destined for a non-regular file were not merged
1860 .It ? Ta changes destined for an unversioned file were not merged
1863 If merge conflicts occur the rebase operation is interrupted and may
1864 be continued once conflicts have been resolved.
1865 If any files with destined changes are found to be missing or unversioned,
1866 or if files could not be deleted due to differences in deleted content,
1867 the rebase operation will be interrupted to prevent potentially incomplete
1868 changes from being committed to the repository without user intervention.
1869 The work tree may be modified as desired and the rebase operation can be
1870 continued once the changes present in the work tree are considered complete.
1871 Alternatively, the rebase operation may be aborted which will leave
1873 unmodified and the work tree switched back to its original branch.
1875 If a merge conflict is resolved in a way which renders the merged
1876 change into a no-op change, the corresponding commit will be elided
1877 when the rebase operation continues.
1880 will refuse to run if certain preconditions are not met.
1881 If the work tree is not yet fully updated to the tip commit of its
1882 branch then the work tree must first be updated with
1884 If changes have been staged with
1886 these changes must first be committed with
1890 If the work tree contains local changes, these changes must first be
1897 contains changes to files outside of the work tree's path prefix,
1898 the work tree cannot be used to rebase this branch.
1904 commands will refuse to run while a rebase operation is in progress.
1905 Other commands which manipulate the work tree may be used for
1906 conflict resolution purposes.
1910 is already based on the work tree's current branch then no commits
1911 need to be rebased and
1913 will simply switch the work tree to the specified
1915 and update files in the work tree accordingly.
1922 Abort an interrupted rebase operation.
1923 If this option is used, no other command-line arguments are allowed.
1925 Continue an interrupted rebase operation.
1926 If this option is used, no other command-line arguments are allowed.
1928 Show a list of past rebase operations, represented by references in the
1929 .Dq refs/got/backup/rebase
1930 reference namespace.
1932 Display the author, date, and log message of each backed up commit,
1933 the object ID of the corresponding post-rebase commit, and
1934 the object ID of their common ancestor commit.
1935 Given these object IDs,
1942 options can be used to examine the history of either version of the branch,
1947 option can be used to create a new branch from a pre-rebase state if desired.
1951 is specified, only show commits which at some point in time represented this
1953 Otherwise, list all backed up commits for any branches.
1955 If this option is used,
1957 does not require a work tree.
1958 None of the other options can be used together with
1961 Delete backups created by past rebase operations, represented by references
1963 .Dq refs/got/backup/rebase
1964 reference namespace.
1968 is specified, only delete backups which at some point in time represented
1970 Otherwise, delete all references found within
1971 .Dq refs/got/backup/rebase .
1973 Any commit, tree, tag, and blob objects belonging to deleted backups
1974 remain in the repository and may be removed separately with
1975 Git's garbage collector or
1976 .Cm gotadmin cleanup .
1978 If this option is used,
1980 does not require a work tree.
1981 None of the other options can be used together with
1985 .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl e Oc Oo Fl f Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc Oo Fl l Oc Oo Fl X Oc Op Ar branch
1987 Edit commit history between the work tree's current base commit and
1988 the tip commit of the work tree's current branch.
1992 operation the work tree's current branch must be set with
1994 to the branch which should be edited, unless this branch is already the
1995 current branch of the work tree.
1996 The tip of this branch represents the upper bound (inclusive) of commits
2001 Furthermore, the work tree's base commit
2004 to a point in this branch's commit history where editing should begin.
2005 This commit represents the lower bound (non-inclusive) of commits touched
2010 Editing of commit history is controlled via a
2012 which can be written in an editor based on a template, passed on the
2013 command line, or generated with the
2019 The format of the histedit script is line-based.
2020 Each line in the script begins with a command name, followed by
2021 whitespace and an argument.
2022 For most commands, the expected argument is a commit ID SHA1 hash.
2023 Any remaining text on the line is ignored.
2024 Lines which begin with the
2026 character are ignored entirely.
2028 The available commands are as follows:
2029 .Bl -column YXZ pick-commit
2030 .It pick Ar commit Ta Use the specified commit as it is.
2031 .It edit Ar commit Ta Use the specified commit but once changes have been
2032 merged into the work tree interrupt the histedit operation for amending.
2033 .It fold Ar commit Ta Combine the specified commit with the next commit
2034 listed further below that will be used.
2035 .It drop Ar commit Ta Remove this commit from the edited history.
2036 .It mesg Ar log-message Ta Use the specified single-line log message for
2037 the commit on the previous line.
2038 If the log message argument is left empty, open an editor where a new
2039 log message can be written.
2042 Every commit in the history being edited must be mentioned in the script.
2043 Lines may be re-ordered to change the order of commits in the edited history.
2044 No commit may be listed more than once.
2046 Edited commits are accumulated on a temporary branch which the work tree
2047 will remain switched to throughout the entire histedit operation.
2048 Once history editing has completed successfully, the temporary branch becomes
2049 the new version of the work tree's branch and the work tree is automatically
2052 Old commits in their pre-histedit state are automatically backed up in the
2053 .Dq refs/got/backup/histedit
2054 reference namespace.
2055 As long as these references are not removed older versions of edited
2056 commits will remain in the repository and can be viewed with the
2059 Removal of these references makes objects which become unreachable via
2060 any reference subject to removal by Git's garbage collector or
2061 .Cm gotadmin cleanup .
2063 While merging commits, show the status of each affected file,
2064 using the following status codes:
2065 .Bl -column YXZ description
2066 .It G Ta file was merged
2067 .It C Ta file was merged and conflicts occurred during merge
2068 .It ! Ta changes destined for a missing file were not merged
2069 .It D Ta file was deleted
2070 .It d Ta file's deletion was prevented by local modifications
2071 .It A Ta new file was added
2072 .It \(a~ Ta changes destined for a non-regular file were not merged
2073 .It ? Ta changes destined for an unversioned file were not merged
2076 If merge conflicts occur the histedit operation is interrupted and may
2077 be continued once conflicts have been resolved.
2078 If any files with destined changes are found to be missing or unversioned,
2079 or if files could not be deleted due to differences in deleted content,
2080 the histedit operation will be interrupted to prevent potentially incomplete
2081 changes from being committed to the repository without user intervention.
2082 The work tree may be modified as desired and the histedit operation can be
2083 continued once the changes present in the work tree are considered complete.
2084 Alternatively, the histedit operation may be aborted which will leave
2085 the work tree switched back to its original branch.
2087 If a merge conflict is resolved in a way which renders the merged
2088 change into a no-op change, the corresponding commit will be elided
2089 when the histedit operation continues.
2092 will refuse to run if certain preconditions are not met.
2093 If the work tree's current branch is not in the
2095 reference namespace, the history of the branch may not be edited.
2096 If the work tree contains multiple base commits it must first be updated
2097 to a single base commit with
2099 If changes have been staged with
2101 these changes must first be committed with
2105 If the work tree contains local changes, these changes must first be
2110 If the edited history contains changes to files outside of the work tree's
2111 path prefix, the work tree cannot be used to edit the history of this branch.
2118 commands will refuse to run while a histedit operation is in progress.
2119 Other commands which manipulate the work tree may be used, and the
2121 command may be used to commit arbitrary changes to the temporary branch
2122 while the histedit operation is interrupted.
2129 Abort an interrupted histedit operation.
2130 If this option is used, no other command-line arguments are allowed.
2132 Continue an interrupted histedit operation.
2133 If this option is used, no other command-line arguments are allowed.
2135 Interrupt the histedit operation for editing after merging each commit.
2136 This option is a quick equivalent to a histedit script which uses the
2138 command for all commits.
2141 option can only be used when starting a new histedit operation.
2142 If this option is used, no other command-line arguments are allowed.
2144 Fold all commits into a single commit.
2145 This option is a quick equivalent to a histedit script which folds all
2146 commits, combining them all into one commit.
2149 option can only be used when starting a new histedit operation.
2150 If this option is used, no other command-line arguments are allowed.
2151 .It Fl F Ar histedit-script
2154 instead of opening a temporary file in an editor where a histedit script
2157 Edit log messages only.
2158 This option is a quick equivalent to a histedit script which edits
2159 only log messages but otherwise leaves every picked commit as-is.
2162 option can only be used when starting a new histedit operation.
2163 If this option is used, no other command-line arguments are allowed.
2165 Show a list of past histedit operations, represented by references in the
2166 .Dq refs/got/backup/histedit
2167 reference namespace.
2169 Display the author, date, and log message of each backed up commit,
2170 the object ID of the corresponding post-histedit commit, and
2171 the object ID of their common ancestor commit.
2172 Given these object IDs,
2179 options can be used to examine the history of either version of the branch,
2184 option can be used to create a new branch from a pre-histedit state if desired.
2188 is specified, only show commits which at some point in time represented this
2190 Otherwise, list all backed up commits for any branches.
2192 If this option is used,
2194 does not require a work tree.
2195 None of the other options can be used together with
2198 Delete backups created by past histedit operations, represented by references
2200 .Dq refs/got/backup/histedit
2201 reference namespace.
2205 is specified, only delete backups which at some point in time represented
2207 Otherwise, delete all references found within
2208 .Dq refs/got/backup/histedit .
2210 Any commit, tree, tag, and blob objects belonging to deleted backups
2211 remain in the repository and may be removed separately with
2212 Git's garbage collector or
2213 .Cm gotadmin cleanup .
2215 If this option is used,
2217 does not require a work tree.
2218 None of the other options can be used together with
2222 .It Cm integrate Ar branch
2224 Integrate the specified
2226 into the work tree's current branch.
2227 Files in the work tree are updated to match the contents on the integrated
2229 and the reference of the work tree's branch is changed to point at the
2230 head commit of the integrated
2233 Both branches can be considered equivalent after integration since they
2234 will be pointing at the same commit.
2235 Both branches remain available for future work, if desired.
2236 In case the integrated
2238 is no longer needed it may be deleted with
2241 Show the status of each affected file, using the following status codes:
2242 .Bl -column YXZ description
2243 .It U Ta file was updated
2244 .It D Ta file was deleted
2245 .It A Ta new file was added
2246 .It \(a~ Ta versioned file is obstructed by a non-regular file
2247 .It ! Ta a missing versioned file was restored
2251 will refuse to run if certain preconditions are not met.
2252 Most importantly, the
2254 must have been rebased onto the work tree's current branch with
2256 before it can be integrated, in order to linearize commit history and
2257 resolve merge conflicts.
2258 If the work tree contains multiple base commits it must first be updated
2259 to a single base commit with
2261 If changes have been staged with
2263 these changes must first be committed with
2267 If the work tree contains local changes, these changes must first be
2273 .It Cm merge Oo Fl a Oc Oo Fl c Oc Oo Fl n Oc Op Ar branch
2275 Create a merge commit based on the current branch of the work tree and
2278 If a linear project history is desired, then use of
2280 should be preferred over
2282 However, even strictly linear projects may require merge commits in order
2283 to merge in new versions of third-party code stored on vendor branches
2287 Merge commits are commits based on multiple parent commits.
2288 The tip commit of the work tree's current branch, which must be set with
2292 operation, will be used as the first parent.
2293 The tip commit of the specified
2295 will be used as the second parent.
2297 No ancestral relationship between the two branches is required.
2298 If the two branches have already been merged previously, only new changes
2301 It is not possible to create merge commits with more than two parents.
2302 If more than one branch needs to be merged, then multiple merge commits
2303 with two parents each can be created in sequence.
2305 While merging changes found on the
2307 into the work tree, show the status of each affected file,
2308 using the following status codes:
2309 .Bl -column YXZ description
2310 .It G Ta file was merged
2311 .It C Ta file was merged and conflicts occurred during merge
2312 .It ! Ta changes destined for a missing file were not merged
2313 .It D Ta file was deleted
2314 .It d Ta file's deletion was prevented by local modifications
2315 .It A Ta new file was added
2316 .It \(a~ Ta changes destined for a non-regular file were not merged
2317 .It ? Ta changes destined for an unversioned file were not merged
2320 If merge conflicts occur, the merge operation is interrupted and conflicts
2321 must be resolved before the merge operation can continue.
2322 If any files with destined changes are found to be missing or unversioned,
2323 or if files could not be deleted due to differences in deleted content,
2324 the merge operation will be interrupted to prevent potentially incomplete
2325 changes from being committed to the repository without user intervention.
2326 The work tree may be modified as desired and the merge can be continued
2327 once the changes present in the work tree are considered complete.
2328 Alternatively, the merge operation may be aborted which will leave
2329 the work tree's current branch unmodified.
2331 If a merge conflict is resolved in a way which renders all merged
2332 changes into no-op changes, the merge operation cannot continue
2333 and must be aborted.
2336 will refuse to run if certain preconditions are not met.
2339 is based on the work tree's current branch, then no merge commit can
2342 may be used to integrate the
2345 If the work tree is not yet fully updated to the tip commit of its
2346 branch, then the work tree must first be updated with
2348 If the work tree contains multiple base commits it must first be updated
2349 to a single base commit with
2351 If changes have been staged with
2353 these changes must first be committed with
2357 If the work tree contains local changes, these changes must first be
2364 contains changes to files outside of the work tree's path prefix,
2365 the work tree cannot be used to merge this branch.
2375 commands will refuse to run while a merge operation is in progress.
2376 Other commands which manipulate the work tree may be used for
2377 conflict resolution purposes.
2384 Abort an interrupted merge operation.
2385 If this option is used, no other command-line arguments are allowed.
2387 Continue an interrupted merge operation.
2388 If this option is used, no other command-line arguments are allowed.
2390 Merge changes into the work tree as usual but do not create a merge
2392 The merge result can be adjusted as desired before a merge commit is
2395 Alternatively, the merge may be aborted with
2399 .It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl S Oc Op Ar path ...
2401 Stage local changes for inclusion in the next commit.
2404 is specified, stage all changes in the work tree.
2405 Otherwise, stage changes at or within the specified paths.
2406 Paths may be staged if they are added, modified, or deleted according to
2409 Show the status of each affected file, using the following status codes:
2410 .Bl -column YXZ description
2411 .It A Ta file addition has been staged
2412 .It M Ta file modification has been staged
2413 .It D Ta file deletion has been staged
2416 Staged file contents are saved in newly created blob objects in the repository.
2417 These blobs will be referred to by tree objects once staged changes have been
2420 Staged changes affect the behaviour of
2425 While paths with staged changes exist, the
2427 command will refuse to commit any paths which do not have staged changes.
2428 Local changes created on top of staged changes can only be committed if
2429 the path is staged again, or if the staged changes are committed first.
2432 command will show both local changes and staged changes.
2435 command is able to display local changes relative to staged changes,
2436 and to display staged changes relative to the repository.
2439 command cannot revert staged changes but may be used to revert
2440 local changes created on top of staged changes.
2447 Instead of staging new changes, list paths which are already staged,
2448 along with the IDs of staged blob objects and stage status codes.
2449 If paths were provided in the command line show the staged paths
2450 among the specified paths.
2451 Otherwise, show all staged paths.
2453 Instead of staging the entire content of a changed file, interactively
2454 select or reject changes for staging based on
2458 (reject change), and
2460 (quit staging this file) responses.
2461 If a file is in modified status, individual patches derived from the
2462 modified file content can be staged.
2463 Files in added or deleted status may only be staged or rejected in
2465 .It Fl F Ar response-script
2473 responses line-by-line from the specified
2475 file instead of prompting interactively.
2477 Allow staging of symbolic links which point outside of the path space
2478 that is under version control.
2481 will reject such symbolic links due to safety concerns.
2484 may decide to represent such a symbolic link as a regular file which contains
2485 the link's target path, rather than creating an actual symbolic link which
2486 points outside of the work tree.
2487 Use of this option is discouraged because external mechanisms such as
2489 are better suited for managing symbolic links to paths not under
2494 will refuse to run if certain preconditions are not met.
2495 If a file contains merge conflicts, these conflicts must be resolved first.
2496 If a file is found to be out of date relative to the head commit on the
2497 work tree's current branch, the file must be updated with
2499 before it can be staged (however, this does not prevent the file from
2500 becoming out-of-date at some point after having been staged).
2507 commands will refuse to run while staged changes exist.
2508 If staged changes cannot be committed because a staged path
2509 is out of date, the path must be unstaged with
2511 before it can be updated with
2513 and may then be staged again if necessary.
2515 .It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
2517 Merge staged changes back into the work tree and put affected paths
2518 back into non-staged status.
2521 is specified, unstage all staged changes across the entire work tree.
2522 Otherwise, unstage changes at or within the specified paths.
2524 Show the status of each affected file, using the following status codes:
2525 .Bl -column YXZ description
2526 .It G Ta file was unstaged
2527 .It C Ta file was unstaged and conflicts occurred during merge
2528 .It ! Ta changes destined for a missing file were not merged
2529 .It D Ta file was staged as deleted and still is deleted
2530 .It d Ta file's deletion was prevented by local modifications
2531 .It \(a~ Ta changes destined for a non-regular file were not merged
2539 Instead of unstaging the entire content of a changed file, interactively
2540 select or reject changes for unstaging based on
2544 (keep change staged), and
2546 (quit unstaging this file) responses.
2547 If a file is staged in modified status, individual patches derived from the
2548 staged file content can be unstaged.
2549 Files staged in added or deleted status may only be unstaged in their entirety.
2550 .It Fl F Ar response-script
2558 responses line-by-line from the specified
2560 file instead of prompting interactively.
2562 .It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
2563 Parse and print contents of objects to standard output in a line-based
2565 Content of commit, tree, and tag objects is printed in a way similar
2566 to the actual content stored in such objects.
2567 Blob object contents are printed as they would appear in files on disk.
2569 Attempt to interpret each argument as a reference, a tag name, or
2570 an object ID SHA1 hash.
2571 References will be resolved to an object ID.
2572 Tag names will resolved to a tag object.
2573 An abbreviated hash argument will be expanded to a full SHA1 hash
2574 automatically, provided the abbreviation is unique.
2576 If none of the above interpretations produce a valid result, or if the
2578 option is used, attempt to interpret the argument as a path which will
2579 be resolved to the ID of an object found at this path in the repository.
2586 Look up paths in the specified
2588 If this option is not used, paths are looked up in the commit resolved
2589 via the repository's HEAD reference.
2590 The expected argument is a commit ID SHA1 hash or an existing reference
2591 or tag name which will be resolved to a commit ID.
2592 An abbreviated hash argument will be expanded to a full SHA1 hash
2593 automatically, provided the abbreviation is unique.
2594 .It Fl r Ar repository-path
2595 Use the repository at the specified path.
2596 If not specified, assume the repository is located at or above the current
2598 If this directory is a
2600 work tree, use the repository path associated with this work tree.
2602 Interpret all arguments as paths only.
2603 This option can be used to resolve ambiguity in cases where paths
2604 look like tag names, reference names, or object IDs.
2606 .It Cm info Op Ar path ...
2607 Display meta-data stored in a work tree.
2612 The work tree to use is resolved implicitly by walking upwards from the
2613 current working directory.
2617 arguments are specified, show additional per-file information for tracked
2618 files located at or within these paths.
2621 argument corresponds to the work tree's root directory, display information
2622 for all tracked files.
2625 .Bl -tag -width GOT_AUTHOR
2627 The author's name and email address for
2632 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
2635 may fail to parse commits without an email address in author data,
2639 environment variables with a missing email address.
2641 .Ev GOT_AUTHOR will be overridden by configuration settings in
2647 configuration settings in the repository's
2654 configuration settings contained in Git's global
2656 configuration file will only be used if neither
2660 environment variable provide author information.
2661 .It Ev VISUAL , EDITOR
2662 The editor spawned by
2670 text editor will be spawned in order to give
2672 the attention it deserves.
2673 .It Ev GOT_LOG_DEFAULT_LIMIT
2674 The default limit on the number of commits traversed by
2676 If set to zero, the limit is unbounded.
2677 This variable will be silently ignored if it is set to a non-numeric value.
2680 .Bl -tag -width packed-refs -compact
2682 Repository-wide configuration settings for
2686 configuration file located in the root directory of a Git repository
2687 supersedes any relevant settings in Git's
2691 .It Pa .got/got.conf
2692 Worktree-specific configuration settings for
2696 configuration file in the
2698 meta-data directory of a work tree supersedes any relevant settings in
2701 configuration file and Git's
2708 Enable tab-completion of
2713 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
2715 Clone an existing Git repository for use with
2719 .Dl $ got clone ssh://git@github.com/openbsd/src.git
2721 Use of HTTP URLs currently requires
2725 .Dl $ git clone --bare https://github.com/openbsd/src.git
2727 Alternatively, for quick and dirty local testing of
2729 a new Git repository could be created and populated with files,
2730 e.g. from a temporary CVS checkout located at
2733 .Dl $ got init /var/git/src.git
2734 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
2736 Check out a work tree from the Git repository to /usr/src:
2738 .Dl $ got checkout /var/git/src.git /usr/src
2740 View local changes in a work tree directory:
2742 .Dl $ got diff | less
2744 In a work tree, display files in a potentially problematic state:
2746 .Dl $ got status -s 'C!~?'
2748 Interactively revert selected local changes in a work tree directory:
2750 .Dl $ got revert -p -R\ .
2752 In a work tree or a git repository directory, list all branch references:
2756 In a work tree or a git repository directory, create a new branch called
2757 .Dq unified-buffer-cache
2758 which is forked off the
2762 .Dl $ got branch -c master unified-buffer-cache
2764 Switch an existing work tree to the branch
2765 .Dq unified-buffer-cache .
2766 Local changes in the work tree will be preserved and merged if necessary:
2768 .Dl $ got update -b unified-buffer-cache
2770 Create a new commit from local changes in a work tree directory.
2771 This new commit will become the head commit of the work tree's current branch:
2775 In a work tree or a git repository directory, view changes committed in
2776 the 3 most recent commits to the work tree's branch, or the branch resolved
2777 via the repository's HEAD reference, respectively:
2779 .Dl $ got log -p -l 3
2781 As above, but display changes in the order in which
2783 could apply them in sequence:
2785 .Dl $ got log -p -l 3 -R
2787 In a work tree or a git repository directory, log the history of a subdirectory:
2789 .Dl $ got log sys/uvm
2791 While operating inside a work tree, paths are specified relative to the current
2792 working directory, so this command will log the subdirectory
2795 .Dl $ cd sys/uvm && got log\ .
2797 And this command has the same effect:
2799 .Dl $ cd sys/dev/usb && got log ../../uvm
2801 And this command displays work tree meta-data about all tracked files:
2804 .Dl $ got info\ . | less
2806 Add new files and remove obsolete files in a work tree directory:
2808 .Dl $ got add sys/uvm/uvm_ubc.c
2809 .Dl $ got remove sys/uvm/uvm_vnode.c
2811 Create a new commit from local changes in a work tree directory
2812 with a pre-defined log message.
2814 .Dl $ got commit -m 'unify the buffer cache'
2816 Alternatively, create a new commit from local changes in a work tree
2817 directory with a log message that has been prepared in the file
2820 .Dl $ got commit -F /tmp/msg
2822 Update any work tree checked out from the
2823 .Dq unified-buffer-cache
2824 branch to the latest commit on this branch:
2828 Roll file content on the unified-buffer-cache branch back by one commit,
2829 and then fetch the rolled-back change into the work tree as a local change
2830 to be amended and perhaps committed again:
2832 .Dl $ got backout unified-buffer-cache
2833 .Dl $ got commit -m 'roll back previous'
2834 .Dl $ # now back out the previous backout :-)
2835 .Dl $ got backout unified-buffer-cache
2837 Fetch new changes on the remote repository's
2839 branch, making them visible on the local repository's
2846 In a repository created with a HTTP URL and
2847 .Cm git clone --bare
2850 command must be used instead:
2852 .Dl $ cd /var/git/src.git
2853 .Dl $ git fetch origin master:refs/remotes/origin/master
2857 branch to merge the new changes that are now visible on the
2862 .Dl $ got update -b origin/master
2863 .Dl $ got rebase master
2866 .Dq unified-buffer-cache
2867 branch on top of the new head commit of the
2871 .Dl $ got update -b master
2872 .Dl $ got rebase unified-buffer-cache
2874 Create a patch from all changes on the unified-buffer-cache branch.
2875 The patch can be mailed out for review and applied to
2879 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
2881 Edit the entire commit history of the
2882 .Dq unified-buffer-cache
2885 .Dl $ got update -b unified-buffer-cache
2886 .Dl $ got update -c master
2889 Before working against existing branches in a repository cloned with
2890 .Cm git clone --bare
2895 must be configured to map all references in the remote repository
2898 namespace of the local repository.
2899 This can be achieved by setting Git's
2900 .Pa remote.origin.fetch
2901 configuration variable to the value
2902 .Dq +refs/heads/*:refs/remotes/origin/*
2907 .Dl $ cd /var/git/repo
2908 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
2912 option must be disabled:
2914 .Dl $ cd /var/git/repo
2915 .Dl $ git config remote.origin.mirror false
2917 Alternatively, the following
2919 configuration item can be added manually to the Git repository's
2923 .Dl [remote \&"origin\&"]
2925 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
2928 This configuration leaves the local repository's
2930 namespace free for use by local branches checked out with
2932 and, if needed, created with
2935 .Dq refs/remotes/origin
2936 namespace can now be updated with incoming changes from the remote
2941 without extra command line arguments.
2942 Newly fetched changes can be examined with
2945 Display changes on the remote repository's version of the
2947 branch, as of the last time
2951 .Dl $ got log -c origin/master | less
2953 As shown here, most commands accept abbreviated reference names such as
2956 .Dq refs/remotes/origin/master .
2957 The latter is only needed in case of ambiguity.
2960 must be used to merge changes which are visible on the
2965 This will also merge local changes, if any, with the incoming changes:
2967 .Dl $ got update -b origin/master
2968 .Dl $ got rebase master
2970 In order to make changes committed to the
2971 .Dq unified-buffer-cache
2975 .Dq unified-buffer-cache
2976 branch must first be rebased onto the
2980 .Dl $ got update -b master
2981 .Dl $ got rebase unified-buffer-cache
2984 .Dq unified-buffer-cache
2985 branch can now be made visible on the
2989 Because the rebase operation switched the work tree to the
2990 .Dq unified-buffer-cache
2991 branch the work tree must be switched back to the
2995 .Dl $ got update -b master
2996 .Dl $ got integrate unified-buffer-cache
3000 branch, log messages for local changes can now be amended with
3002 by other developers and any other important new information:
3004 .Dl $ got update -c origin/master
3005 .Dl $ got histedit -m
3007 If the remote repository offers write access local changes on the
3009 branch can be sent to the remote repository with
3013 can be run without further arguments.
3014 The arguments shown here match defaults, provided the work tree's
3015 current branch is the
3019 .Dl $ got send -b master origin
3021 If the remote repository requires the HTTPS protocol the
3023 command must be used instead:
3025 .Dl $ cd /var/git/src.git
3026 .Dl $ git push origin master
3030 .Xr git-repository 5 ,
3031 .Xr got-worktree 5 ,
3034 .An Stefan Sperling Aq Mt stsp@openbsd.org
3035 .An Martin Pieuchot Aq Mt mpi@openbsd.org
3036 .An Joshua Stein Aq Mt jcs@openbsd.org
3037 .An Ori Bernstein Aq Mt ori@openbsd.org
3040 is a work-in-progress and some features remain to be implemented.
3042 At present, the user has to fall back on
3044 to perform some tasks.
3048 Reading from remote repositories over HTTP or HTTPS protocols requires
3053 Writing to remote repositories over HTTP or HTTPS protocols requires
3056 The creation of merge commits with more than two parent commits requires
3059 In situations where files or directories were moved around
3061 will not automatically merge changes to new locations and
3063 will usually produce better results.