Tag
Hash :
83cd27f8
Author :
Date :
2020-01-13T15:59:47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617
.\"
.\" Copyright (c) 2017 Martin Pieuchot
.\" Copyright (c) 2018, 2019, 2020 Stefan Sperling
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate$
.Dt GOT 1
.Os
.Sh NAME
.Nm got
.Nd Game of Trees
.Sh SYNOPSIS
.Nm
.Ar command
.Op Fl h
.Op Ar arg ...
.Sh DESCRIPTION
.Nm
is a version control system which stores the history of tracked files
in a Git repository, as used by the Git version control system.
This repository format is described in
.Xr git-repository 5 .
.Pp
.Nm
is a
.Dq distributed
version control system because every copy of a repository is writeable.
Modifications made to files can be synchronized between repositories
at any time.
.Pp
Files managed by
.Nm
must be checked out from the repository for modification.
Checked out files are stored in a
.Em work tree
which can be placed at an arbitrary directory in the filesystem hierarchy.
The on-disk format of this work tree is described in
.Xr got-worktree 5 .
.Pp
.Nm
provides global and command-specific options.
Global options must precede the command name, and are as follows:
.Bl -tag -width tenletters
.It Fl h
Display usage information and exit immediately.
.It Fl V, -version
Display program version and exit immediately.
.El
.Pp
The commands for
.Nm
are as follows:
.Bl -tag -width checkout
.It Cm init Ar repository-path
Create a new empty repository at the specified
.Ar repository-path .
.Pp
After
.Cm got init ,
the
.Cm got import
command must be used to populate the empty repository before
.Cm got checkout
can be used.
.It Cm in
Short alias for
.Cm init .
.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
Create an initial commit in a repository from the file hierarchy
within the specified
.Ar directory .
The created commit will not have any parent commits, i.e. it will be a
root commit.
Also create a new reference which provides a branch name for the newly
created commit.
Show the path of each imported file to indicate progress.
.Pp
The
.Cm got import
command requires the
.Ev GOT_AUTHOR
environment variable to be set,
unless Git's
.Dv user.name
and
.Dv user.email
configuration settings can be obtained from the repository's
.Pa .git/config
file or from Git's global
.Pa ~/.gitconfig
configuration file.
.Pp
The options for
.Cm got import
are as follows:
.Bl -tag -width Ds
.It Fl b Ar branch
Create the specified
.Ar branch
instead of creating the default branch
.Dq main .
Use of this option is required if the
.Dq main
branch already exists.
.It Fl m Ar message
Use the specified log message when creating the new commit.
Without the
.Fl m
option,
.Cm got import
opens a temporary file in an editor where a log message can be written.
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
.It Fl I Ar pattern
Ignore files or directories with a name which matches the specified
.Ar pattern .
This option may be specified multiple times to build a list of ignore patterns.
The
.Ar pattern
follows the globbing rules documented in
.Xr glob 7 .
.El
.It Cm im
Short alias for
.Cm import .
.It Cm checkout Oo Fl E Oc Oo Fl b Ar branch Oc Oo Fl c Ar commit OcOo Fl p Ar path-prefix Oc Ar repository-path Op Ar work-tree-path
Copy files from a repository into a new work tree.
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It A Ta new file was added
.It E Ta file already exists in work tree's meta-data
.El
.Pp
If the
.Ar work tree path
is not specified, either use the last component of
.Ar repository path ,
or if a
.Ar path prefix
was specified use the last component of
.Ar path prefix .
.Pp
The options for
.Cm got checkout
are as follows:
.Bl -tag -width Ds
.It Fl E
Proceed with the checkout operation even if the directory at
.Ar work-tree-path
is not empty.
Existing files will be left intact.
.It Fl b Ar branch
Check out files from a commit on the specified
.Ar branch .
If this option is not specified, a branch resolved via the repository's HEAD
reference will be used.
.It Fl c Ar commit
Check out files from the specified
.Ar commit
on the selected branch.
The expected argument is a commit ID SHA1 hash or an existing reference
or tag name which will be resolved to a commit ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
If this option is not specified, the most recent commit on the selected
branch will be used.
.It Fl p Ar path-prefix
Restrict the work tree to a subset of the repository's tree hierarchy.
Only files beneath the specified
.Ar path-prefix
will be checked out.
.El
.It Cm co
Short alias for
.Cm checkout .
.It Cm update Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Op Ar path ...
Update an existing work tree to a different commit.
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It U Ta file was updated and contained no local changes
.It G Ta file was updated and local changes were merged cleanly
.It C Ta file was updated and conflicts occurred during merge
.It D Ta file was deleted
.It A Ta new file was added
.It \(a~ Ta versioned file is obstructed by a non-regular file
.It ! Ta a missing versioned file was restored
.El
.Pp
If no
.Ar path
is specified, update the entire work tree.
Otherwise, restrict the update operation to files at or within the
specified paths.
Each path is required to exist in the update operation's target commit.
Files in the work tree outside specified paths will remain unchanged and
will retain their previously recorded base commit.
Some
.Nm
commands may refuse to run while the work tree contains files from
multiple base commits.
The base commit of such a work tree can be made consistent by running
.Cm got update
across the entire work tree.
Specifying a
.Ar path
is incompatible with the
.Fl b
option.
.Pp
.Cm got update
cannot update paths with staged changes.
If changes have been staged with
.Cm got stage ,
these changes must first be committed with
.Cm got commit
or unstaged with
.Cm got unstage .
.Pp
The options for
.Cm got update
are as follows:
.Bl -tag -width Ds
.It Fl b Ar branch
Switch the work tree's branch reference to the specified
.Ar branch
before updating the work tree.
This option requires that all paths in the work tree are updated.
.It Fl c Ar commit
Update the work tree to the specified
.Ar commit .
The expected argument is a commit ID SHA1 hash or an existing reference
or tag name which will be resolved to a commit ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
If this option is not specified, the most recent commit on the work tree's
branch will be used.
.El
.It Cm up
Short alias for
.Cm update .
.It Cm status Op Ar path ...
Show the current modification status of files in a work tree,
using the following status codes:
.Bl -column YXZ description
.It M Ta modified file
.It A Ta file scheduled for addition in next commit
.It D Ta file scheduled for deletion in next commit
.It C Ta modified or added file which contains merge conflicts
.It ! Ta versioned file was expected on disk but is missing
.It \(a~ Ta versioned file is obstructed by a non-regular file
.It ? Ta unversioned item not tracked by
.Nm
.It m Ta modified file modes (executable bit only)
.It N Ta non-existent
.Ar path
specified on the command line
.El
.Pp
If no
.Ar path
is specified, show modifications in the entire work tree.
Otherwise, show modifications at or within the specified paths.
.Pp
If changes have been staged with
.Cm got stage ,
staged changes are shown in the second output column, using the following
status codes:
.Bl -column YXZ description
.It M Ta file modification is staged
.It A Ta file addition is staged
.It D Ta file deletion is staged
.El
.Pp
Changes created on top of staged changes are indicated in the first column:
.Bl -column YXZ description
.It MM Ta file was modified after earlier changes have been staged
.It MA Ta file was modified after having been staged for addition
.El
.Pp
For compatibility with
.Xr cvs 1
and
.Xr git 1 ,
.Cm got status
reads
.Xr glob 7
patterns from
.Pa .cvsignore
and
.Pa .gitignore
files in each traversed directory and will not display unversioned files
which match these patterns.
As an extension to
.Xr glob 7
matching rules,
.Cm got status
supports consecutive asterisks,
.Dq ** ,
which will match an arbitrary amount of directories.
Unlike
.Xr cvs 1 ,
.Cm got status
only supports a single ignore pattern per line.
Unlike
.Xr git 1 ,
.Cm got status
does not support negated ignore patterns prefixed with
.Dq \&! ,
and gives no special significance to the location of path component separators,
.Dq / ,
in a pattern.
.It Cm st
Short alias for
.Cm status .
.It Cm log Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl f Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Op Ar path
Display history of a repository.
If a
.Ar path
is specified, show only commits which modified this path.
.Pp
The options for
.Cm got log
are as follows:
.Bl -tag -width Ds
.It Fl c Ar commit
Start traversing history at the specified
.Ar commit .
The expected argument is a commit ID SHA1 hash or an existing reference
or tag name which will be resolved to a commit ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
If this option is not specified, default to the work tree's current branch
if invoked in a work tree, or to the repository's HEAD reference.
.It Fl C Ar number
Set the number of context lines shown in diffs with
.Fl p .
By default, 3 lines of context are shown.
.It Fl f
Restrict history traversal to the first parent of each commit.
This shows the linear history of the current branch only.
Merge commits which affected the current branch will be shown but
individual commits which originated on other branches will be omitted.
.It Fl l Ar N
Limit history traversal to a given number of commits.
If this option is not specified, a default limit value of zero is used,
which is treated as an unbounded limit.
The
.Ev GOT_LOG_DEFAULT_LIMIT
environment variable may be set to change this default value.
.It Fl p
Display the patch of modifications made in each commit.
If a
.Ar path
is specified, only show the patch of modifications at or within this path.
.It Fl s Ar search-pattern
If specified, show only commits with a log message matched by the extended
regular expression
.Ar search-pattern .
Regular expression syntax is documented in
.Xr re_format 7 .
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.El
.It Cm diff Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path
When invoked within a work tree with less than two arguments, display
uncommitted changes in the work tree.
If a
.Ar path
is specified, only show changes within this path.
.Pp
If two arguments are provided, treat each argument as a reference, a tag
name, or an object ID SHA1 hash, and display differences between the
corresponding objects.
Both objects must be of the same type (blobs, trees, or commits).
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.Pp
The options for
.Cm got diff
are as follows:
.Bl -tag -width Ds
.It Fl C Ar number
Set the number of context lines shown in the diff.
By default, 3 lines of context are shown.
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.It Fl s
Show changes staged with
.Cm got stage
instead of showing local changes.
This option is only valid when
.Cm got diff
is invoked in a work tree.
.It Fl w
Ignore whitespace-only changes.
.El
.It Cm di
Short alias for
.Cm diff .
.It Cm blame Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Ar path
Display line-by-line history of a file at the specified path.
.Pp
The options for
.Cm got blame
are as follows:
.Bl -tag -width Ds
.It Fl c Ar commit
Start traversing history at the specified
.Ar commit .
The expected argument is a commit ID SHA1 hash or an existing reference
or tag name which will be resolved to a commit ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.El
.It Cm bl
Short alias for
.Cm blame .
.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
Display a listing of files and directories at the specified
directory path in the repository.
Entries shown in this listing may carry one of the following trailing
annotations:
.Bl -column YXZ description
.It @ Ta entry is a symbolic link
.It / Ta entry is a directory
.It * Ta entry is an executable file
.It $ Ta entry is a Git submodule
.El
.Pp
If no
.Ar path
is specified, list the repository path corresponding to the current
directory of the work tree, or the root directory of the repository
if there is no work tree.
.Pp
The options for
.Cm got tree
are as follows:
.Bl -tag -width Ds
.It Fl c Ar commit
List files and directories as they appear in the specified
.Ar commit .
The expected argument is a commit ID SHA1 hash or an existing reference
or tag name which will be resolved to a commit ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.It Fl i
Show object IDs of files (blob objects) and directories (tree objects).
.It Fl R
Recurse into sub-directories in the repository.
.El
.It Cm tr
Short alias for
.Cm tree .
.It Cm ref Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Oo Fl s Oc Op Ar name Ar target
Manage references in a repository.
.Pp
If no options are passed, expect two arguments and attempt to create,
or update, the reference with the given
.Ar name ,
and make it point at the given
.Ar target .
The name must be an absolute reference name, i.e. it must begin with
.Dq refs/ .
The target may be an object ID SHA1 hash or an existing reference which
will be resolved to an object ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.Pp
The options for
.Cm got ref
are as follows:
.Bl -tag -width Ds
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.It Fl l
List all existing references in the repository.
.It Fl d Ar name
Delete the reference with the specified name from the repository.
.It Fl s
Create a symbolic reference pointing at the specified
.Ar target ,
which must be an existing reference.
Care should be taken not to create loops between references when
this option is used.
.El
.It Cm branch Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Oo Fl d Ar name Oc Op Ar name
Manage branches in a repository.
.Pp
Branches are managed via references which live in the
.Dq refs/heads/
reference namespace.
The
.Cm got branch
command operates on references in this namespace only.
.Pp
If invoked in a work tree without any arguments, print the name of the
work tree's current branch.
If a
.Ar name
argument is passed, attempt to create a branch reference with the given name.
By default the new branch reference will point at the latest commit on the
work tree's current branch if invoked in a work tree, and otherwise to a commit
resolved via the repository's HEAD reference.
.Pp
The options for
.Cm got branch
are as follows:
.Bl -tag -width Ds
.It Fl c Ar commit
Make a newly created branch reference point at the specified
.Ar commit .
The expected
.Ar commit
argument is a commit ID SHA1 hash or an existing reference
or tag name which will be resolved to a commit ID.
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.It Fl l
List all existing branches in the repository.
If invoked in a work tree, the work tree's current branch is shown
with one the following annotations:
.Bl -column YXZ description
.It * Ta work tree's base commit matches the branch tip
.It \(a~ Ta work tree's base commit is out-of-date
.El
.It Fl d Ar name
Delete the branch with the specified name from the repository.
Only the branch reference is deleted.
Any commit, tree, and blob objects belonging to the branch
remain in the repository and may be removed separately with
Git's garbage collector.
.El
.It Cm br
Short alias for
.Cm branch .
.It Cm tag Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Ar name Op Ar commit
Manage tags in a repository.
.Pp
Tags are managed via references which live in the
.Dq refs/tags/
reference namespace.
The
.Cm got tag
command operates on references in this namespace only.
References in this namespace point at tag objects which contain a pointer
to another object, a tag message, as well as author and timestamp information.
.Pp
Expect one or two arguments and attempt to create a tag with the given
.Ar name ,
and make this tag point at the given
.Ar commit .
If no commit is specified, default to the latest commit on the work tree's
current branch if invoked in a work tree, and to a commit resolved via
the repository's HEAD reference otherwise.
Otherwise, the expected argument is a commit ID SHA1 hash or an existing
reference or tag name which will be resolved to a commit ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.Pp
The options for
.Cm got tag
are as follows:
.Bl -tag -width Ds
.It Fl m Ar message
Use the specified tag message when creating the new tag
Without the
.Fl m
option,
.Cm got tag
opens a temporary file in an editor where a tag message can be written.
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.It Fl l
List all existing tags in the repository instead of creating a new tag.
If this option is used, no other command-line arguments are allowed.
.El
.Pp
By design, the
.Cm got tag
command will not delete tags or change existing tags.
If a tag must be deleted, the
.Cm got ref
command may be used to delete a tag's reference.
This should only be done if the tag has not already been copied to
another repository.
.It Cm add Oo Fl R Oc Oo Fl I Oc Ar path ...
Schedule unversioned files in a work tree for addition to the
repository in the next commit.
.Pp
The options for
.Cm got add
are as follows:
.Bl -tag -width Ds
.It Fl R
Permit recursion into directories.
If this option is not specified,
.Cm got add
will refuse to run if a specified
.Ar path
is a directory.
.It Fl I
With -R, add files even if they match a
.Cm got status
ignore pattern.
.El
.It Cm remove Oo Fl f Oc Oo Fl k Oc Oo Fl R Oc Ar path ...
Remove versioned files from a work tree and schedule them for deletion
from the repository in the next commit.
.Pp
The options for
.Cm got remove
are as follows:
.Bl -tag -width Ds
.It Fl f
Perform the operation even if a file contains uncommitted modifications.
.It Fl k
Keep affected files on disk.
.It Fl R
Permit recursion into directories.
If this option is not specified,
.Cm got remove
will refuse to run if a specified
.Ar path
is a directory.
.El
.It Cm rm
Short alias for
.Cm remove .
.It Cm revert Oo Fl p Oc Oo Fl F Ar response-script Oc Oo Fl R Oc Ar path ...
Revert any uncommitted changes in files at the specified paths.
File contents will be overwritten with those contained in the
work tree's base commit.
There is no way to bring discarded changes back after
.Cm got revert !
.Pp
If a file was added with
.Cm got add
it will become an unversioned file again.
If a file was deleted with
.Cm got remove
it will be restored.
.Pp
The options for
.Cm got revert
are as follows:
.Bl -tag -width Ds
.It Fl p
Instead of reverting all changes in files, interactively select or reject
changes to revert based on
.Dq y
(revert change),
.Dq n
(keep change), and
.Dq q
(quit reverting this file) responses.
If a file is in modified status, individual patches derived from the
modified file content can be reverted.
Files in added or deleted status may only be reverted in their entirety.
.It Fl F Ar response-script
With the
.Fl p
option, read
.Dq y ,
.Dq n ,
and
.Dq q
responses line-by-line from the specified
.Ar response-script
file instead of prompting interactively.
.It Fl R
Permit recursion into directories.
If this option is not specified,
.Cm got revert
will refuse to run if a specified
.Ar path
is a directory.
.El
.It Cm rv
Short alias for
.Cm revert .
.It Cm commit Oo Fl m Ar message Oc Op Ar path ...
Create a new commit in the repository from changes in a work tree
and use this commit as the new base commit for the work tree.
If no
.Ar path
is specified, commit all changes in the work tree.
Otherwise, commit changes at or within the specified paths.
.Pp
If changes have been explicitly staged for commit with
.Cm got stage ,
only commit staged changes and reject any specified paths which
have not been staged.
.Pp
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It M Ta modified file
.It D Ta file was deleted
.It A Ta new file was added
.It m Ta modified file modes (executable bit only)
.El
.Pp
Files which are not part of the new commit will retain their previously
recorded base commit.
Some
.Nm
commands may refuse to run while the work tree contains files from
multiple base commits.
The base commit of such a work tree can be made consistent by running
.Cm got update
across the entire work tree.
.Pp
The
.Cm got commit
command requires the
.Ev GOT_AUTHOR
environment variable to be set,
unless Git's
.Dv user.name
and
.Dv user.email
configuration settings can be
obtained from the repository's
.Pa .git/config
file or from Git's global
.Pa ~/.gitconfig
configuration file.
.Pp
The options for
.Cm got commit
are as follows:
.Bl -tag -width Ds
.It Fl m Ar message
Use the specified log message when creating the new commit.
Without the
.Fl m
option,
.Cm got commit
opens a temporary file in an editor where a log message can be written.
.El
.Pp
.Cm got commit
will refuse to run if certain preconditions are not met.
If the work tree's current branch is not in the
.Dq refs/heads/
reference namespace, new commits may not be created on this branch.
Local changes may only be committed if they are based on file content
found in the most recent commit on the work tree's branch.
If a path is found to be out of date,
.Cm got update
must be used first in order to merge local changes with changes made
in the repository.
.It Cm ci
Short alias for
.Cm commit .
.It Cm cherrypick Ar commit
Merge changes from a single
.Ar commit
into the work tree.
The specified
.Ar commit
must be on a different branch than the work tree's base commit.
The expected argument is a reference or a commit ID SHA1 hash.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.Pp
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It G Ta file was merged
.It C Ta file was merged and conflicts occurred during merge
.It ! Ta changes destined for a missing file were not merged
.It D Ta file was deleted
.It d Ta file's deletion was obstructed by local modifications
.It A Ta new file was added
.It \(a~ Ta changes destined for a non-regular file were not merged
.El
.Pp
The merged changes will appear as local changes in the work tree, which
may be viewed with
.Cm got diff ,
amended manually or with further
.Cm got cherrypick
commands,
committed with
.Cm got commit ,
or discarded again with
.Cm got revert .
.Pp
.Cm got cherrypick
will refuse to run if certain preconditions are not met.
If the work tree contains multiple base commits it must first be updated
to a single base commit with
.Cm got update .
If the work tree already contains files with merge conflicts, these
conflicts must be resolved first.
.It Cm cy
Short alias for
.Cm cherrypick .
.It Cm backout Ar commit
Reverse-merge changes from a single
.Ar commit
into the work tree.
The specified
.Ar commit
must be on the same branch as the work tree's base commit.
The expected argument is a reference or a commit ID SHA1 hash.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.Pp
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It G Ta file was merged
.It C Ta file was merged and conflicts occurred during merge
.It ! Ta changes destined for a missing file were not merged
.It D Ta file was deleted
.It d Ta file's deletion was obstructed by local modifications
.It A Ta new file was added
.It \(a~ Ta changes destined for a non-regular file were not merged
.El
.Pp
The reverse-merged changes will appear as local changes in the work tree,
which may be viewed with
.Cm got diff ,
amended manually or with further
.Cm got backout
commands,
committed with
.Cm got commit ,
or discarded again with
.Cm got revert .
.Pp
.Cm got backout
will refuse to run if certain preconditions are not met.
If the work tree contains multiple base commits it must first be updated
to a single base commit with
.Cm got update .
If the work tree already contains files with merge conflicts, these
conflicts must be resolved first.
.It Cm bo
Short alias for
.Cm backout .
.It Cm rebase Oo Fl a Oc Oo Fl c Oc Op Ar branch
Rebase commits on the specified
.Ar branch
onto the tip of the current branch of the work tree.
The
.Ar branch
must share common ancestry with the work tree's current branch.
Rebasing begins with the first descendant commit of the youngest
common ancestor commit shared by the specified
.Ar branch
and the work tree's current branch, and stops once the tip commit
of the specified
.Ar branch
has been rebased.
.Pp
Rebased commits are accumulated on a temporary branch which the work tree
will remain switched to throughout the entire rebase operation.
Commits on this branch represent the same changes with the same log
messages as their counterparts on the original
.Ar branch ,
but with different commit IDs.
Once rebasing has completed successfully, the temporary branch becomes
the new version of the specified
.Ar branch
and the work tree is automatically switched to it.
.Pp
While rebasing commits, show the status of each affected file,
using the following status codes:
.Bl -column YXZ description
.It G Ta file was merged
.It C Ta file was merged and conflicts occurred during merge
.It ! Ta changes destined for a missing file were not merged
.It D Ta file was deleted
.It d Ta file's deletion was obstructed by local modifications
.It A Ta new file was added
.It \(a~ Ta changes destined for a non-regular file were not merged
.El
.Pp
If merge conflicts occur the rebase operation is interrupted and may
be continued once conflicts have been resolved.
Alternatively, the rebase operation may be aborted which will leave
.Ar branch
unmodified and the work tree switched back to its original branch.
.Pp
If a merge conflict is resolved in a way which renders the merged
change into a no-op change, the corresponding commit will be elided
when the rebase operation continues.
.Pp
.Cm got rebase
will refuse to run if certain preconditions are not met.
If the work tree is not yet fully updated to the tip commit of its
branch then the work tree must first be updated with
.Cm got update .
If changes have been staged with
.Cm got stage ,
these changes must first be committed with
.Cm got commit
or unstaged with
.Cm got unstage .
If the work tree contains local changes, these changes must first be
committed with
.Cm got commit
or reverted with
.Cm got revert .
If the
.Ar branch
contains changes to files outside of the work tree's path prefix,
the work tree cannot be used to rebase this branch.
.Pp
The
.Cm got update
and
.Cm got commit
commands will refuse to run while a rebase operation is in progress.
Other commands which manipulate the work tree may be used for
conflict resolution purposes.
.Pp
The options for
.Cm got rebase
are as follows:
.Bl -tag -width Ds
.It Fl a
Abort an interrupted rebase operation.
If this option is used, no other command-line arguments are allowed.
.It Fl c
Continue an interrupted rebase operation.
If this option is used, no other command-line arguments are allowed.
.El
.It Cm rb
Short alias for
.Cm rebase .
.It Cm histedit Oo Fl a Oc Oo Fl c Oc Op Fl F Ar histedit-script
Edit commit history between the work tree's current base commit and
the tip commit of the work tree's current branch.
.Pp
Editing of commit history is controlled via a
.Ar histedit script
which can be edited interactively or passed on the command line.
The format of the histedit script is line-based.
Each line in the script begins with a command name, followed by
whitespace and an argument.
For most commands, the expected argument is a commit ID SHA1 hash.
Any remaining text on the line is ignored.
Lines which begin with the
.Sq #
character are ignored entirely.
.Pp
The available commands are as follows:
.Bl -column YXZ pick-commit
.It pick Ar commit Ta Use the specified commit as it is.
.It edit Ar commit Ta Use the specified commit but once changes have been
merged into the work tree interrupt the histedit operation for amending.
.It fold Ar commit Ta Combine the specified commit with the next commit
listed further below that will be used.
.It drop Ar commit Ta Remove this commit from the edited history.
.It mesg Ar log-message Ta Use the specified single-line log message for
the commit on the previous line.
If the log message argument is left empty, open an editor where a new
log message can be written.
.El
.Pp
Every commit in the history being edited must be mentioned in the script.
Lines may be re-ordered to change the order of commits in the edited history.
.Pp
Edited commits are accumulated on a temporary branch which the work tree
will remain switched to throughout the entire histedit operation.
Once history editing has completed successfully, the temporary branch becomes
the new version of the work tree's branch and the work tree is automatically
switched to it.
.Pp
While merging commits, show the status of each affected file,
using the following status codes:
.Bl -column YXZ description
.It G Ta file was merged
.It C Ta file was merged and conflicts occurred during merge
.It ! Ta changes destined for a missing file were not merged
.It D Ta file was deleted
.It d Ta file's deletion was obstructed by local modifications
.It A Ta new file was added
.It \(a~ Ta changes destined for a non-regular file were not merged
.El
.Pp
If merge conflicts occur the histedit operation is interrupted and may
be continued once conflicts have been resolved.
Alternatively, the histedit operation may be aborted which will leave
the work tree switched back to its original branch.
.Pp
If a merge conflict is resolved in a way which renders the merged
change into a no-op change, the corresponding commit will be elided
when the histedit operation continues.
.Pp
.Cm got histedit
will refuse to run if certain preconditions are not met.
If the work tree's current branch is not in the
.Dq refs/heads/
reference namespace, the history of the branch may not be edited.
If the work tree contains multiple base commits it must first be updated
to a single base commit with
.Cm got update .
If changes have been staged with
.Cm got stage ,
these changes must first be committed with
.Cm got commit
or unstaged with
.Cm got unstage .
If the work tree contains local changes, these changes must first be
committed with
.Cm got commit
or reverted with
.Cm got revert .
If the edited history contains changes to files outside of the work tree's
path prefix, the work tree cannot be used to edit the history of this branch.
.Pp
The
.Cm got update
command will refuse to run while a histedit operation is in progress.
Other commands which manipulate the work tree may be used, and the
.Cm got commit
command may be used to commit arbitrary changes to the temporary branch
while the histedit operation is interrupted.
.Pp
The options for
.Cm got histedit
are as follows:
.Bl -tag -width Ds
.It Fl a
Abort an interrupted histedit operation.
If this option is used, no other command-line arguments are allowed.
.It Fl c
Continue an interrupted histedit operation.
If this option is used, no other command-line arguments are allowed.
.El
.It Cm he
Short alias for
.Cm histedit .
.It Cm integrate Ar branch
Integrate the specified
.Ar branch
into the work tree's current branch.
Files in the work tree are updated to match the contents on the integrated
.Ar branch ,
and the reference of the work tree's branch is changed to point at the
head commit of the integrated
.Ar branch .
.Pp
Both branches can be considered equivalent after integration since they
will be pointing at the same commit.
Both branches remain available for future work, if desired.
In case the integrated
.Ar branch
is no longer needed it may be deleted with
.Cm got branch -d .
.Pp
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It U Ta file was updated
.It D Ta file was deleted
.It A Ta new file was added
.It \(a~ Ta versioned file is obstructed by a non-regular file
.It ! Ta a missing versioned file was restored
.El
.Pp
.Cm got integrate
will refuse to run if certain preconditions are not met.
Most importantly, the
.Ar branch
must have been rebased onto the work tree's current branch with
.Cm got rebase
before it can be integrated, in order to linearize commit history and
resolve merge conflicts.
If the work tree contains multiple base commits it must first be updated
to a single base commit with
.Cm got update .
If changes have been staged with
.Cm got stage ,
these changes must first be committed with
.Cm got commit
or unstaged with
.Cm got unstage .
If the work tree contains local changes, these changes must first be
committed with
.Cm got commit
or reverted with
.Cm got revert .
.It Cm ig
Short alias for
.Cm integrate .
.It Cm stage Oo Fl l Oc Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
Stage local changes for inclusion in the next commit.
If no
.Ar path
is specified, stage all changes in the work tree.
Otherwise, stage changes at or within the specified paths.
Paths may be staged if they are added, modified, or deleted according to
.Cm got status .
.Pp
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It A Ta file addition has been staged
.It M Ta file modification has been staged
.It D Ta file deletion has been staged
.El
.Pp
Staged file contents are saved in newly created blob objects in the repository.
These blobs will be referred to by tree objects once staged changes have been
committed.
.Pp
Staged changes affect the behaviour of
.Cm got commit ,
.Cm got status ,
and
.Cm got diff .
While paths with staged changes exist, the
.Cm got commit
command will refuse to commit any paths which do not have staged changes.
Local changes created on top of staged changes can only be committed if
the path is staged again, or if the staged changes are committed first.
The
.Cm got status
command will show both local changes and staged changes.
The
.Cm got diff
command is able to display local changes relative to staged changes,
and to display staged changes relative to the repository.
The
.Cm got revert
command cannot revert staged changes but may be used to revert
local changes created on top of staged changes.
.Pp
The options for
.Cm got stage
are as follows:
.Bl -tag -width Ds
.It Fl l
Instead of staging new changes, list paths which are already staged,
along with the IDs of staged blob objects and stage status codes.
If paths were provided in the command line show the staged paths
among the specified paths.
Otherwise, show all staged paths.
.It Fl p
Instead of staging the entire content of a changed file, interactively
select or reject changes for staging based on
.Dq y
(stage change),
.Dq n
(reject change), and
.Dq q
(quit staging this file) responses.
If a file is in modified status, individual patches derived from the
modified file content can be staged.
Files in added or deleted status may only be staged or rejected in
their entirety.
.It Fl F Ar response-script
With the
.Fl p
option, read
.Dq y ,
.Dq n ,
and
.Dq q
responses line-by-line from the specified
.Ar response-script
file instead of prompting interactively.
.El
.Pp
.Cm got stage
will refuse to run if certain preconditions are not met.
If a file contains merge conflicts, these conflicts must be resolved first.
If a file is found to be out of date relative to the head commit on the
work tree's current branch, the file must be updated with
.Cm got update
before it can be staged (however, this does not prevent the file from
becoming out-of-date at some point after having been staged).
.Pp
The
.Cm got update ,
.Cm got rebase ,
and
.Cm got histedit
commands will refuse to run while staged changes exist.
If staged changes cannot be committed because a staged path
is out of date, the path must be unstaged with
.Cm got unstage
before it can be updated with
.Cm got update ,
and may then be staged again if necessary.
.It Cm sg
Short alias for
.Cm stage .
.It Cm unstage Oo Fl p Oc Oo Fl F Ar response-script Oc Op Ar path ...
Merge staged changes back into the work tree and put affected paths
back into non-staged status.
If no
.Ar path
is specified, unstage all staged changes across the entire work tree.
Otherwise, unstage changes at or within the specified paths.
.Pp
Show the status of each affected file, using the following status codes:
.Bl -column YXZ description
.It G Ta file was unstaged
.It C Ta file was unstaged and conflicts occurred during merge
.It ! Ta changes destined for a missing file were not merged
.It D Ta file was staged as deleted and still is deleted
.It d Ta file's deletion was obstructed by local modifications
.It \(a~ Ta changes destined for a non-regular file were not merged
.El
.Pp
The options for
.Cm got unstage
are as follows:
.Bl -tag -width Ds
.It Fl p
Instead of unstaging the entire content of a changed file, interactively
select or reject changes for unstaging based on
.Dq y
(unstage change),
.Dq n
(keep change staged), and
.Dq q
(quit unstaging this file) responses.
If a file is staged in modified status, individual patches derived from the
staged file content can be unstaged.
Files staged in added or deleted status may only be unstaged in their entirety.
.It Fl F Ar response-script
With the
.Fl p
option, read
.Dq y ,
.Dq n ,
and
.Dq q
responses line-by-line from the specified
.Ar response-script
file instead of prompting interactively.
.El
.It Cm ug
Short alias for
.Cm unstage .
.It Cm cat Oo Fl c Ar commit Oc Oo Fl r Ar repository-path Oc Oo Fl P Oc Ar arg ...
Parse and print contents of objects to standard output in a line-based
text format.
Content of commit, tree, and tag objects is printed in a way similar
to the actual content stored in such objects.
Blob object contents are printed as they would appear in files on disk.
.Pp
Attempt to interpret each argument as a reference, a tag name, or
an object ID SHA1 hash.
References will be resolved to an object ID.
Tag names will resolved to a tag object.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.Pp
If none of the above interpretations produce a valid result, or if the
.Fl P
option is used, attempt to interpret the argument as a path which will
be resolved to the ID of an object found at this path in the repository.
.Pp
The options for
.Cm got cat
are as follows:
.Bl -tag -width Ds
.It Fl c Ar commit
Look up paths in the specified
.Ar commit .
If this option is not used, paths are looked up in the commit resolved
via the repository's HEAD reference.
The expected argument is a commit ID SHA1 hash or an existing reference
or tag name which will be resolved to a commit ID.
An abbreviated hash argument will be expanded to a full SHA1 hash
automatically, provided the abbreviation is unique.
.It Fl r Ar repository-path
Use the repository at the specified path.
If not specified, assume the repository is located at or above the current
working directory.
If this directory is a
.Nm
work tree, use the repository path associated with this work tree.
.It Fl P
Interpret all arguments as paths only.
This option can be used to resolve ambiguity in cases where paths
look like tag names, reference names, or object IDs.
.El
.El
.Sh ENVIRONMENT
.Bl -tag -width GOT_AUTHOR
.It Ev GOT_AUTHOR
The author's name and email address for
.Cm got commit
and
.Cm got import ,
for example:
.Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org .
Because
.Xr git 1
may fail to parse commits without an email address in author data,
.Nm
attempts to reject
.Ev GOT_AUTHOR
environment variables with a missing email address.
.Pp
If present, Git's
.Dv user.name
and
.Dv user.email
configuration settings in the repository's
.Pa .git/config
file will override the value of
.Ev GOT_AUTHOR .
However, the
.Dv user.name
and
.Dv user.email
configuration settings contained in Git's global
.Pa ~/.gitconfig
configuration file will be used only if the
.Ev GOT_AUTHOR
environment variable is
.Em not
set.
.It Ev VISUAL , EDITOR
The editor spawned by
.Cm got commit ,
.Cm got import ,
or
.Cm got tag .
.It Ev GOT_LOG_DEFAULT_LIMIT
The default limit on the number of commits traversed by
.Cm got log .
If set to zero, the limit is unbounded.
This variable will be silently ignored if it is set to a non-numeric value.
.El
.Sh EXIT STATUS
.Ex -std got
.Sh EXAMPLES
Clone an existing Git repository for use with
.Nm .
This step currently requires
.Xr git 1 :
.Pp
.Dl $ cd /var/git/
.Dl $ git clone --bare https://github.com/openbsd/src.git
.Pp
Alternatively, for quick and dirty local testing of
.Nm
a new Git repository could be created and populated with files,
e.g. from a temporary CVS checkout located at
.Pa /tmp/src :
.Pp
.Dl $ got init /var/git/src.git
.Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
.Pp
Check out a work tree from the Git repository to /usr/src:
.Pp
.Dl $ got checkout /var/git/src.git /usr/src
.Pp
View local changes in a work tree directory:
.Pp
.Dl $ got status
.Dl $ got diff | less
.Pp
Interactively revert selected local changes in a work tree directory:
.Pp
.Dl $ got revert -p -R\ .
.Pp
In a work tree or a git repository directory, list all branch references:
.Pp
.Dl $ got branch -l
.Pp
In a work tree or a git repository directory, create a new branch called
.Dq unified-buffer-cache
which is forked off the
.Dq master
branch:
.Pp
.Dl $ got branch unified-buffer-cache master
.Pp
Switch an existing work tree to the branch
.Dq unified-buffer-cache .
Local changes in the work tree will be preserved and merged if necessary:
.Pp
.Dl $ got update -b unified-buffer-cache
.Pp
Create a new commit from local changes in a work tree directory.
This new commit will become the head commit of the work tree's current branch:
.Pp
.Dl $ got commit
.Pp
In a work tree or a git repository directory, view changes committed in
the 3 most recent commits to the work tree's branch, or the branch resolved
via the repository's HEAD reference, respectively:
.Pp
.Dl $ got log -p -l 3 -f
.Pp
Add new files and remove obsolete files in a work tree directory:
.Pp
.Dl $ got add sys/uvm/uvm_ubc.c
.Dl $ got remove sys/uvm/uvm_vnode.c
.Pp
Create a new commit from local changes in a work tree directory
with a pre-defined log message.
.Pp
.Dl $ got commit -m 'unify the buffer cache'
.Pp
Update any work tree checked out from the
.Dq unified-buffer-cache
branch to the latest commit on this branch:
.Pp
.Dl $ got update
.Pp
Roll file content on the unified-buffer-cache branch back by one commit,
and then fetch the rolled-back change into the work tree as a local change
to be amended and perhaps committed again:
.Pp
.Dl $ got backout unified-buffer-cache
.Dl $ got commit -m 'roll back previous'
.Dl $ # now back out the previous backout :-)
.Dl $ got backout unified-buffer-cache
.Pp
Fetch new upstream commits into the local repository's master branch.
This step currently requires
.Xr git 1 :
.Pp
.Dl $ cd /var/git/src.git
.Dl $ git fetch origin master:master
.Pp
Rebase the
.Dq unified-buffer-cache
branch on top of the new head commit of the
.Dq master
branch.
.Pp
.Dl $ got update -b master
.Dl $ got rebase unified-buffer-cache
.Pp
Create a patch from all changes on the unified-buffer-cache branch.
The patch can be mailed out for review and applied to
.Ox Ns 's
CVS tree:
.Pp
.Dl $ got diff master unified-buffer-cache > /tmp/ubc.diff
.Pp
Edit the entire commit history of the
.Dq unified-buffer-cache
branch:
.Pp
.Dl $ got update -b unified-buffer-cache
.Dl $ got update -c master
.Dl $ got histedit
.Pp
Additional steps are necessary if local changes need to be pushed back
to the remote repository, which currently requires
.Cm git fetch
and
.Cm git push .
Before working against existing branches in a repository cloned with
.Dq git clone --bare ,
a Git
.Dq refspec
must be configured to map all references in the remote repository
into the
.Dq refs/remotes
namespace of the local repository.
This can achieved by setting Git's
.Pa remote.origin.fetch
configuration variable to the value
.Dq +refs/heads/*:refs/remotes/origin/*
with the
.Cm git config
command:
.Pp
.Dl $ cd /var/git/repo
.Dl $ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
.Pp
Alternatively, the following
.Pa fetch
configuration item can be added manually to the Git repository's
.Pa config
file:
.Pp
.Dl [remote "origin"]
.Dl url = ...
.Dl fetch = +refs/heads/*:refs/remotes/origin/*
.Pp
This configuration leaves the local repository's
.Dq refs/heads
namespace free for use by local branches checked out with
.Cm got checkout
and, if needed, created with
.Cm got branch .
.Pp
Branches in the
.Dq remotes/origin
namespace can be updated with incoming changes from the remote
repository with
.Cm git fetch :
.Pp
.Dl $ cd /var/git/repo
.Dl $ git fetch
.Pp
Before outgoing changes on the local
.Dq master
branch can be pushed to the remote repository, the local
.Dq master
branch must be rebased onto the
.Dq origin/master
branch:
.Pp
.Dl $ got update -b origin/master
.Dl $ got rebase master
.Pp
Changes on the local
.Dq master
branch can then be pushed to the remote
repository with
.Cm git push :
.Pp
.Dl $ cd /var/git/repo
.Dl $ git push origin master
.Pp
In order to merge changes committed to the
.Dq unified-buffer-cache
branch back into the
.Dq master
branch, the
.Dq unified-buffer-cache
branch must first be rebased onto the
.Dq master
branch:
.Pp
.Dl $ got update -b master
.Dl $ got rebase unified-buffer-cache
.Pp
Changes on the
.Dq unified-buffer-cache
branch can now be made visible on the
.Dq master
branch with
.Cm got integrate .
Because the rebase operation switched the work tree to the
.Dq unified-buffer-cache
branch, the work tree must be switched back to the
.Dq master
branch before the
.Dq unified-buffer-cache
branch can be integrated into
.Dq master :
.Pp
.Dl $ got update -b master
.Dl $ got integrate unified-buffer-cache
.Sh SEE ALSO
.Xr tog 1 ,
.Xr git-repository 5 ,
.Xr got-worktree 5
.Sh AUTHORS
.An Stefan Sperling Aq Mt stsp@openbsd.org
.An Martin Pieuchot Aq Mt mpi@openbsd.org
.An Joshua Stein Aq Mt jcs@openbsd.org
.Sh CAVEATS
.Nm
is a work-in-progress and many commands remain to be implemented.
At present, the user has to fall back on
.Xr git 1
to perform many tasks, in particular tasks related to repository
administration and tasks which require a network connection.