.\" .\" 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 .Op Fl hV .Ar command .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 .Tg im .It Xo .Cm import .Op Fl b Ar branch .Op Fl I Ar pattern .Op Fl m Ar message .Op Fl r Ar repository-path .Ar directory .Xc .Dl Pq alias: Cm im 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 . If this option is not specified, a branch corresponding to the repository's HEAD reference will be used. Use of this option is required if the branch resolved via the repository's HEAD reference already exists. .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 . Ignore patterns which end with a slash, .Dq / , will only match directories. .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. .El .Tg cl .It Xo .Cm clone .Op Fl almqv .Op Fl b Ar branch .Op Fl R Ar reference .Ar repository-URL .Op Ar directory .Xc .Dl Pq alias: Cm cl 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 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. .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. .El .Tg fe .It Xo .Cm fetch .Op Fl adlqtvX .Op Fl b Ar branch .Op Fl R Ar reference .Op Fl r Ar repository-path .Op Ar remote-repository .Xc .Dl Pq alias: Cm fe 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 By default, any branches configured in .Xr got.conf 5 for the .Ar remote-repository will be fetched. If .Cm got fetch is invoked in a work tree then this work tree's current branch will be fetched, too, provided it is present on the server. If no branches to fetch can be found in .Xr got.conf 5 or via a work tree, or said branches are not found on the server, a branch resolved via the remote repository's HEAD reference will be fetched. Likewise, if a HEAD reference for the .Ar remote-repository exists but its target no longer matches the remote HEAD, then the new target branch will be fetched. This default behaviour can be overridden with the .Fl a and .Fl b options. .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 or .Cm gotadmin cleanup . 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 . 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. 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 or .Cm gotadmin cleanup . .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 q Suppress progress reporting output. The same option will be passed to .Xr ssh 1 if applicable. .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. .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 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 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 X Delete all references which correspond to a particular .Ar remote-repository instead of fetching new changes. This can be useful when a remote repository is being removed from .Xr got.conf 5 . .Pp With .Fl X , the .Ar remote-repository argument is mandatory and no other options except .Fl r , .Fl v , and .Fl q are allowed. .Pp Only references are deleted. Any commit, tree, tag, and blob objects fetched from a remote repository will generally be stored in pack files and may be removed separately with .Xr git-repack 1 and Git's garbage collector. .El .Tg co .It Xo .Cm checkout .Op Fl Eq .Op Fl b Ar branch .Op Fl c Ar commit .Op Fl p Ar path-prefix .Ar repository-path .Op Ar work-tree-path .Xc .Dl Pq alias: Cm co 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 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 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 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. .It Fl q Silence progress output. .El .Tg up .It Xo .Cm update .Op Fl q .Op Fl b Ar branch .Op Fl c Ar commit .Op Ar path ... .Xc .Dl Pq alias: Cm up 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 d Ta file's deletion was prevented by local modifications .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. .It Fl q Silence progress output. .El .Tg st .It Xo .Cm status .Op Fl I .Op Fl S Ar status-codes .Op Fl s Ar status-codes .Op Ar path ... .Xc .Dl Pq alias: Cm st 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 Suppress the output of 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. Cannot be used together with the .Fl s option. .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. Cannot be used together with the .Fl S option. .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. Ignore patterns which end with a slash, .Dq / , will only match directories. 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 Xo .Cm log .Op Fl bdPpRs .Op Fl C Ar number .Op Fl c Ar commit .Op Fl l Ar N .Op Fl r Ar repository-path .Op Fl S Ar search-pattern .Op Fl x Ar commit .Op Ar path .Xc 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 number Set the number of context lines shown in diffs with .Fl p . By default, 3 lines of context are shown. .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 d Display diffstat of changes introduced in each commit. Cannot be used with the .Fl s option. .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 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 .Pp Cannot be used with the .Fl s option. .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. Cannot be used with the .Fl s option. .It Fl R Determine a set of commits to display as usual, but display these commits in reverse order. .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 Ar search-pattern If specified, show only commits with a log message, author name, committer name, or ID SHA1 hash matched by the extended regular expression .Ar search-pattern . Lines in committed patches will be matched if .Fl p is specified. File paths changed by a commit will be matched if .Fl P is specified. Regular expression syntax is documented in .Xr re_format 7 . .It Fl s Display a short one-line summary of each commit, instead of the default history format. Cannot be used together with the .Fl p or .Fl P option. .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 .Tg di .It Xo .Cm diff .Op Fl adPsw .Op Fl C Ar number .Op Fl c Ar commit .Op Fl r Ar repository-path .Op Ar object1 Ar object2 | Ar path ... .Xc .Dl Pq alias: Cm di When invoked within a work tree without any arguments, display all local changes in the work tree. If one or more .Ar path arguments are specified, only show changes within the specified paths. .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. If none of these interpretations produce a valid result or if the .Fl P option is used, and if .Cm got diff is running in a work tree, attempt to interpret the two arguments as paths. .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 c Ar commit Show differences between commits in the repository. This option may be used up to two times. When used only once, show differences between the specified .Ar commit and its first parent commit. When used twice, show differences between the two specified commits. .Pp 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 If the .Fl c option is used, all non-option arguments will be interpreted as paths. If one or more such .Ar path arguments are provided, only show differences for the specified paths. .Pp Cannot be used together with the .Fl P option. .It Fl d Display diffstat of changes before the actual diff by annotating each file path or blob hash being diffed with the total number of lines added and removed. A summary line will display the total number of changes across all files. .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. This option is only valid when .Cm got diff is invoked in a work tree. .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 .Tg bl .It Xo .Cm blame .Op Fl c Ar commit .Op Fl r Ar repository-path .Ar path .Xc .Dl Pq alias: Cm bl 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 .Tg tr .It Xo .Cm tree .Op Fl iR .Op Fl c Ar commit .Op Fl r Ar repository-path .Op Ar path .Xc .Dl Pq alias: Cm tr 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 i Show object IDs of files (blob objects) and directories (tree objects). .It Fl R Recurse into sub-directories in the repository. .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 Xo .Cm ref .Op Fl dlt .Op Fl c Ar object .Op Fl r Ar repository-path .Op Fl s Ar reference .Op Ar name .Xc 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 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 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 or .Cm gotadmin cleanup . Cannot be used together with any other options except .Fl r . .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 and .Fl t . .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 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 t Sort listed references by modification time (most recently modified first) instead of sorting by lexicographical order. Use of this option requires the .Fl l option to be used as well. .El .Tg br .It Xo .Cm branch .Op Fl lnt .Op Fl c Ar commit .Op Fl d Ar name .Op Fl r Ar repository-path .Op Ar name .Xc .Dl Pq alias: Cm br 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 references in this namespace only. .Pp When deleting branches, the specified .Ar name is searched in the .Dq refs/heads reference namespace first. If no corresponding branch is found, the .Dq refs/remotes namespace will be searched next. .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 d Ar name Delete the branch with the specified .Ar name from the .Dq refs/heads or .Dq refs/remotes reference namespace. .Pp 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 or .Cm gotadmin cleanup . .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 n Do not switch and update the work tree after creating a new branch. .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 t Sort listed branches by modification time (most recently modified first) instead of sorting by lexicographical order. Branches in the .Dq refs/heads/ reference namespace are listed before branches in .Dq refs/remotes/ regardless. Use of this option requires the .Fl l option to be used as well. .El .It Xo .Cm tag .Op Fl lVv .Op Fl c Ar commit .Op Fl m Ar message .Op Fl r Ar repository-path .Op Fl s Ar signer-id .Ar name .Xc 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 l List all existing tags in the repository instead of creating a new tag. If a .Ar name argument is passed, show only the tag with the given .Ar name . .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 s Ar signer-id While creating a new tag, sign this tag with the identity given in .Ar signer-id . .Pp For SSH-based signatures, .Ar signer-id is the path to a file which may refer to either a private SSH key, or a public SSH key with the private half available via .Xr ssh-agent 1 . .Cm got tag will sign the tag object by invoking .Xr ssh-keygen 1 with the .Fl Y Cm sign command, using the signature namespace .Dq git for compatibility with .Xr git 1 . .It Fl V Verify tag object signatures. If a .Ar name is specified, show and verify the tag object with the provided name. Otherwise, list all tag objects and verify signatures where present. .Pp .Cm got tag verifies SSH-based signatures by invoking .Xr ssh-keygen 1 with the options .Fl Y Cm verify Fl f Ar allowed_signers . A path to the .Ar allowed_signers file must be set in .Xr got.conf 5 , otherwise verification is impossible. .It Fl v Verbose mode. During SSH signature creation and verification this option will be passed to .Xr ssh-keygen 1 . Multiple -v options increase the verbosity. The maximum is 3. .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 Xo .Cm add .Op Fl IR .Ar path ... .Xc Schedule unversioned files in a work tree for addition to the repository in the next commit. By default, files which match a .Cm got status ignore pattern will not be added. .Pp The options for .Cm got add are as follows: .Bl -tag -width Ds .It Fl I Add files even if they match a .Cm got status ignore pattern. .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. .El .Tg rm .It Xo .Cm remove .Op Fl fkR .Op Fl s Ar status-codes .Ar path ... .Xc .Dl Pq alias: Cm rm 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, and do not raise an error if a specified .Ar path does not exist on disk. .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 .Tg pa .It Xo .Cm patch .Op Fl nR .Op Fl c Ar commit .Op Fl p Ar strip-count .Op Ar patchfile .Xc .Dl Pq alias: Cm pa Apply changes from .Ar patchfile to files in a work tree. Files added or removed by a patch will be scheduled for addition or removal in the work tree. .Pp The patch must be in the unified diff format as produced by .Cm got diff , .Xr git-diff 1 , or by .Xr diff 1 and .Xr cvs 1 diff when invoked with their .Fl u options. If no .Ar patchfile argument is provided, read unified diff data from standard input instead. .Pp If the .Ar patchfile contains multiple patches, then attempt to apply each of them in sequence. .Pp Show the status of each affected file, using the following status codes: .Bl -column XYZ description .It M Ta file was modified .It G Ta file was merged using a merge-base found in the repository .It C Ta file was merged and conflicts occurred during merge .It D Ta file was deleted .It A Ta file was added .It # Ta failed to patch the file .El .Pp If a change does not match at its exact line number, attempt to apply it somewhere else in the file if a good spot can be found. Otherwise, the patch will fail to apply. .Pp .Nm .Cm patch will refuse to apply a patch if certain preconditions are not met. Files to be deleted must already be under version control, and must not have been scheduled for deletion already. Files to be added must not yet be under version control and must not already be present on disk. Files to be modified must already be under version control and may not contain conflict markers. .Pp If an error occurs, the .Cm patch operation will be aborted. Any changes made to the work tree up to this point will be left behind. Such changes can be viewed with .Cm got diff and can be reverted with .Cm got revert if needed. .Pp The options for .Cm got patch are as follows: .Bl -tag -width Ds .It Fl c Ar commit Attempt to locate files within the specified .Ar commit for use as a merge-base for 3-way merges. Ideally, the specified .Ar commit should contain versions of files which the changes contained in the .Ar patchfile were based on. Files will be located by path, relative to the repository root. If the .Fl p option is used then leading path components will be stripped before paths are looked up in the repository. .Pp If the .Fl c option is not used then .Cm got patch will attempt to locate merge-bases via object IDs found in .Ar patchfile meta-data, such as produced by .Cm got diff or .Xr git-diff 1 . Use of the .Fl c option is only recommended in the absence of such meta-data. .Pp In case no merge-base is available for a file, changes will be applied without doing a 3-way merge. Changes which do not apply cleanly may then be rejected entirely, rather than producing merge conflicts in the patched target file. .It Fl n Do not make any modifications to the work tree. This can be used to check whether a patch would apply without issues. If the .Ar patchfile contains diffs that affect the same file multiple times, the results displayed may be incorrect. .It Fl p Ar strip-count Specify the number of leading path components to strip from paths parsed from .Ar patchfile . If the .Fl p option is not used, .Sq a/ and .Sq b/ path prefixes generated by .Xr git-diff 1 will be recognized and stripped automatically. .It Fl R Reverse the patch before applying it. .El .Tg rv .It Xo .Cm revert .Op Fl pR .Op Fl F Ar response-script .Ar path ... .Xc .Dl Pq alias: Cm rv 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 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 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 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 .Tg ci .It Xo .Cm commit .Op Fl CNnS .Op Fl A Ar author .Op Fl F Ar path .Op Fl m Ar message .Op Ar path ... .Xc .Dl Pq alias: Cm ci 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 A Ar author Set author information in the newly created commit to .Ar author . This is useful when committing changes on behalf of someone else. The .Ar author argument must use the same format as the .Ev GOT_AUTHOR environment variable. .Pp In addition to storing author information, the newly created commit object will retain .Dq committer information which is obtained, as usual, from the .Ev GOT_AUTHOR environment variable, or .Xr got.conf 5 , or Git configuration settings. .It Fl C Allow committing files in conflicted status. .Pp Committing files with conflict markers should generally be avoided. Cases where conflict markers must be stored in the repository for some legitimate reason should be very rare. There are usually ways to avoid storing conflict markers verbatim by applying appropriate programming tricks. .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 n This option prevents .Cm got commit from generating a diff of the to-be-committed changes in a temporary file which can be viewed while editing a commit message. .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. .Tg se .It Xo .Cm send .Op Fl afqTv .Op Fl b Ar branch .Op Fl d Ar branch .Op Fl r Ar repository-path .Op Fl t Ar tag .Op Ar remote-repository .Xc .Dl Pq alias: Cm se Send new changes to 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 All objects corresponding to new changes will be written to a temporary pack file which is then uploaded to the server. Upon success, references in the .Dq refs/remotes/ reference namespace of the local repository will be updated to point at the commits which have been sent. .Pp By default, changes will only be sent if they are based on up-to-date copies of relevant branches in the remote repository. If any changes to be sent are based on out-of-date copies or would otherwise break linear history of existing branches, new changes must be fetched from the server with .Cm got fetch and local branches must be rebased with .Cm got rebase before .Cm got send can succeed. The .Fl f option can be used to make exceptions to these requirements. .Pp The options for .Cm got send are as follows: .Bl -tag -width Ds .It Fl a Send all branches from the local repository's .Dq refs/heads/ reference namespace. The .Fl a option is equivalent to listing all branches with multiple .Fl b options. Cannot be used together with the .Fl b option. .It Fl b Ar branch Send the specified .Ar branch from the local repository's .Dq refs/heads/ reference namespace. This option may be specified multiple times to build a list of branches to send. 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. Cannot be used together with the .Fl a option. .It Fl d Ar branch Delete 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 delete. .Pp Only references are deleted. Any commit, tree, tag, and blob objects belonging to deleted branches may become subject to deletion by Git's garbage collector running on the server. .Pp Requesting deletion of branches results in an error if the server does not support this feature or disallows the deletion of branches based on its configuration. .It Fl f Attempt to force the server to overwrite existing branches or tags in the remote repository, even when .Cm got fetch and .Cm got rebase would usually be required before changes can be sent. The server may reject forced requests regardless, depending on its configuration. .Pp Any commit, tree, tag, and blob objects belonging to overwritten branches or tags may become subject to deletion by Git's garbage collector running on the server. .Pp The .Dq refs/tags reference namespace is globally shared between all repositories. Use of the .Fl f option to overwrite tags is discouraged because it can lead to inconsistencies between the tags present in different repositories. In general, creating a new tag with a different name is recommended instead of overwriting an existing tag. .Pp Use of the .Fl f option is particularly discouraged if changes being sent are based on an out-of-date copy of a branch in the remote repository. Instead of using the .Fl f option, new changes should be fetched with .Cm got fetch and local branches should be rebased with .Cm got rebase , followed by another attempt to send the changes. .Pp The .Fl f option should only be needed in situations where the remote repository's copy of a branch or tag is known to be out-of-date and is considered disposable. The risks of creating inconsistencies between different repositories should also be taken into account. .It Fl q Suppress progress reporting output. The same option will be passed to .Xr ssh 1 if applicable. .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 T Attempt to send all tags from the local repository's .Dq refs/tags/ reference namespace. The .Fl T option is equivalent to listing all tags with multiple .Fl t options. Cannot be used together with the .Fl t option. .It Fl t Ar tag Send the specified .Ar tag from the local repository's .Dq refs/tags/ reference namespace, in addition to any branches that are being sent. The .Fl t option may be specified multiple times to build a list of tags to send. No tags will be sent if the .Fl t option is not used. .Pp Raise an error if the specified .Ar tag already exists in the remote repository, unless the .Fl f option is used to overwrite the server's copy of the tag. In general, creating a new tag with a different name is recommended instead of overwriting an existing tag. .Pp Cannot be used together with the .Fl T option. .It Fl v Verbose mode. Causes .Cm got send 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. .El .Tg cy .It Xo .Cm cherrypick .Op Fl lX .Op Ar commit .Xc .Dl Pq alias: Cm cy Merge changes from a single .Ar commit into the work tree. The specified .Ar commit should 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 prevented 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 . .Pp If invoked in a work tree where no .Cm rebase , .Cm histedit , or .Cm merge operation is taking place, .Cm got cherrypick creates a record of commits which have been merged into the work tree. When a file changed by .Cm got cherrypick is committed with .Cm got commit , the log messages of relevant merged commits will then appear in the editor, where the messages should be further adjusted to convey the reasons for cherrypicking the changes. Upon exiting the editor, if the time stamp of the log message file is unchanged or the log message is empty, .Cm got commit will fail with an unmodified or empty log message error. .Pp If all the changes in all files touched by a given commit are discarded, e.g. with .Cm got revert , this commit's log message record will also disappear. .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 any relevant files already contain merge conflicts, these conflicts must be resolved first. .Pp The options for .Nm .Cm cherrypick are as follows: .Bl -tag -width Ds .It Fl l Display a list of commit log messages recorded by cherrypick operations, represented by references in the .Dq refs/got/worktree reference namespace. If a .Ar commit is specified, only show the log message of the specified commit. .Pp If invoked in a work tree, only log messages recorded by cherrypick operations in the current work tree will be displayed. Otherwise, all commit log messages will be displayed irrespective of the work tree in which they were created. This option cannot be used with .Fl X . .It Fl X Delete log messages created by previous cherrypick operations, represented by references in the .Dq refs/got/worktree reference namespace. If a .Ar commit is specified, only delete the log message of the specified commit. .Pp If invoked in a work tree, only log messages recorded by cherrypick operations in the current work tree will be deleted. Otherwise, all commit log messages will be deleted irrespective of the work tree in which they were created. This option cannot be used with .Fl l . .El .Pp .Tg bo .It Xo .Cm backout .Op Fl lX .Op Ar commit .Xc .Dl Pq alias: Cm bo Reverse-merge changes from a single .Ar commit into the work tree. The specified .Ar commit should 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 prevented 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 . .Pp If invoked in a work tree where no .Cm rebase , .Cm histedit , or .Cm merge operation is taking place, .Cm got backout creates a record of commits which have been reverse-merged into the work tree. When a file changed by .Cm got backout is committed with .Cm got commit , the log messages of relevant reverse-merged commits will then appear in the editor, where the messages should be further adjusted to convey the reasons for backing out the changes. Upon exiting the editor, if the time stamp of the log message file is unchanged or the log message is empty, .Cm got commit will fail with an unmodified or empty log message error. .Pp If all the changes in all files touched by a given commit are discarded, e.g. with .Cm got revert , this commit's log message record will also disappear. .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 any relevant files already contain merge conflicts, these conflicts must be resolved first. .Pp The options for .Nm .Cm backout are as follows: .Bl -tag -width Ds .It Fl l Display a list of commit log messages recorded by backout operations, represented by references in the .Dq refs/got/worktree reference namespace. If a .Ar commit is specified, only show the log message of the specified commit. .Pp If invoked in a work tree, only log messages recorded by backout operations in the current work tree will be displayed. Otherwise, all commit log messages will be displayed irrespective of the work tree in which they were created. This option cannot be used with .Fl X . .It Fl X Delete log messages created by previous backout operations, represented by references in the .Dq refs/got/worktree reference namespace. If a .Ar commit is specified, only delete the log message of the specified commit. .Pp If invoked in a work tree, only log messages recorded by backout operations in the current work tree will be deleted. Otherwise, all commit log messages will be deleted irrespective of the work tree in which they were created. This option cannot be used with .Fl l . .El .Pp .Tg rb .It Xo .Cm rebase .Op Fl aCclX .Op Ar branch .Xc .Dl Pq alias: Cm rb 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. If author information is available via the .Ev GOT_AUTHOR environment variable, .Xr got.conf 5 or Git's .Dv user.name and .Dv user.email configuration settings, this author information will be used to identify the .Dq committer of rebased commits. .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 or .Cm gotadmin cleanup . .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 prevented 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. If any files with destined changes are found to be missing or unversioned, or if files could not be deleted due to differences in deleted content, the rebase operation will be interrupted to prevent potentially incomplete changes from being committed to the repository without user intervention. The work tree may be modified as desired and the rebase operation can be continued once the changes present in the work tree are considered complete. 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 .Ar branch is not in the .Dq refs/heads/ reference namespace, the branch may not be rebased. 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 , .Cm got integrate , .Cm got merge , .Cm got commit , and .Cm got histedit 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 If the specified .Ar branch is already based on the work tree's current branch, then no commits need to be rebased and .Cm got rebase will simply switch the work tree to the specified .Ar branch and update files in the work tree accordingly. .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 Allow a rebase operation to continue with files in conflicted status. This option should generally be avoided, and can only be used with the .Fl c option. .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 . .It Fl X Delete backups created by past rebase operations, represented by references in the .Dq refs/got/backup/rebase reference namespace. .Pp If a .Ar branch is specified, only delete backups which at some point in time represented this branch. Otherwise, delete all references found within .Dq refs/got/backup/rebase . .Pp Any commit, tree, tag, and blob objects belonging to deleted backups remain in the repository and may be removed separately with Git's garbage collector or .Cm gotadmin cleanup . .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 X . .El .Tg he .It Xo .Cm histedit .Op Fl aCcdeflmX .Op Fl F Ar histedit-script .Op Ar branch .Xc .Dl Pq alias: Cm he Edit commit history between the work tree's current base commit and the tip commit of the work tree's current branch. .Pp The .Cm got histedit 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 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 d , .Fl e , .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 histedit script commands are as follows: .Bl -column YXZ pick-commit .It Cm pick Ar commit Ta Use the specified commit as it is. .It Cm edit Ar commit Ta Apply the changes from the specified commit, but then interrupt the histedit operation for amending, without creating a commit. While the histedit operation is interrupted arbitrary files may be edited, and commands which manipulate the work tree can be used freely. The .Cm got add and .Cm got remove commands can be used to add new files or remove existing ones. The .Cm got revert -p command can be used to eliminate arbitrary changes from files in the work tree. The .Cm got stage -p command may be used to prepare a subset of changes for inclusion in the next commit. Finally, the .Cm got commit command can be used to insert arbitrary commits into the edited history. Regular editing of history must eventually be resumed by running .Cm got histedit -c . .It Cm fold Ar commit Ta Combine the specified commit with the next commit listed further below that will be used. .It Cm drop Ar commit Ta Remove this commit from the edited history. .It Cm mesg Oo Ar log-message Oc Ta Create a new log message for the commit of a preceding .Cm pick or .Cm edit command on the previous line of the histedit script. The optional .Ar log-message argument provides a new single-line log message to use. If the .Ar log-message argument is omitted, 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 or .Cm gotadmin cleanup . .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 prevented 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. If any files with destined changes are found to be missing or unversioned, or if files could not be deleted due to differences in deleted content, the histedit operation will be interrupted to prevent potentially incomplete changes from being committed to the repository without user intervention. The work tree may be modified as desired and the histedit operation can be continued once the changes present in the work tree are considered complete. 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 , .Cm got merge , 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 Allow a histedit operation to continue with files in conflicted status. This option should generally be avoided, and can only be used with the .Fl c option. .It Fl c Continue an interrupted histedit operation. If this option is used, no other command-line arguments are allowed. .It Fl d Drop all commits. This option is a quick equivalent to a histedit script which drops all commits. The .Fl d 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 e Interrupt the histedit operation for editing after merging each commit. This option is a quick equivalent to a histedit script which uses the .Cm edit command for all commits. The .Fl e 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 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 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 . .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 X Delete backups created by past histedit operations, represented by references in the .Dq refs/got/backup/histedit reference namespace. .Pp If a .Ar branch is specified, only delete backups which at some point in time represented this branch. Otherwise, delete all references found within .Dq refs/got/backup/histedit . .Pp Any commit, tree, tag, and blob objects belonging to deleted backups remain in the repository and may be removed separately with Git's garbage collector or .Cm gotadmin cleanup . .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 X . .El .Tg ig .It Cm integrate Ar branch .Dl Pq alias: Cm ig 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 . .Tg mg .It Xo .Cm merge .Op Fl aCcn .Op Ar branch .Xc .Dl Pq alias: Cm mg Create a merge commit based on the current branch of the work tree and the specified .Ar branch . If a linear project history is desired, then use of .Cm got rebase should be preferred over .Cm got merge . However, even strictly linear projects may require merge commits in order to merge in new versions of third-party code stored on vendor branches created with .Cm got import . .Pp Merge commits are commits based on multiple parent commits. The tip commit of the work tree's current branch, which must be set with .Cm got update -b before starting the .Cm merge operation, will be used as the first parent. The tip commit of the specified .Ar branch will be used as the second parent. .Pp No ancestral relationship between the two branches is required. If the two branches have already been merged previously, only new changes will be merged. .Pp It is not possible to create merge commits with more than two parents. If more than one branch needs to be merged, then multiple merge commits with two parents each can be created in sequence. .Pp While merging changes found on the .Ar branch into the work tree, 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 prevented 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 merge operation is interrupted and conflicts must be resolved before the merge operation can continue. If any files with destined changes are found to be missing or unversioned, or if files could not be deleted due to differences in deleted content, the merge operation will be interrupted to prevent potentially incomplete changes from being committed to the repository without user intervention. The work tree may be modified as desired and the merge can be continued once the changes present in the work tree are considered complete. Alternatively, the merge operation may be aborted which will leave the work tree's current branch unmodified. .Pp .Cm got merge will refuse to run if certain preconditions are not met. If history of the .Ar branch is based on the work tree's current branch, then no merge commit can be created and .Cm got integrate may be used to integrate the .Ar branch instead. 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 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 .Ar branch contains changes to files outside of the work tree's path prefix, the work tree cannot be used to merge this branch. .Pp The .Cm got update , .Cm got commit , .Cm got rebase , .Cm got histedit , .Cm got integrate , and .Cm got stage commands will refuse to run while a merge operation is in progress. Other commands which manipulate the work tree may be used for conflict resolution purposes. .Pp The options for .Cm got merge are as follows: .Bl -tag -width Ds .It Fl a Abort an interrupted merge operation. If this option is used, no other command-line arguments are allowed. .It Fl C Allow a merge operation to continue with files in conflicted status. This option should generally be avoided, and can only be used with the .Fl c option. .It Fl c Continue an interrupted merge operation. If this option is used, no other command-line arguments are allowed. .It Fl n Merge changes into the work tree as usual but do not create a merge commit immediately. The merge result can be adjusted as desired before a merge commit is created with .Cm got merge -c . Alternatively, the merge may be aborted with .Cm got merge -a . .El .Tg sg .It Xo .Cm stage .Op Fl lpS .Op Fl F Ar response-script .Op Ar path ... .Xc .Dl Pq alias: Cm sg 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 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 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 on 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 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. .Tg ug .It Xo .Cm unstage .Op Fl p .Op Fl F Ar response-script .Op Ar path ... .Xc .Dl Pq alias: Cm ug 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 prevented 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 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 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. .El .It Xo .Cm cat .Op Fl P .Op Fl c Ar commit .Op Fl r Ar repository-path .Ar arg ... .Xc 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 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. .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 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_IGNORE_GITCONFIG .It Ev GOT_AUTHOR The author's name and email address, such as .Dq An Flan Hacker Aq Mt flan_hacker@openbsd.org . Used by the .Cm got commit , .Cm got import , .Cm got rebase , and .Cm got histedit commands. 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 overridden 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 GOT_IGNORE_GITCONFIG If this variable is set then any remote repository definitions or author information found in Git configuration files will be ignored. .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. .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 vi 1 text editor will be spawned. .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 Enable tab-completion of .Nm command names in .Xr ksh 1 : .Pp .Dl $ set -A complete_got_1 -- $(got -h 2>&1 | sed -n s/commands://p) .Pp 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 $ gotadmin 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 As above, but list the most recently modified branches only: .Pp .Dl $ got branch -lt | head .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 changes on the remote repository's .Dq master branch, making them visible on 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 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 . Branches in the .Dq refs/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. Newly fetched changes can be examined with .Cm got log . .Pp Display changes on the remote repository's version of the .Dq master branch, as of the last time .Cm got fetch was run: .Pp .Dl $ got log -c origin/master | less .Pp As shown here, most commands accept abbreviated reference names such as .Dq origin/master instead of .Dq refs/remotes/origin/master . The latter is only needed in case of ambiguity. .Pp .Cm got rebase must be used to merge changes which are visible on the .Dq origin/master branch into the .Dq 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 In order to make changes committed to the .Dq unified-buffer-cache visible on 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 first: .Pp .Dl $ got update -b master .Dl $ got integrate unified-buffer-cache .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 If the remote repository offers write access, local changes on the .Dq master branch can be sent to the remote repository with .Cm got send . Usually, .Cm got send can be run without further arguments. The arguments shown here match defaults, provided the work tree's current branch is the .Dq master branch: .Pp .Dl $ got send -b master origin .Pp If the remote repository requires the HTTPS protocol, the .Xr git-push 1 command must be used instead: .Pp .Dl $ cd /var/git/src.git .Dl $ git push origin master .Pp When making contributions to projects which use the .Dq pull request workflow, SSH protocol repository access needs to be set up first. Once an account has been created on a Git hosting site it should be possible to upload a public SSH key for repository access authentication. .Pp The .Dq pull request workflow will usually involve two remote repositories. In the real-life example below, the .Dq origin repository was forked from the .Dq upstream repository by using the Git hosting site's web interface. The .Xr got.conf 5 file in the local repository describes both remote repositories: .Bd -literal -offset indent # Jelmers's repository, which accepts pull requests remote "upstream" { server git@github.com protocol ssh repository "/jelmer/dulwich" branch { "master" } } # Stefan's fork, used as the default remote repository remote "origin" { server git@github.com protocol ssh repository "/stspdotname/dulwich" branch { "master" } } .Ed .Pp With this configuration, Stefan can create commits on .Dq refs/heads/master and send them to the .Dq origin repository by running: .Pp .Dl $ got send -b master origin .Pp The changes can now be proposed to Jelmer by opening a pull request via the Git hosting site's web interface. If Jelmer requests further changes to be made, additional commits can be created on the .Dq master branch and be added to the pull request by running .Cd got send again. .Pp If Jelmer prefers additional commits to be .Dq squashed then the following commands can be used to achieve this: .Pp .Dl $ got update -b master .Dl $ got update -c origin/master .Dl $ got histedit -f .Dl $ got send -f -b master origin .Pp In addition to reviewing the pull request in the web user interface, Jelmer can fetch the pull request's branch into his local repository and create a local branch which contains the proposed changes: .Pp .Dl $ got fetch -R refs/pull/1046/head origin .Dl $ got branch -c refs/remotes/origin/pull/1046/head pr1046 .Pp Once Jelmer has accepted the pull request, Stefan can fetch the merged changes, and possibly several other new changes, by running: .Pp .Dl $ got fetch upstream .Pp The merged changes will now be visible under the reference .Dq refs/remotes/upstream/master . The local .Dq master branch can now be rebased on top of the latest changes from upstream: .Pp .Dl $ got update -b upstream/master .Dl $ got rebase master .Pp As a final step, the forked repository's copy of the master branch needs to be kept in sync by sending the new changes there: .Pp .Dl $ got send -f -b master origin .Pp If multiple pull requests need to be managed in parallel, a separate branch must be created for each pull request with .Cm got branch . Each such branch can then be used as above, in place of .Dq refs/heads/master . Changes for any accepted pull requests will still appear under .Dq refs/remotes/upstream/master, regardless of which branch was used in the forked repository to create a pull request. .Sh SEE ALSO .Xr gotadmin 1 , .Xr tog 1 , .Xr git-repository 5 , .Xr got-worktree 5 , .Xr got.conf 5 , .Xr gotwebd 8 .Sh AUTHORS .An Anthony J. Bentley Aq Mt bentley@openbsd.org .An Christian Weisgerber Aq Mt naddy@openbsd.org .An Hiltjo Posthuma Aq Mt hiltjo@codemadness.org .An Josh Rickmar Aq Mt jrick@zettaport.com .An Joshua Stein Aq Mt jcs@openbsd.org .An Klemens Nanni Aq Mt kn@openbsd.org .An Martin Pieuchot Aq Mt mpi@openbsd.org .An Neels Hofmeyr Aq Mt neels@hofmeyr.de .An Omar Polo Aq Mt op@openbsd.org .An Ori Bernstein Aq Mt ori@openbsd.org .An Sebastien Marie Aq Mt semarie@openbsd.org .An Stefan Sperling Aq Mt stsp@openbsd.org .An Steven McDonald Aq Mt steven@steven-mcdonald.id.au .An Theo Buehler Aq Mt tb@openbsd.org .An Thomas Adam Aq Mt thomas@xteddy.org .An Tracey Emery Aq Mt tracey@traceyemery.net .An Yang Zhong Aq Mt yzhong@freebsdfoundation.org .Pp Parts of .Nm , .Xr tog 1 , and .Xr gotwebd 8 were derived from code under copyright by: .Pp .An Caldera International .An Daniel Hartmeier .An Esben Norby .An Henning Brauer .An HÃ¥kan Olsson .An Ingo Schwarze .An Jean-Francois Brousseau .An Joris Vink .An Jyri J. Virkki .An Larry Wall .An Markus Friedl .An Niall O'Higgins .An Niklas Hallqvist .An Ray Lai .An Ryan McBride .An Theo de Raadt .An Todd C. Miller .An Xavier Santolaria .Pp .Nm contains code contributed to the public domain by .An Austin Appleby . .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 HTTP or HTTPS protocols requires .Xr git-push 1 . .It The creation of merge commits with more than two 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