.\" .\" 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 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 an author has been configured in .Xr got.conf 5 or 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 clone Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl l Oc Oo Fl m Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Ar repository-URL Op Ar directory Clone a Git repository at the specified .Ar repository-URL into the specified .Ar directory . If no .Ar directory is specified the directory name will be derived from the name of the cloned repository. .Cm got clone will refuse to run if the .Ar directory already exists. .Pp The .Ar repository-URL specifies a protocol scheme, a server hostname, an optional port number separated from the hostname by a colon, and a path to the repository on the server: .Lk scheme://hostname:port/path/to/repository .Pp The following protocol schemes are supported: .Bl -tag -width git+ssh .It git The Git protocol as implemented by the .Xr git-daemon 1 server. Use of this protocol is discouraged since it supports neither authentication nor encryption. .It git+ssh The Git protocol wrapped in an authenticated and encrypted .Xr ssh 1 tunnel. With this protocol the hostname may contain an embedded username for .Xr ssh 1 to use: .Mt user@hostname .It ssh Short alias for git+ssh. .El .Pp Objects in the cloned repository are stored in a pack file which is downloaded from the server. This pack file will then be indexed to facilitate access to the objects stored within. If any objects in the pack file are stored in deltified form, all deltas will be fully resolved in order to compute the ID of such objects. This can take some time. More details about the pack file format are documented in .Xr git-repository 5 . .Pp .Cm got clone creates a remote repository entry in the .Xr got.conf 5 and .Pa config files of the cloned repository to store the .Ar repository-url and any .Ar branch or .Ar reference arguments for future use by .Cm got fetch or .Xr git-fetch 1 . .Pp The options for .Cm got clone are as follows: .Bl -tag -width Ds .It Fl a Fetch all branches from the remote repository's .Dq refs/heads/ reference namespace and set .Cm fetch-all-branches in the cloned repository's .Xr got.conf 5 file for future use by .Cm got fetch . If this option is not specified, a branch resolved via the remote repository's HEAD reference will be fetched. Cannot be used together with the .Fl b option. .It Fl b Ar branch Fetch the specified .Ar branch from the remote repository's .Dq refs/heads/ reference namespace. This option may be specified multiple times to build a list of branches to fetch. If the branch corresponding to the remote repository's HEAD reference is not in this list, the cloned repository's HEAD reference will be set to the first branch which was fetched. If this option is not specified, a branch resolved via the remote repository's HEAD reference will be fetched. Cannot be used together with the .Fl a option. .It Fl l List branches and tags available for fetching from the remote repository and exit immediately. Cannot be used together with any of the other options except .Fl q and .Fl v . .It Fl m Create the cloned repository as a mirror of the original repository. This is useful if the cloned repository will not be used to store locally created commits. .Pp The repository's .Xr got.conf 5 and .Pa config files will be set up with the .Dq mirror option enabled, such that .Cm got fetch or .Xr git-fetch 1 will write incoming changes directly to branches in the .Dq refs/heads/ reference namespace, rather than to branches in the .Dq refs/remotes/ namespace. This avoids the usual requirement of having to run .Cm got rebase after .Cm got fetch in order to make incoming changes appear on branches in the .Dq refs/heads/ namespace. But maintaining custom changes in the cloned repository becomes difficult since such changes will be at risk of being discarded whenever incoming changes are fetched. .It Fl q Suppress progress reporting output. The same option will be passed to .Xr ssh 1 if applicable. .It Fl v Verbose mode. Causes .Cm got clone to print debugging messages to standard error output. This option will be passed to .Xr ssh 1 if applicable. Multiple -v options increase the verbosity. The maximum is 3. .It Fl R Ar reference In addition to the branches and tags that will be fetched, fetch an arbitrary .Ar reference from the remote repository's .Dq refs/ namespace. This option may be specified multiple times to build a list of additional references to fetch. The specified .Ar reference may either be a path to a specific reference, or a reference namespace which will cause all references in this namespace to be fetched. .Pp Each reference will be mapped into the cloned repository's .Dq refs/remotes/ namespace, unless the .Fl m option is used to mirror references directly into the cloned repository's .Dq refs/ namespace. .Pp .Cm got clone will refuse to fetch references from the remote repository's .Dq refs/remotes/ or .Dq refs/got/ namespace. .El .It Cm cl Short alias for .Cm clone . .It Cm fetch Oo Fl a Oc Oo Fl b Ar branch Oc Oo Fl d Oc Oo Fl l Oc Oo Fl r Ar repository-path Oc Oo Fl t Oc Oo Fl q Oc Oo Fl v Oc Oo Fl R Ar reference Oc Op Ar remote-repository Fetch new changes from a remote repository. If no .Ar remote-repository is specified, .Dq origin will be used. The remote repository's URL is obtained from the corresponding entry in .Xr got.conf 5 or Git's .Pa config file of the local repository, as created by .Cm got clone . .Pp New changes will be stored in a separate pack file downloaded from the server. Optionally, separate pack files stored in the repository can be combined with .Xr git-repack 1 . .Pp By default, branch references in the .Dq refs/remotes/ reference namespace will be updated to point at the newly fetched commits. The .Cm got rebase command can then be used to make new changes visible on branches in the .Dq refs/heads/ namespace, merging incoming changes with the changes on those branches as necessary. .Pp If the repository was created as a mirror with .Cm got clone -m then all branches in the .Dq refs/heads/ namespace will be updated directly to match the corresponding branches in the remote repository. If those branches contained local commits, these commits will no longer be reachable via a reference and will therefore be at risk of being discarded by Git's garbage collector. Maintaining custom changes in a mirror repository is therefore discouraged. .Pp In any case, references in the .Dq refs/tags/ namespace will always be fetched and mapped directly to local references in the same namespace. .Pp The options for .Cm got fetch are as follows: .Bl -tag -width Ds .It Fl a Fetch all branches from the remote repository's .Dq refs/heads/ reference namespace. This option can be enabled by default for specific repositories in .Xr got.conf 5 . If this option is not specified, a branch resolved via the remote repository's HEAD reference will be fetched. Cannot be used together with the .Fl b option. .It Fl b Ar branch Fetch the specified .Ar branch from the remote repository's .Dq refs/heads/ reference namespace. This option may be specified multiple times to build a list of branches to fetch. If this option is not specified, a branch resolved via the remote repository's HEAD reference will be fetched. Cannot be used together with the .Fl a option. .It Fl d Delete branches and tags from the local repository which are no longer present in the remote repository. Only references are deleted. Any commit, tree, tag, and blob objects belonging to deleted branches or tags remain in the repository and may be removed separately with Git's garbage collector. .It Fl l List branches and tags available for fetching from the remote repository and exit immediately. Cannot be used together with any of the other options except .Fl v , .Fl q , and .Fl r . .It Fl t Allow existing references in the .Dq refs/tags namespace to be updated if they have changed on the server. If not specified, only new tag references will be created. .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 q Suppress progress reporting output. The same option will be passed to .Xr ssh 1 if applicable. .It Fl v Verbose mode. Causes .Cm got fetch to print debugging messages to standard error output. The same option will be passed to .Xr ssh 1 if applicable. Multiple -v options increase the verbosity. The maximum is 3. .It Fl R Ar reference In addition to the branches and tags that will be fetched, fetch an arbitrary .Ar reference from the remote repository's .Dq refs/ namespace. This option may be specified multiple times to build a list of additional references to fetch. The specified .Ar reference may either be a path to a specific reference, or a reference namespace which will cause all references in this namespace to be fetched. .Pp Each reference will be mapped into the local repository's .Dq refs/remotes/ namespace, unless the local repository was created as a mirror with .Cm got clone -m in which case references will be mapped directly into the local repository's .Dq refs/ namespace. .Pp Once a reference has been fetched, a branch based on it can be created with .Cm got branch if needed. .Pp .Cm got fetch will refuse to fetch references from the remote repository's .Dq refs/remotes/ or .Dq refs/got/ namespace. .El .It Cm fe Short alias for .Cm fetch . .It Cm checkout Oo Fl E Oc Oo Fl b Ar branch Oc Oo Fl c Ar commit Oc Oo Fl p Ar path-prefix Oc Ar repository-path Op Ar work-tree-path 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. .Pp If the specified .Ar commit is not contained in the selected branch, a different branch which contains this commit must be specified with the .Fl b option. If no such branch is known a new branch must be created for this commit with .Cm got branch before .Cm got checkout can be used. Checking out work trees with an unknown branch is intentionally not supported. .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 .Ar commit . Change existing files in the work tree as necessary to match file contents of this commit. Preserve any local changes in the work tree and merge them with the incoming changes. .Pp Files which already contain merge conflicts will not be updated to avoid further complications. Such files will be updated when .Cm got update is run again after merge conflicts have been resolved. If the conflicting changes are no longer needed affected files can be reverted with .Cm got revert before running .Cm got update again. .Pp 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 .It # Ta file was not updated because it contains merge conflicts .It ? Ta changes destined for an unversioned file were not merged .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. .Pp As usual, any local changes in the work tree will be preserved. This can be useful when switching to a newly created branch in order to commit existing local changes to this branch. .Pp Any local changes must be dealt with separately in order to obtain a work tree with pristine file contents corresponding exactly to the specified .Ar branch . Such changes could first be committed to a different branch with .Cm got commit , or could be discarded with .Cm got revert . .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 Oo Fl I Oc Oo Fl s Ar status-codes Oc 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 The options for .Cm got status are as follows: .Bl -tag -width Ds .It Fl I Show unversioned files even if they match an ignore pattern. .It Fl s Ar status-codes Only show files with a modification status matching any of the single-character status codes contained in the .Ar status-codes argument. Any combination of codes from the above list of possible status codes may be specified. For staged files, status codes displayed in either column will be matched. .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 b Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl P Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Oo Fl R Oc Oo Fl x Ar commit Oc Op Ar path Display history of a repository. If a .Ar path is specified, show only commits which modified this path. If invoked in a work tree, the .Ar path is interpreted relative to the current working directory, and the work tree's path prefix is implicitly prepended. Otherwise, the path is interpreted relative to the repository root. .Pp The options for .Cm got log are as follows: .Bl -tag -width Ds .It Fl b Display individual commits which were merged into the current branch from other branches. By default, .Cm got log shows the linear history of the current branch only. .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 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 P Display the list of file paths changed in each commit, 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 .It Fl s Ar search-pattern If specified, show only commits with a log message matched by the extended regular expression .Ar search-pattern . When used together with .Fl P then the file paths changed by a commit can be matched as well. 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. .It Fl R Determine a set of commits to display as usual, but display these commits in reverse order. .It Fl x Ar commit Stop traversing commit history immediately after the specified .Ar commit has been traversed. This option has no effect if the specified .Ar commit is never traversed. .El .It Cm diff Oo Fl a Oc 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 local 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 a Treat file contents as ASCII text even if binary data is detected. .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 in the work tree. 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 Symbolic link entries are also annotated with the target path of the link. .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 c Ar object Oc Oo Fl s Ar reference Oc Oo Fl d Oc Op Ar name Manage references in a repository. .Pp References may be listed, created, deleted, and changed. When creating, deleting, or changing a reference the specified .Ar name must be an absolute reference name, i.e. it must begin with .Dq refs/ . .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 references in the repository. If no .Ar name is specified, list all existing references in the repository. If .Ar name is a reference namespace, list all references in this namespace. Otherwise, show only the reference with the given .Ar name . Cannot be used together with any other options except .Fl r . .It Fl c Ar object Create a reference or change an existing reference. The reference with the specified .Ar name will point at the specified .Ar object . The expected .Ar object argument is a ID SHA1 hash or an existing reference or tag name which will be resolved to the ID of a corresponding commit, tree, tag, or blob object. Cannot be used together with any other options except .Fl r . .It Fl s Ar reference Create a symbolic reference, or change an existing symbolic reference. The symbolic reference with the specified .Ar name will point at the specified .Ar reference which must already exist in the repository. Care should be taken not to create loops between references when this option is used. Cannot be used together with any other options except .Fl r . .It Fl d Delete the reference with the specified .Ar name from the repository. Any commit, tree, tag, and blob objects belonging to deleted references remain in the repository and may be removed separately with Git's garbage collector. Cannot be used together with any other options except .Fl r . .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 Oo Fl n Oc Op Ar name Create, list, or delete branches. .Pp Local branches are managed via references which live in the .Dq refs/heads/ reference namespace. The .Cm got branch command creates or deletes 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. .Pp 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 If invoked in a work tree, once the branch was created successfully switch the work tree's head reference to the newly created branch and update files across the entire work tree, just like .Cm got update -b Ar name would do. 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 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, including copies of remote repositories' branches in the .Dq refs/remotes/ reference namespace. .Pp 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. .It Fl n Do not switch and update the work tree after creating a new branch. .El .It Cm br Short alias for .Cm branch . .It Cm tag Oo Fl c Ar commit Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl l Oc Ar name 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 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. .Pp The options for .Cm got tag are as follows: .Bl -tag -width Ds .It Fl c Ar commit Make the newly created tag 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. An abbreviated hash argument will be expanded to a full SHA1 hash automatically, provided the abbreviation is unique. .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 Oo Fl s Ar status-codes 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 local 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. .It Fl s Ar status-codes Only delete files with a modification status matching one of the single-character status codes contained in the .Ar status-codes argument. The following status codes may be specified: .Bl -column YXZ description .It M Ta modified file (this implies the .Fl f option) .It ! Ta versioned file expected on disk but missing .El .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 local changes in files at the specified paths in a work tree. 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 F Ar path Oc Oo Fl m Ar message Oc Oo Fl N Oc Oo Fl S 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 .Cm got commit opens a temporary file in an editor where a log message can be written unless the .Fl m option is used or the .Fl F and .Fl N options are used together. .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 an author has been configured in .Xr got.conf 5 or 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 F Ar path Use the prepared log message stored in the file found at .Ar path when creating the new commit. .Cm got commit opens a temporary file in an editor where the prepared log message can be reviewed and edited further if needed. Cannot be used together with the .Fl m option. .It Fl m Ar message Use the specified log message when creating the new commit. Cannot be used together with the .Fl F option. .It Fl N This option prevents .Cm got commit from opening the commit message in an editor. It has no effect unless it is used together with the .Fl F option and is intended for non-interactive use such as scripting. .It Fl S Allow the addition of symbolic links which point outside of the path space that is under version control. By default, .Cm got commit will reject such symbolic links due to safety concerns. As a precaution, .Nm may decide to represent such a symbolic link as a regular file which contains the link's target path, rather than creating an actual symbolic link which points outside of the work tree. Use of this option is discouraged because external mechanisms such as .Dq make obj are better suited for managing symbolic links to paths not under version control. .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 .It ? Ta changes destined for an unversioned 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 .It ? Ta changes destined for an unversioned 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 Oo Fl l 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 When .Cm got rebase is used as intended, the specified .Ar branch represents a local commit history and may already contain changes that are not yet visible in any other repositories. The work tree's current branch, which must be set with .Cm got update -b before starting the .Cm rebase operation, represents a branch from a remote repository which shares a common history with the specified .Ar branch but has progressed, and perhaps diverged, due to commits added to the remote repository. .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 Old commits in their pre-rebase state are automatically backed up in the .Dq refs/got/backup/rebase reference namespace. As long as these references are not removed older versions of rebased commits will remain in the repository and can be viewed with the .Cm got rebase -l command. Removal of these references makes objects which become unreachable via any reference subject to removal by Git's garbage collector. .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 .It ? Ta changes destined for an unversioned 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. .It Fl l Show a list of past rebase operations, represented by references in the .Dq refs/got/backup/rebase reference namespace. .Pp Display the author, date, and log message of each backed up commit, the object ID of the corresponding post-rebase commit, and the object ID of their common ancestor commit. Given these object IDs, the .Cm got log command with the .Fl c and .Fl x options can be used to examine the history of either version of the branch, and the .Cm got branch command with the .Fl c option can be used to create a new branch from a pre-rebase state if desired. .Pp If a .Ar branch is specified, only show commits which at some point in time represented this branch. Otherwise, list all backed up commits for any branches. .Pp If this option is used, .Cm got rebase does not require a work tree. None of the other options can be used together with .Fl l . .El .It Cm rb Short alias for .Cm rebase . .It Cm histedit Oo Fl a Oc Oo Fl c Oc Oo Fl f Oc Oo Fl F Ar histedit-script Oc Oo Fl m Oc Oo Fl l Oc Op Ar branch Edit commit history between the work tree's current base commit and the tip commit of the work tree's current branch. .Pp Before starting a .Cm histedit operation the work tree's current branch must be set with .Cm got update -b to the branch which should be edited, unless this branch is already the current branch of the work tree. The tip of this branch represents the upper bound (inclusive) of commits touched by the .Cm histedit operation. .Pp Furthermore, the work tree's base commit must be set with .Cm got update -c to a point in this branch's commit history where editing should begin. This commit represents the lower bound (non-inclusive) of commits touched by the .Cm histedit operation. .Pp Editing of commit history is controlled via a .Ar histedit script which can be written in an editor based on a template, passed on the command line, or generated with the .Fl f or .Fl m options. .Pp 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. No commit may be listed more than once. .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 Old commits in their pre-histedit state are automatically backed up in the .Dq refs/got/backup/histedit reference namespace. As long as these references are not removed older versions of edited commits will remain in the repository and can be viewed with the .Cm got histedit -l command. Removal of these references makes objects which become unreachable via any reference subject to removal by Git's garbage collector. .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 .It ? Ta changes destined for an unversioned 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 , .Cm got rebase , and .Cm got integrate commands 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. .It Fl f Fold all commits into a single commit. This option is a quick equivalent to a histedit script which folds all commits, combining them all into one commit. The .Fl f option can only be used when starting a new histedit operation. If this option is used, no other command-line arguments are allowed. .It Fl F Ar histedit-script Use the specified .Ar histedit-script instead of opening a temporary file in an editor where a histedit script can be written. .It Fl m Edit log messages only. This option is a quick equivalent to a histedit script which edits only log messages but otherwise leaves every picked commit as-is. The .Fl m option can only be used when starting a new histedit operation. If this option is used, no other command-line arguments are allowed. .It Fl l Show a list of past histedit operations, represented by references in the .Dq refs/got/backup/histedit reference namespace. .Pp Display the author, date, and log message of each backed up commit, the object ID of the corresponding post-histedit commit, and the object ID of their common ancestor commit. Given these object IDs, the .Cm got log command with the .Fl c and .Fl x options can be used to examine the history of either version of the branch, and the .Cm got branch command with the .Fl c option can be used to create a new branch from a pre-histedit state if desired. .Pp If a .Ar branch is specified, only show commits which at some point in time represented this branch. Otherwise, list all backed up commits for any branches. .Pp If this option is used, .Cm got histedit does not require a work tree. None of the other options can be used together with .Fl l . .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 Oo Fl S 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. .It Fl S Allow staging of symbolic links which point outside of the path space that is under version control. By default, .Cm got stage will reject such symbolic links due to safety concerns. As a precaution, .Nm may decide to represent such a symbolic link as a regular file which contains the link's target path, rather than creating an actual symbolic link which points outside of the work tree. Use of this option is discouraged because external mechanisms such as .Dq make obj are better suited for managing symbolic links to paths not under version control. .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 .It Cm info Op Ar path ... Display meta-data stored in a work tree. See .Xr got-worktree 5 for details. .Pp The work tree to use is resolved implicitly by walking upwards from the current working directory. .Pp If one or more .Ar path arguments are specified, show additional per-file information for tracked files located at or within these paths. If a .Ar path argument corresponds to the work tree's root directory, display information for all tracked files. .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 .Ev GOT_AUTHOR will be overriden by configuration settings in .Xr got.conf 5 or by Git's .Dv user.name and .Dv user.email configuration settings in the repository's .Pa .git/config file. The .Dv user.name and .Dv user.email configuration settings contained in Git's global .Pa ~/.gitconfig configuration file will only be used if neither .Xr got.conf 5 nor the .Ev GOT_AUTHOR environment variable provide author information. .It Ev VISUAL , EDITOR The editor spawned by .Cm got commit , .Cm got histedit , .Cm got import , or .Cm got tag . If not set, the .Xr ed 1 text editor will be spawned in order to give .Xr ed 1 the attention it deserves. .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 FILES .Bl -tag -width packed-refs -compact .It Pa got.conf Repository-wide configuration settings for .Nm . If present, a .Xr got.conf 5 configuration file located in the root directory of a Git repository supersedes any relevant settings in Git's .Pa config file. .Pp .It Pa .got/got.conf Worktree-specific configuration settings for .Nm . If present, a .Xr got.conf 5 configuration file in the .Pa .got meta-data directory of a work tree supersedes any relevant settings in the repository's .Xr got.conf 5 configuration file and Git's .Pa config file. .El .Sh EXIT STATUS .Ex -std got .Sh EXAMPLES Clone an existing Git repository for use with .Nm . .Pp .Dl $ cd /var/git/ .Dl $ got clone ssh://git@github.com/openbsd/src.git .Pp Use of HTTP URLs 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 diff | less .Pp In a work tree, display files in a potentially problematic state: .Pp .Dl $ got status -s 'C!~?' .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 -c master unified-buffer-cache .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 .Pp As above, but display changes in the order in which .Xr patch 1 could apply them in sequence: .Pp .Dl $ got log -p -l 3 -R .Pp In a work tree or a git repository directory, log the history of a subdirectory: .Pp .Dl $ got log sys/uvm .Pp While operating inside a work tree, paths are specified relative to the current working directory, so this command will log the subdirectory .Pa sys/uvm : .Pp .Dl $ cd sys/uvm && got log\ . .Pp And this command has the same effect: .Pp .Dl $ cd sys/dev/usb && got log ../../uvm .Pp And this command displays work tree meta-data about all tracked files: .Pp .Dl $ cd /usr/src .Dl $ got info\ . | less .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 Alternatively, create a new commit from local changes in a work tree directory with a log message that has been prepared in the file .Pa /tmp/msg : .Pp .Dl $ got commit -F /tmp/msg .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 .Dq origin/master branch: .Pp .Dl $ cd /usr/src .Dl $ got fetch .Pp In a repository created with a HTTP URL and .Cm git clone --bare the .Xr git-fetch 1 command must be used instead: .Pp .Dl $ cd /var/git/src.git .Dl $ git fetch origin master:refs/remotes/origin/master .Pp Rebase the local .Dq master branch to merge the new changes that are now visible on the .Dq origin/master branch: .Pp .Dl $ cd /usr/src .Dl $ got update -b origin/master .Dl $ got rebase 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 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 .Pp Additional steps may be necessary if local changes need to be pushed back to the remote repository, which currently requires .Cm git push . Before working against existing branches in a repository cloned with .Cm git clone --bare instead of .Cm got clone , 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 be 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 Additionally, the .Dq mirror option must be disabled: .Pp .Dl $ cd /var/git/repo .Dl $ git config remote.origin.mirror false .Pp Alternatively, the following .Xr git-fetch 1 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/* .Dl mirror = false .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 now be updated with incoming changes from the remote repository with .Cm got fetch or .Xr git-fetch 1 without extra command line arguments: .Pp .Dl $ cd /var/git/repo .Dl $ git fetch .Pp To make changes fetched from the remote repository appear on the .Dq master branch, the .Dq master branch must be rebased onto the .Dq origin/master branch. This will also merge local changes, if any, with the incoming changes: .Pp .Dl $ got update -b origin/master .Dl $ got rebase master .Pp On the .Dq master branch, log messages for local changes can now be amended with .Dq OK by other developers and any other important new information: .Pp .Dl $ got update -c origin/master .Dl $ got histedit -m .Pp Local changes on the .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 .Sh SEE ALSO .Xr gotadmin 1 , .Xr tog 1 , .Xr git-repository 5 , .Xr got-worktree 5 , .Xr got.conf 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 .An Ori Bernstein Aq Mt ori@openbsd.org .Sh CAVEATS .Nm is a work-in-progress and some features remain to be implemented. .Pp At present, the user has to fall back on .Xr git 1 to perform some tasks. In particular: .Bl -bullet .It Reading from remote repositories over HTTP or HTTPS protocols requires .Xr git-clone 1 and .Xr git-fetch 1 . .It Writing to remote repositories, over any protocol, requires .Xr git-push 1 . .It Packing repositories, which reduces disk space consumption and improves read-access performance, requires .Xr git-repack 1 . .It Exporting data from repositories requires .Xr git-fast-export 1 . .It Importing data into repositories requires .Xr git-fast-import 1 . .It Reducing the size of repositories by removing redundant or unreferenced data requires .Xr git-gc 1 . .It The creation of merge commits, i.e. commits with two or more parent commits, requires .Xr git-merge 1 . .It In situations where files or directories were moved around .Cm got will not automatically merge changes to new locations and .Xr git 1 will usually produce better results. .El