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.
22 .Nd CVS-like Git client
30 is a Git-compatible version control system with a user interface
35 supports local and remote Git repositories.
36 The Git repository format is described in
37 .Xr git-repository 5 .
41 must be checked out from the repository for modification.
42 Checked out files are stored in a
44 which can be placed at an arbitrary directory in the filesystem hierarchy.
45 The on-disk format of this work tree is described in
49 provides global and command-specific options.
50 Global options must precede the command name, and are as follows:
51 .Bl -tag -width tenletters
53 Display usage information and exit immediately.
55 Display program version and exit immediately.
61 .Bl -tag -width checkout
68 .Op Fl r Ar repository-path
72 Create an initial commit in a repository from the file hierarchy
75 The created commit will not have any parent commits, i.e. it will be a
77 Also create a new reference which provides a branch name for the newly
79 Show the path of each imported file to indicate progress.
85 environment variable to be set,
86 unless an author has been configured in
92 configuration settings can be obtained from the repository's
94 file or from Git's global
105 If this option is not specified, a branch corresponding to the repository's
106 HEAD reference will be used.
107 Use of this option is required if the branch resolved via the repository's
108 HEAD reference already exists.
110 Ignore files or directories with a name which matches the specified
112 This option may be specified multiple times to build a list of ignore patterns.
115 follows the globbing rules documented in
117 Ignore patterns which end with a slash,
119 will only match directories.
121 Use the specified log message when creating the new commit.
126 opens a temporary file in an editor where a log message can be written.
127 Quitting the editor without saving the file will abort the import operation.
128 .It Fl r Ar repository-path
129 Use the repository at the specified path.
130 If not specified, assume the repository is located at or above the current
139 .Op Fl R Ar reference
144 Clone a Git repository at the specified
150 is specified, the directory name will be derived from the name of the
153 will refuse to run if the
159 specifies a protocol scheme, a server hostname, an optional port number
160 separated from the hostname by a colon, and a path to the repository on
162 .Lk scheme://hostname:port/path/to/repository
164 The following protocol schemes are supported:
165 .Bl -tag -width git+ssh
167 The Git protocol as implemented by the
170 Use of this protocol is discouraged since it supports neither authentication
173 The Git protocol wrapped in an authenticated and encrypted
176 With this protocol the hostname may contain an embedded username for
181 Short alias for git+ssh.
184 Objects in the cloned repository are stored in a pack file which is downloaded
186 This pack file will then be indexed to facilitate access to the objects stored
188 If any objects in the pack file are stored in deltified form, all deltas will
189 be fully resolved in order to compute the ID of such objects.
190 This can take some time.
191 More details about the pack file format are documented in
192 .Xr git-repository 5 .
195 creates a remote repository entry in the
199 files of the cloned repository to store the
205 arguments for future use by
215 Fetch all branches from the remote repository's
217 reference namespace and set
218 .Cm fetch_all_branches
219 in the cloned repository's
221 file for future use by
223 If this option is not specified, a branch resolved via the remote
224 repository's HEAD reference will be fetched.
225 Cannot be used together with the
231 from the remote repository's
234 This option may be specified multiple times to build a list of branches
236 If the branch corresponding to the remote repository's HEAD reference is not
237 in this list, the cloned repository's HEAD reference will be set to the first
238 branch which was fetched.
239 If this option is not specified, a branch resolved via the remote
240 repository's HEAD reference will be fetched.
241 Cannot be used together with the
247 to use with SSH connections.
248 The same option will be passed to
251 List branches and tags available for fetching from the remote repository
252 and exit immediately.
253 Cannot be used together with any of the other options except
258 Create the cloned repository as a mirror of the original repository.
259 This is useful if the cloned repository will not be used to store
260 locally created commits.
266 files will be set up with the
268 option enabled, such that
272 will write incoming changes directly to branches in the
274 reference namespace, rather than to branches in the
277 This avoids the usual requirement of having to run
283 in order to make incoming changes appear on branches in the
286 But maintaining custom changes in the cloned repository becomes difficult
287 since such changes will be at risk of being discarded whenever incoming
290 Suppress progress reporting output.
291 The same option will be passed to
294 .It Fl R Ar reference
295 In addition to the branches and tags that will be fetched, fetch an arbitrary
297 from the remote repository's
300 This option may be specified multiple times to build a list of additional
304 may either be a path to a specific reference, or a reference namespace
305 which will cause all references in this namespace to be fetched.
307 Each reference will be mapped into the cloned repository's
309 namespace, unless the
311 option is used to mirror references directly into the cloned repository's
316 will refuse to fetch references from the remote repository's
325 to print debugging messages to standard error output.
326 This option will be passed to
329 Multiple -v options increase the verbosity.
338 .Op Fl p Ar path-prefix
340 .Op Ar work-tree-path
343 Copy files from a repository into a new work tree.
344 Show the status of each affected file, using the following status codes:
345 .Bl -column YXZ description
346 .It A Ta new file was added
347 .It E Ta file already exists in work tree's meta-data
352 is not specified, either use the last component of
353 .Ar repository path ,
356 was specified use the last component of
364 Check out files from a commit on the specified
366 If this option is not specified, a branch resolved via the repository's HEAD
367 reference will be used.
369 Check out files from the specified
371 on the selected branch.
372 The expected argument is a commit ID or an existing reference
373 or tag name which will be resolved to a commit ID.
374 An abbreviated hash argument will be expanded to a commit ID
375 automatically, provided the abbreviation is unique.
376 If this option is not specified, the most recent commit on the selected
381 is not contained in the selected branch, a different branch which contains
382 this commit must be specified with the
385 If no such branch is known, a new branch must be created for this
391 Checking out work trees with an unknown branch is intentionally not supported.
393 Proceed with the checkout operation even if the directory at
396 Existing files will be left intact.
397 .It Fl p Ar path-prefix
398 Restrict the work tree to a subset of the repository's tree hierarchy.
399 Only files beneath the specified
403 Silence progress output.
415 Update an existing work tree to a different
417 Change existing files in the work tree as necessary to match file contents
419 Preserve any local changes in the work tree and merge them with the
422 Files which already contain merge conflicts will not be updated to avoid
423 further complications.
424 Such files will be updated when
426 is run again after merge conflicts have been resolved.
427 If the conflicting changes are no longer needed, affected files can be
434 Show the status of each affected file, using the following status codes:
435 .Bl -column YXZ description
436 .It U Ta file was updated and contained no local changes
437 .It G Ta file was updated and local changes were merged cleanly
438 .It C Ta file was updated and conflicts occurred during merge
439 .It D Ta file was deleted
440 .It d Ta file's deletion was prevented by local modifications
441 .It A Ta new file was added
442 .It \(a~ Ta versioned file is obstructed by a non-regular file
443 .It ! Ta a missing versioned file was restored
444 .It # Ta file was not updated because it contains merge conflicts
445 .It ? Ta changes destined for an unversioned file were not merged
450 is specified, update the entire work tree.
451 Otherwise, restrict the update operation to files at or within the
453 Each path is required to exist in the update operation's target commit.
454 Files in the work tree outside specified paths will remain unchanged and
455 will retain their previously recorded base commit.
458 commands may refuse to run while the work tree contains files from
459 multiple base commits.
460 The base commit of such a work tree can be made consistent by running
462 across the entire work tree.
465 is incompatible with the
470 cannot update paths with staged changes.
471 If changes have been staged with
473 these changes must first be committed with
483 Switch the work tree's branch reference to the specified
485 before updating the work tree.
486 This option requires that all paths in the work tree are updated.
488 As usual, any local changes in the work tree will be preserved.
489 This can be useful when switching to a newly created branch in order
490 to commit existing local changes to this branch.
492 Any local changes must be dealt with separately in order to obtain a
493 work tree with pristine file contents corresponding exactly to the specified
495 Such changes could first be committed to a different branch with
497 or could be discarded with
500 Update the work tree to the specified
502 The expected argument is a commit ID or an existing reference
503 or tag name which will be resolved to a commit ID.
504 An abbreviated hash argument will be expanded to a commit ID
505 automatically, provided the abbreviation is unique.
506 If this option is not specified, the most recent commit on the work tree's
511 to use with SSH connections.
512 The same option will be passed to
515 Silence progress output.
521 .Op Fl S Ar status-codes
522 .Op Fl s Ar status-codes
526 Show the current modification status of files in a work tree,
527 using the following status codes:
528 .Bl -column YXZ description
529 .It M Ta modified file
530 .It A Ta file scheduled for addition in next commit
531 .It D Ta file scheduled for deletion in next commit
532 .It C Ta modified or added file which contains merge conflicts
533 .It ! Ta versioned file was expected on disk but is missing
534 .It \(a~ Ta versioned file is obstructed by a non-regular file
535 .It ? Ta unversioned item not tracked by
537 .It m Ta modified file modes (executable bit only)
538 .It N Ta non-existent
540 specified on the command line
545 is specified, show modifications in the entire work tree.
546 Otherwise, show modifications at or within the specified paths.
548 If changes have been staged with
550 staged changes are shown in the second output column, using the following
552 .Bl -column YXZ description
553 .It M Ta file modification is staged
554 .It A Ta file addition is staged
555 .It D Ta file deletion is staged
558 Changes created on top of staged changes are indicated in the first column:
559 .Bl -column YXZ description
560 .It MM Ta file was modified after earlier changes have been staged
561 .It MA Ta file was modified after having been staged for addition
569 Show unversioned files even if they match an ignore pattern.
570 .It Fl S Ar status-codes
571 Suppress the output of files with a modification status matching any of the
572 single-character status codes contained in the
575 Any combination of codes from the above list of possible status codes
577 For staged files, status codes displayed in either column will be matched.
578 Cannot be used together with the
581 .It Fl s Ar status-codes
582 Only show files with a modification status matching any of the
583 single-character status codes contained in the
586 Any combination of codes from the above list of possible status codes
588 For staged files, status codes displayed in either column will be matched.
589 Cannot be used together with the
594 For compatibility with
605 files in each traversed directory and will not display unversioned files
606 which match these patterns.
607 Ignore patterns which end with a slash,
609 will only match directories.
614 supports consecutive asterisks,
616 which will match an arbitrary amount of directories.
620 only supports a single ignore pattern per line.
624 does not support negated ignore patterns prefixed with
626 and gives no special significance to the location of path component separators,
635 .Op Fl r Ar repository-path
636 .Op Fl S Ar search-pattern
640 Display history of a repository.
643 is specified, show only commits which modified this path.
644 If invoked in a work tree, the
646 is interpreted relative to the current working directory,
647 and the work tree's path prefix is implicitly prepended.
648 Otherwise, the path is interpreted relative to the repository root.
655 Display individual commits which were merged into the current branch
659 shows the linear history of the current branch only.
661 Set the number of context lines shown in diffs with
663 By default, 3 lines of context are shown.
665 Start traversing history at the specified
667 The expected argument is a commit ID or an existing reference
668 or tag name which will be resolved to a commit ID.
669 An abbreviated hash argument will be expanded to a commit ID
670 automatically, provided the abbreviation is unique.
671 If this option is not specified, default to the work tree's current branch
672 if invoked in a work tree, or to the repository's HEAD reference.
674 Display diffstat of changes introduced in each commit.
675 Cannot be used with the
679 Limit history traversal to a given number of commits.
680 If this option is not specified, a default limit value of zero is used,
681 which is treated as an unbounded limit.
683 .Ev GOT_LOG_DEFAULT_LIMIT
684 environment variable may be set to change this default value.
686 Display the list of file paths changed in each commit, using the following
688 .Bl -column YXZ description
689 .It M Ta modified file
690 .It D Ta file was deleted
691 .It A Ta new file was added
692 .It m Ta modified file modes (executable bit only)
695 Cannot be used with the
699 Display the patch of modifications made in each commit.
702 is specified, only show the patch of modifications at or within this path.
703 Cannot be used with the
707 Determine a set of commits to display as usual, but display these commits
709 .It Fl r Ar repository-path
710 Use the repository at the specified path.
711 If not specified, assume the repository is located at or above the current
713 If this directory is a
715 work tree, use the repository path associated with this work tree.
716 .It Fl S Ar search-pattern
717 If specified, show only commits with a log message, author name,
718 committer name, or commit ID matched by the extended regular
721 Lines in committed patches will be matched if
724 File paths changed by a commit will be matched if
727 Regular expression syntax is documented in
730 Display a short one-line summary of each commit, instead of the default
732 Cannot be used together with the
738 Stop traversing commit history immediately after the specified
741 This option has no effect if the specified
751 .Op Fl r Ar repository-path
752 .Op Ar object1 Ar object2 | Ar path ...
755 When invoked within a work tree without any arguments, display all
756 local changes in the work tree.
759 arguments are specified, only show changes within the specified paths.
761 If two arguments are provided, treat each argument as a reference, a tag
762 name, or an object ID, and display differences between the
763 corresponding objects.
764 Both objects must be of the same type (blobs, trees, or commits).
765 An abbreviated hash argument will be expanded to a full commit ID
766 automatically, provided the abbreviation is unique.
767 If none of these interpretations produce a valid result or if the
772 is running in a work tree, attempt to interpret the two arguments as paths.
779 Treat file contents as ASCII text even if binary data is detected.
781 Set the number of context lines shown in the diff.
782 By default, 3 lines of context are shown.
784 Show differences between commits in the repository.
785 This option may be used up to two times.
786 When used only once, show differences between the specified
788 and its first parent commit.
789 When used twice, show differences between the two specified commits.
791 The expected argument is a commit ID or an existing reference
792 or tag name which will be resolved to a commit ID.
793 An abbreviated hash argument will be expanded to a commit ID
794 automatically, provided the abbreviation is unique.
798 option is used, all non-option arguments will be interpreted as paths.
801 arguments are provided, only show differences for the specified paths.
803 Cannot be used together with the
807 Display diffstat of changes before the actual diff by annotating each file path
808 or blob hash being diffed with the total number of lines added and removed.
809 A summary line will display the total number of changes across all files.
811 Interpret all arguments as paths only.
812 This option can be used to resolve ambiguity in cases where paths
813 look like tag names, reference names, or object IDs.
814 This option is only valid when
816 is invoked in a work tree.
817 .It Fl r Ar repository-path
818 Use the repository at the specified path.
819 If not specified, assume the repository is located at or above the current
821 If this directory is a
823 work tree, use the repository path associated with this work tree.
825 Show changes staged with
827 instead of showing local changes in the work tree.
828 This option is only valid when
830 is invoked in a work tree.
832 Ignore whitespace-only changes.
838 .Op Fl r Ar repository-path
842 Display line-by-line history of a file at the specified path.
849 Start traversing history at the specified
851 The expected argument is a commit ID or an existing reference
852 or tag name which will be resolved to a commit ID.
853 An abbreviated hash argument will be expanded to a commit ID
854 automatically, provided the abbreviation is unique.
855 .It Fl r Ar repository-path
856 Use the repository at the specified path.
857 If not specified, assume the repository is located at or above the current
859 If this directory is a
861 work tree, use the repository path associated with this work tree.
868 .Op Fl r Ar repository-path
872 Display a listing of files and directories at the specified
873 directory path in the repository.
874 Entries shown in this listing may carry one of the following trailing
876 .Bl -column YXZ description
877 .It @ Ta entry is a symbolic link
878 .It / Ta entry is a directory
879 .It * Ta entry is an executable file
880 .It $ Ta entry is a Git submodule
883 Symbolic link entries are also annotated with the target path of the link.
887 is specified, list the repository path corresponding to the current
888 directory of the work tree, or the root directory of the repository
889 if there is no work tree.
896 List files and directories as they appear in the specified
898 The expected argument is a commit ID or an existing reference
899 or tag name which will be resolved to a commit ID.
900 An abbreviated hash argument will be expanded to a commit ID
901 automatically, provided the abbreviation is unique.
903 Show object IDs of files (blob objects) and directories (tree objects).
905 Recurse into sub-directories in the repository.
906 .It Fl r Ar repository-path
907 Use the repository at the specified path.
908 If not specified, assume the repository is located at or above the current
910 If this directory is a
912 work tree, use the repository path associated with this work tree.
919 .Op Fl r Ar repository-path
920 .Op Fl s Ar signer-id
923 Manage tags in a repository.
925 Tags are managed via references which live in the
930 command operates on references in this namespace only.
931 References in this namespace point at tag objects which contain a pointer
932 to another object, a tag message, as well as author and timestamp information.
934 Attempt to create a tag with the given
936 and make this tag point at the given
938 If no commit is specified, default to the latest commit on the work tree's
939 current branch if invoked in a work tree, and to a commit resolved via
940 the repository's HEAD reference otherwise.
947 Make the newly created tag reference point at the specified
951 argument is a commit ID or an existing reference or tag name which
952 will be resolved to a commit ID.
953 An abbreviated hash argument will be expanded to a commit ID
954 automatically, provided the abbreviation is unique.
956 List all existing tags in the repository instead of creating a new tag.
959 argument is passed, show only the tag with the given
962 Use the specified tag message when creating the new tag.
967 opens a temporary file in an editor where a tag message can be written.
968 Quitting the editor without saving the file will abort the tag operation.
969 .It Fl r Ar repository-path
970 Use the repository at the specified path.
971 If not specified, assume the repository is located at or above the current
973 If this directory is a
975 work tree, use the repository path associated with this work tree.
976 .It Fl s Ar signer-id
977 While creating a new tag, sign this tag with the identity given in
980 For SSH-based signatures,
982 is the path to a file which may refer to either a private SSH key,
983 or a public SSH key with the private half available via
986 will sign the tag object by invoking
990 command, using the signature namespace
992 for compatibility with
995 Verify tag object signatures.
998 is specified, show and verify the tag object with the provided name.
999 Otherwise, list all tag objects and verify signatures where present.
1002 verifies SSH-based signatures by invoking
1005 .Fl Y Cm verify Fl f Ar allowed_signers .
1010 otherwise verification is impossible.
1013 During SSH signature creation and verification this option will be passed to
1015 Multiple -v options increase the verbosity.
1021 command will not delete tags or change existing tags.
1022 If a tag must be deleted, the
1024 command may be used to delete a tag's reference.
1025 This should only be done if the tag has not already been copied to
1032 Schedule unversioned files in a work tree for addition to the
1033 repository in the next commit.
1034 By default, files which match a
1036 ignore pattern will not be added.
1040 mentioned in the command line is not an unversioned file then
1043 To avoid unnecessary errors from paths picked up by file globbing patterns
1044 in the shell, paths in the argument list will be silently ignored if they
1047 at all, or if they are reported with one of the following status codes
1048 and do not have changes staged via
1050 .Bl -column YXZ description
1051 .It M Ta modified file
1052 .It A Ta file scheduled for addition in next commit
1053 .It C Ta modified or added file which contains merge conflicts
1054 .It m Ta modified file modes (executable bit only)
1062 Add files even if they match a
1066 Permit recursion into directories.
1067 If this option is not specified,
1069 will refuse to run if a specified
1077 .Op Fl s Ar status-codes
1081 Remove versioned files from a work tree and schedule them for deletion
1082 from the repository in the next commit.
1089 Perform the operation even if a file contains local modifications,
1090 and do not raise an error if a specified
1092 does not exist on disk.
1094 Keep affected files on disk.
1096 Permit recursion into directories.
1097 If this option is not specified,
1099 will refuse to run if a specified
1102 .It Fl s Ar status-codes
1103 Only delete files with a modification status matching one of the
1104 single-character status codes contained in the
1107 The following status codes may be specified:
1108 .Bl -column YXZ description
1109 .It M Ta modified file (this implies the
1112 .It ! Ta versioned file expected on disk but missing
1120 .Op Fl p Ar strip-count
1126 to files in a work tree.
1127 Files added or removed by a patch will be scheduled for addition or removal in
1130 The patch must be in the unified diff format as produced by
1137 diff when invoked with their
1142 argument is provided, read unified diff data from standard input instead.
1146 contains multiple patches, then attempt to apply each of them in sequence.
1148 Show the status of each affected file, using the following status codes:
1149 .Bl -column XYZ description
1150 .It M Ta file was modified
1151 .It G Ta file was merged using a merge-base found in the repository
1152 .It C Ta file was merged and conflicts occurred during merge
1153 .It D Ta file was deleted
1154 .It A Ta file was added
1155 .It # Ta failed to patch the file
1158 If a change does not match at its exact line number, attempt to
1159 apply it somewhere else in the file if a good spot can be found.
1160 Otherwise, the patch will fail to apply.
1164 will refuse to apply a patch if certain preconditions are not met.
1165 Files to be deleted must already be under version control, and must
1166 not have been scheduled for deletion already.
1167 Files to be added must not yet be under version control and must not
1168 already be present on disk.
1169 Files to be modified must already be under version control and may not
1170 contain conflict markers.
1172 If an error occurs, the
1174 operation will be aborted.
1175 Any changes made to the work tree up to this point will be left behind.
1176 Such changes can be viewed with
1178 and can be reverted with
1187 Attempt to locate files within the specified
1189 for use as a merge-base for 3-way merges.
1190 Ideally, the specified
1192 should contain versions of files which the changes contained in the
1195 Files will be located by path, relative to the repository root.
1198 option is used then leading path components will be stripped
1199 before paths are looked up in the repository.
1203 option is not used then
1205 will attempt to locate merge-bases via object IDs found in
1207 meta-data, such as produced by
1213 option is only recommended in the absence of such meta-data.
1215 In case no merge-base is available for a file, changes will be applied
1216 without doing a 3-way merge.
1217 Changes which do not apply cleanly may then be rejected entirely, rather
1218 than producing merge conflicts in the patched target file.
1220 Do not make any modifications to the work tree.
1221 This can be used to check whether a patch would apply without issues.
1224 contains diffs that affect the same file multiple times, the results
1225 displayed may be incorrect.
1226 .It Fl p Ar strip-count
1227 Specify the number of leading path components to strip from paths
1236 path prefixes generated by
1238 will be recognized and stripped automatically.
1240 Reverse the patch before applying it.
1246 .Op Fl F Ar response-script
1250 Revert any local changes in files at the specified paths in a work tree.
1251 File contents will be overwritten with those contained in the
1252 work tree's base commit.
1253 There is no way to bring discarded changes back after
1256 If a file was added with
1258 it will become an unversioned file again.
1259 If a file was deleted with
1261 it will be restored.
1267 .It Fl F Ar response-script
1275 responses line-by-line from the specified
1277 file instead of prompting interactively.
1279 Instead of reverting all changes in files, interactively select or reject
1280 changes to revert based on
1286 (quit reverting this file) responses.
1287 If a file is in modified status, individual patches derived from the
1288 modified file content can be reverted.
1289 Files in added or deleted status may only be reverted in their entirety.
1291 Permit recursion into directories.
1292 If this option is not specified,
1294 will refuse to run if a specified
1304 .Op Fl J Ar jumphost
1309 Create a new commit in the repository from changes in a work tree
1310 and use this commit as the new base commit for the work tree.
1313 is specified, commit all changes in the work tree.
1314 Otherwise, commit changes at or within the specified paths.
1316 If changes have been explicitly staged for commit with
1318 only commit staged changes and reject any specified paths which
1319 have not been staged.
1322 opens a temporary file in an editor where a log message can be written
1330 options are used together.
1331 Quitting the editor without saving the file will abort the commit operation.
1333 Show the status of each affected file, using the following status codes:
1334 .Bl -column YXZ description
1335 .It M Ta modified file
1336 .It D Ta file was deleted
1337 .It A Ta new file was added
1338 .It m Ta modified file modes (executable bit only)
1341 Files which are not part of the new commit will retain their previously
1342 recorded base commit.
1345 commands may refuse to run while the work tree contains files from
1346 multiple base commits.
1347 The base commit of such a work tree can be made consistent by running
1349 across the entire work tree.
1353 command requires the
1355 environment variable to be set,
1356 unless an author has been configured in
1362 configuration settings can be
1363 obtained from the repository's
1365 file or from Git's global
1374 Set author information in the newly created commit to
1376 This is useful when committing changes on behalf of someone else.
1379 argument must use the same format as the
1381 environment variable.
1383 In addition to storing author information, the newly created commit
1386 information which is obtained, as usual, from the
1388 environment variable, or
1390 or Git configuration settings.
1392 Allow committing files in conflicted status.
1394 Committing files with conflict markers should generally be avoided.
1395 Cases where conflict markers must be stored in the repository for
1396 some legitimate reason should be very rare.
1397 There are usually ways to avoid storing conflict markers verbatim by
1398 applying appropriate programming tricks.
1400 Use the prepared log message stored in the file found at
1402 when creating the new commit.
1404 opens a temporary file in an editor where the prepared log message can be
1405 reviewed and edited further if needed.
1406 Cannot be used together with the
1410 Use the specified log message when creating the new commit.
1411 Cannot be used together with the
1414 .It Fl J Ar jumphost
1417 to use with SSH connections.
1418 The same option will be passed to
1421 This option prevents
1423 from opening the commit message in an editor.
1424 It has no effect unless it is used together with the
1426 option and is intended for non-interactive use such as scripting.
1428 This option prevents
1430 from generating a diff of the to-be-committed changes in a temporary file
1431 which can be viewed while editing a commit message.
1433 Allow the addition of symbolic links which point outside of the path space
1434 that is under version control.
1437 will reject such symbolic links due to safety concerns.
1440 may decide to represent such a symbolic link as a regular file which contains
1441 the link's target path, rather than creating an actual symbolic link which
1442 points outside of the work tree.
1443 Use of this option is discouraged because external mechanisms such as
1445 are better suited for managing symbolic links to paths not under
1450 will refuse to run if certain preconditions are not met.
1451 If the work tree's current branch is not in the
1453 reference namespace, new commits may not be created on this branch.
1454 Local changes may only be committed if they are based on file content
1455 found in the most recent commit on the work tree's branch.
1456 If a path is found to be out of date,
1458 must be used first in order to merge local changes with changes made
1467 Merge changes from a single
1472 should be on a different branch than the work tree's base commit.
1473 The expected argument is a reference or a commit ID.
1474 An abbreviated hash argument will be expanded to a commit ID
1475 automatically, provided the abbreviation is unique.
1477 Show the status of each affected file, using the following status codes:
1478 .Bl -column YXZ description
1479 .It G Ta file was merged
1480 .It C Ta file was merged and conflicts occurred during merge
1481 .It ! Ta changes destined for a missing file were not merged
1482 .It D Ta file was deleted
1483 .It d Ta file's deletion was prevented by local modifications
1484 .It A Ta new file was added
1485 .It \(a~ Ta changes destined for a non-regular file were not merged
1486 .It ? Ta changes destined for an unversioned file were not merged
1489 The merged changes will appear as local changes in the work tree, which
1492 amended manually or with further
1498 If invoked in a work tree where no
1503 operation is taking place,
1505 creates a record of commits which have been merged into the work tree.
1506 When a file changed by
1510 the log messages of relevant merged commits will then appear in the editor,
1511 where the messages should be further adjusted to convey the reasons for
1512 cherrypicking the changes.
1513 Upon exiting the editor, if the time stamp of the log message file
1514 is unchanged or the log message is empty,
1516 will fail with an unmodified or empty log message error.
1518 If all the changes in all files touched by a given commit are discarded,
1521 this commit's log message record will also disappear.
1524 will refuse to run if certain preconditions are not met.
1525 If the work tree contains multiple base commits, it must first be updated
1526 to a single base commit with
1528 If any relevant files already contain merge conflicts, these
1529 conflicts must be resolved first.
1537 Display a list of commit log messages recorded by cherrypick operations,
1538 represented by references in the
1539 .Dq refs/got/worktree
1540 reference namespace.
1543 is specified, only show the log message of the specified commit.
1545 If invoked in a work tree, only log messages recorded by cherrypick operations
1546 in the current work tree will be displayed.
1547 Otherwise, all commit log messages will be displayed irrespective of the
1548 work tree in which they were created.
1549 This option cannot be used with
1552 Delete log messages created by previous cherrypick operations, represented by
1554 .Dq refs/got/worktree
1555 reference namespace.
1558 is specified, only delete the log message of the specified commit.
1560 If invoked in a work tree, only log messages recorded by cherrypick operations
1561 in the current work tree will be deleted.
1562 Otherwise, all commit log messages will be deleted irrespective of the
1563 work tree in which they were created.
1564 This option cannot be used with
1575 Reverse-merge changes from a single
1580 should be on the same branch as the work tree's base commit.
1581 The expected argument is a reference or a commit ID.
1582 An abbreviated hash argument will be expanded to a commit ID
1583 automatically, provided the abbreviation is unique.
1585 Show the status of each affected file, using the following status codes:
1586 .Bl -column YXZ description
1587 .It G Ta file was merged
1588 .It C Ta file was merged and conflicts occurred during merge
1589 .It ! Ta changes destined for a missing file were not merged
1590 .It D Ta file was deleted
1591 .It d Ta file's deletion was prevented by local modifications
1592 .It A Ta new file was added
1593 .It \(a~ Ta changes destined for a non-regular file were not merged
1594 .It ? Ta changes destined for an unversioned file were not merged
1597 The reverse-merged changes will appear as local changes in the work tree,
1598 which may be viewed with
1600 amended manually or with further
1606 If invoked in a work tree where no
1611 operation is taking place,
1613 creates a record of commits which have been reverse-merged into the work tree.
1614 When a file changed by
1618 the log messages of relevant reverse-merged commits will then appear in
1619 the editor, where the messages should be further adjusted to convey the
1620 reasons for backing out the changes.
1621 Upon exiting the editor, if the time stamp of the log message file
1622 is unchanged or the log message is empty,
1624 will fail with an unmodified or empty log message error.
1626 If all the changes in all files touched by a given commit are discarded,
1629 this commit's log message record will also disappear.
1632 will refuse to run if certain preconditions are not met.
1633 If the work tree contains multiple base commits, it must first be updated
1634 to a single base commit with
1636 If any relevant files already contain merge conflicts, these
1637 conflicts must be resolved first.
1645 Display a list of commit log messages recorded by backout operations,
1646 represented by references in the
1647 .Dq refs/got/worktree
1648 reference namespace.
1651 is specified, only show the log message of the specified commit.
1653 If invoked in a work tree, only log messages recorded by backout operations
1654 in the current work tree will be displayed.
1655 Otherwise, all commit log messages will be displayed irrespective of the
1656 work tree in which they were created.
1657 This option cannot be used with
1660 Delete log messages created by previous backout operations, represented by
1662 .Dq refs/got/worktree
1663 reference namespace.
1666 is specified, only delete the log message of the specified commit.
1668 If invoked in a work tree, only log messages recorded by backout operations
1669 in the current work tree will be deleted.
1670 Otherwise, all commit log messages will be deleted irrespective of the
1671 work tree in which they were created.
1672 This option cannot be used with
1679 .Op Fl r Ar repository-path
1682 Parse and print contents of objects to standard output in a line-based
1684 Content of commit, tree, and tag objects is printed in a way similar
1685 to the actual content stored in such objects.
1686 Blob object contents are printed as they would appear in files on disk.
1688 Attempt to interpret each argument as a reference, a tag name, or
1690 References will be resolved to an object ID.
1691 Tag names will resolved to a tag object.
1692 An abbreviated hash argument will be expanded to a commit ID
1693 automatically, provided the abbreviation is unique.
1695 If none of the above interpretations produce a valid result, or if the
1697 option is used, attempt to interpret the argument as a path which will
1698 be resolved to the ID of an object found at this path in the repository.
1705 Look up paths in the specified
1707 If this option is not used, paths are looked up in the commit resolved
1708 via the repository's HEAD reference.
1709 The expected argument is a commit ID or an existing reference
1710 or tag name which will be resolved to a commit ID.
1711 An abbreviated hash argument will be expanded to a commit ID
1712 automatically, provided the abbreviation is unique.
1714 Interpret all arguments as paths only.
1715 This option can be used to resolve ambiguity in cases where paths
1716 look like tag names, reference names, or object IDs.
1717 .It Fl r Ar repository-path
1718 Use the repository at the specified path.
1719 If not specified, assume the repository is located at or above the current
1721 If this directory is a
1723 work tree, use the repository path associated with this work tree.
1725 .It Cm info Op Ar path ...
1726 Display meta-data stored in a work tree.
1731 The work tree to use is resolved implicitly by walking upwards from the
1732 current working directory.
1736 arguments are specified, show additional per-file information for tracked
1737 files located at or within these paths.
1740 argument corresponds to the work tree's root directory, display information
1741 for all tracked files.
1744 .Bl -tag -width GOT_IGNORE_GITCONFIG
1746 The author's name and email address, such as
1747 .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
1758 may fail to parse commits without an email address in author data,
1762 environment variables with a missing email address.
1764 .Ev GOT_AUTHOR will be overridden by configuration settings in
1770 configuration settings in the repository's
1777 configuration settings contained in Git's global
1779 configuration file will only be used if neither
1783 environment variable provide author information.
1784 .It Ev GOT_IGNORE_GITCONFIG
1785 If this variable is set then any remote repository definitions or author
1786 information found in Git configuration files will be ignored.
1787 .It Ev GOT_LOG_DEFAULT_LIMIT
1788 The default limit on the number of commits traversed by
1790 If set to zero, the limit is unbounded.
1791 This variable will be silently ignored if it is set to a non-numeric value.
1792 .It Ev VISUAL , EDITOR
1793 The editor spawned by
1801 text editor will be spawned.
1804 .Bl -tag -width packed-refs -compact
1806 Repository-wide configuration settings for
1810 configuration file located in the root directory of a Git repository
1811 supersedes any relevant settings in Git's
1815 .It Pa .cvg/got.conf
1816 Worktree-specific configuration settings for
1820 configuration file in the
1822 meta-data directory of a work tree supersedes any relevant settings in
1825 configuration file and Git's
1832 Enable tab-completion of
1837 .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p)
1839 Clone an existing Git repository for use with
1843 .Dl $ got clone ssh://git@github.com/openbsd/src.git
1845 Unfortunately, many of the popular Git hosting sites do not offer anonymous
1847 Such sites will require an account to be created, and a public SSH key to be
1848 uploaded to this account, before repository access via ssh:// URLs will work.
1850 Use of HTTP URLs currently requires
1854 .Dl $ git clone --bare https://github.com/openbsd/src.git
1856 Alternatively, for quick and dirty local testing of
1858 a new Git repository could be created and populated with files,
1859 e.g. from a temporary CVS checkout located at
1862 .Dl $ gotadmin init /var/git/src.git
1863 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
1865 Check out a work tree from the Git repository to /usr/src:
1867 .Dl $ got checkout /var/git/src.git /usr/src
1869 View local changes in a work tree directory:
1871 .Dl $ got diff | less
1873 In a work tree, display files in a potentially problematic state:
1875 .Dl $ got status -s 'C!~?'
1877 Interactively revert selected local changes in a work tree directory:
1879 .Dl $ got revert -p -R\ .
1881 In a work tree or a git repository directory, list all branch references:
1885 As above, but list the most recently modified branches only:
1887 .Dl $ got branch -lt | head
1889 In a work tree or a git repository directory, create a new branch called
1890 .Dq unified-buffer-cache
1891 which is forked off the
1895 .Dl $ got branch -c master unified-buffer-cache
1897 Switch an existing work tree to the branch
1898 .Dq unified-buffer-cache .
1899 Local changes in the work tree will be preserved and merged if necessary:
1901 .Dl $ got update -b unified-buffer-cache
1903 Create a new commit from local changes in a work tree directory.
1904 This new commit will become the head commit of the work tree's current branch:
1908 In a work tree or a git repository directory, view changes committed in
1909 the 3 most recent commits to the work tree's branch, or the branch resolved
1910 via the repository's HEAD reference, respectively:
1912 .Dl $ got log -p -l 3
1914 As above, but display changes in the order in which
1916 could apply them in sequence:
1918 .Dl $ got log -p -l 3 -R
1920 In a work tree or a git repository directory, log the history of a subdirectory:
1922 .Dl $ got log sys/uvm
1924 While operating inside a work tree, paths are specified relative to the current
1925 working directory, so this command will log the subdirectory
1928 .Dl $ cd sys/uvm && got log\ .
1930 And this command has the same effect:
1932 .Dl $ cd sys/dev/usb && got log ../../uvm
1934 And this command displays work tree meta-data about all tracked files:
1937 .Dl $ got info\ . | less
1939 Add new files and remove obsolete files in a work tree directory:
1941 .Dl $ got add sys/uvm/uvm_ubc.c
1942 .Dl $ got remove sys/uvm/uvm_vnode.c
1944 Create a new commit from local changes in a work tree directory
1945 with a pre-defined log message.
1947 .Dl $ got commit -m 'unify the buffer cache'
1949 Alternatively, create a new commit from local changes in a work tree
1950 directory with a log message that has been prepared in the file
1953 .Dl $ got commit -F /tmp/msg
1955 Update any work tree checked out from the
1956 .Dq unified-buffer-cache
1957 branch to the latest commit on this branch:
1961 Roll file content on the unified-buffer-cache branch back by one commit,
1962 and then fetch the rolled-back change into the work tree as a local change
1963 to be amended and perhaps committed again:
1965 .Dl $ got backout unified-buffer-cache
1966 .Dl $ got commit -m 'roll back previous'
1967 .Dl $ # now back out the previous backout :-)
1968 .Dl $ got backout unified-buffer-cache
1970 Fetch new changes on the remote repository's
1972 branch, making them visible on the local repository's
1979 In a repository created with a HTTP URL and
1980 .Cm git clone --bare
1983 command must be used instead:
1985 .Dl $ cd /var/git/src.git
1986 .Dl $ git fetch origin master:refs/remotes/origin/master
1990 branch to merge the new changes that are now visible on the
1995 .Dl $ got update -b origin/master
1996 .Dl $ got rebase master
1999 .Dq unified-buffer-cache
2000 branch on top of the new head commit of the
2004 .Dl $ got update -b master
2005 .Dl $ got rebase unified-buffer-cache
2007 Create a patch from all changes on the unified-buffer-cache branch.
2008 The patch can be mailed out for review and applied to
2012 .Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
2014 Edit the entire commit history of the
2015 .Dq unified-buffer-cache
2018 .Dl $ got update -b unified-buffer-cache
2019 .Dl $ got update -c master
2022 Before working against existing branches in a repository cloned with
2023 .Cm git clone --bare
2028 must be configured to map all references in the remote repository
2031 namespace of the local repository.
2032 This can be achieved by setting Git's
2033 .Pa remote.origin.fetch
2034 configuration variable to the value
2035 .Dq +refs/heads/*:refs/remotes/origin/*
2040 .Dl $ cd /var/git/repo
2041 .Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
2045 option must be disabled:
2047 .Dl $ cd /var/git/repo
2048 .Dl $ git config remote.origin.mirror false
2050 Alternatively, the following
2052 configuration item can be added manually to the Git repository's
2056 .Dl [remote \&"origin\&"]
2058 .Dl fetch = +refs/heads/*:refs/remotes/origin/*
2061 This configuration leaves the local repository's
2063 namespace free for use by local branches checked out with
2065 and, if needed, created with
2068 .Dq refs/remotes/origin
2069 namespace can now be updated with incoming changes from the remote
2074 without extra command line arguments.
2075 Newly fetched changes can be examined with
2078 Display changes on the remote repository's version of the
2080 branch, as of the last time
2084 .Dl $ got log -c origin/master | less
2086 As shown here, most commands accept abbreviated reference names such as
2089 .Dq refs/remotes/origin/master .
2090 The latter is only needed in case of ambiguity.
2093 can be used to merge changes which are visible on the
2098 This will also merge local changes, if any, with the incoming changes:
2100 .Dl $ got update -b origin/master
2101 .Dl $ got rebase master
2103 In order to make changes committed to the
2104 .Dq unified-buffer-cache
2108 .Dq unified-buffer-cache
2109 branch can be rebased onto the
2113 .Dl $ got update -b master
2114 .Dl $ got rebase unified-buffer-cache
2117 .Dq unified-buffer-cache
2118 branch can now be made visible on the
2122 Because the rebase operation switched the work tree to the
2123 .Dq unified-buffer-cache
2124 branch, the work tree must be switched back to the
2128 .Dl $ got update -b master
2129 .Dl $ got integrate unified-buffer-cache
2133 branch, log messages for local changes can now be amended with
2135 by other developers and any other important new information:
2137 .Dl $ got update -c origin/master
2138 .Dl $ got histedit -m
2140 If the remote repository offers write access, local changes on the
2142 branch can be sent to the remote repository with
2146 can be run without further arguments.
2147 The arguments shown here match defaults, provided the work tree's
2148 current branch is the
2152 .Dl $ got send -b master origin
2154 If the remote repository requires the HTTPS protocol, the
2156 command must be used instead:
2158 .Dl $ cd /var/git/src.git
2159 .Dl $ git push origin master
2161 When making contributions to projects which use the
2163 workflow, SSH protocol repository access needs to be set up first.
2164 Once an account has been created on a Git hosting site it should
2165 be possible to upload a public SSH key for repository access
2170 workflow will usually involve two remote repositories.
2171 In the real-life example below, the
2173 repository was forked from the
2175 repository by using the Git hosting site's web interface.
2178 file in the local repository describes both remote repositories:
2179 .Bd -literal -offset indent
2180 # Jelmers's repository, which accepts pull requests
2182 server git@github.com
2184 repository "/jelmer/dulwich"
2188 # Stefan's fork, used as the default remote repository
2190 server git@github.com
2192 repository "/stspdotname/dulwich"
2197 With this configuration, Stefan can create commits on
2198 .Dq refs/heads/master
2199 and send them to the
2201 repository by running:
2203 .Dl $ got send -b master origin
2205 The changes can now be proposed to Jelmer by opening a pull request
2206 via the Git hosting site's web interface.
2207 If Jelmer requests further changes to be made, additional commits
2208 can be created on the
2210 branch and be added to the pull request by running
2214 If Jelmer prefers additional commits to be
2216 then the following commands can be used to achieve this:
2218 .Dl $ got update -b master
2219 .Dl $ got update -c origin/master
2220 .Dl $ got histedit -f
2221 .Dl $ got send -f -b master origin
2223 In addition to reviewing the pull request in the web user interface,
2224 Jelmer can fetch the pull request's branch into his local repository
2225 and create a local branch which contains the proposed changes:
2227 .Dl $ got fetch -R refs/pull/1046/head origin
2228 .Dl $ got branch -c refs/remotes/origin/pull/1046/head pr1046
2230 Once Jelmer has accepted the pull request, Stefan can fetch the
2231 merged changes, and possibly several other new changes, by running:
2233 .Dl $ got fetch upstream
2235 The merged changes will now be visible under the reference
2236 .Dq refs/remotes/upstream/master .
2239 branch can now be rebased on top of the latest changes
2242 .Dl $ got update -b upstream/master
2243 .Dl $ got rebase master
2245 As an alternative to
2247 branches can be merged with
2250 .Dl $ got update -b master
2251 .Dl $ got merge upstream/master
2253 The question of whether to rebase or merge branches is philosophical.
2254 When in doubt, refer to the software project's policies set by project
2257 As a final step, the forked repository's copy of the master branch needs
2258 to be kept in sync by sending the new changes there:
2260 .Dl $ got send -f -b master origin
2262 If multiple pull requests need to be managed in parallel, a separate branch
2263 must be created for each pull request with
2265 Each such branch can then be used as above, in place of
2266 .Dq refs/heads/master .
2267 Changes for any accepted pull requests will still appear under
2268 .Dq refs/remotes/upstream/master,
2269 regardless of which branch was used in the forked repository to
2270 create a pull request.
2274 .Xr git-repository 5 ,
2275 .Xr got-worktree 5 ,
2279 .An Anthony J. Bentley Aq Mt bentley@openbsd.org
2280 .An Christian Weisgerber Aq Mt naddy@openbsd.org
2281 .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org
2282 .An Josh Rickmar Aq Mt jrick@zettaport.com
2283 .An Joshua Stein Aq Mt jcs@openbsd.org
2284 .An Klemens Nanni Aq Mt kn@openbsd.org
2285 .An Martin Pieuchot Aq Mt mpi@openbsd.org
2286 .An Neels Hofmeyr Aq Mt neels@hofmeyr.de
2287 .An Omar Polo Aq Mt op@openbsd.org
2288 .An Ori Bernstein Aq Mt ori@openbsd.org
2289 .An Sebastien Marie Aq Mt semarie@openbsd.org
2290 .An Stefan Sperling Aq Mt stsp@openbsd.org
2291 .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au
2292 .An Theo Buehler Aq Mt tb@openbsd.org
2293 .An Thomas Adam Aq Mt thomas@xteddy.org
2294 .An Tracey Emery Aq Mt tracey@traceyemery.net
2295 .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org
2302 were derived from code under copyright by:
2304 .An Caldera International
2305 .An Daniel Hartmeier
2310 .An Jean-Francois Brousseau
2316 .An Niklas Hallqvist
2321 .An Xavier Santolaria
2324 contains code contributed to the public domain by
2325 .An Austin Appleby .
2328 is a work-in-progress and some features remain to be implemented.
2330 At present, the user has to fall back on
2332 to perform some tasks.
2336 Reading from remote repositories over HTTP or HTTPS protocols requires
2341 Writing to remote repositories over HTTP or HTTPS protocols requires
2344 The creation of merge commits with more than two parent commits requires
2347 In situations where files or directories were moved around
2349 will not automatically merge changes to new locations and
2351 will usually produce better results.