GOT(1) | General Commands Manual | GOT(1) |
got
—
got |
command [-h ]
[arg ...] |
got
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
git-repository(5).
got
is a “distributed”
version control system because every copy of a repository is writeable.
Modifications made to files can be synchronized between repositories at any
time.
Files managed by got
must be checked out
from the repository for modification. Checked out files are stored in a
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 got-worktree(5).
got
provides global and command-specific
options. Global options must preceed the command name, and are as
follows:
The commands for got
are as follows:
init
repository-pathAfter got init
, the
got import
command must be used to populate the
empty repository before got checkout
can be
used.
in
init
.import
[-b
branch]
[-m
message]
[-r
repository-path]
[-I
pattern]
directoryThe got import
command requires the
GOT_AUTHOR
environment variable to be set.
The options for got import
are as
follows:
-b
branch-m
message-m
option, got
import
opens a temporary file in an editor where a log message
can be written.-r
repository-path-I
patternim
import
.checkout
[-b
branch]
[-c
commit]
[-p
path-prefix]
repository-path
[work-tree-path]The options for got checkout
are as
follows:
-b
branch-c
commit-p
path-prefixco
checkout
.update
[-b
branch]
[-c
commit]
[path ...]U | file was updated and contained no local changes |
G | file was updated and local changes were merged cleanly |
C | file was updated and conflicts occurred during merge |
D | file was deleted |
A | new file was added |
~ | versioned file is obstructed by a non-regular file |
! | a missing versioned file was restored |
If no 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 got
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 got update
across the entire work tree.
Specifying a path is incompatible with the
-b
option.
got update
cannot update paths with
staged changes. If changes have been staged with got
stage
, these changes must first be comitted with
got commit
or unstaged with got
unstage
.
The options for got update
are as
follows:
-b
branch-c
commitup
update
.status
[path ...]M | modified file |
A | file scheduled for addition in next commit |
D | file scheduled for deletion in next commit |
C | modified or added file which contains merge conflicts |
! | versioned file was expected on disk but is missing |
~ | versioned file is obstructed by a non-regular file |
? | unversioned item not tracked by got |
If no path is specified, show modifications in the entire work tree. Otherwise, show modifications at or within the specified paths.
If changes have been staged with got
stage
, staged changes are shown in the second output column,
using the following status codes:
M | file modification is staged |
A | file addition is staged |
D | file deletion is staged |
Changes created on top of staged changes are indicated in the first column:
MM | file was modified after earlier changes have been staged |
MA | file was modified after having been staged for addition |
For compatibility with cvs(1),
got status
parses
.cvsignore files in each traversed directory and
will not display unversioned files which match glob(7)
ignore patterns contained in .cvsignore files.
Unlike cvs(1), got status
only
supports a single ignore pattern per line.
st
status
.log
[-c
commit]
[-C
number]
[-f
] [-l
N] [-p
]
[-r
repository-path]
[path]The options for got log
are as
follows:
-c
commit-C
number-p
. By default, 3 lines of context are
shown.-f
-l
N-p
-r
repository-pathgot
work tree, use the
repository path associated with this work tree.diff
[-C
number]
[-r
repository-path]
[-s
] [object1
object2 | path]If two arguments are provided, treat each argument as a reference, or an object ID SHA1 hash, and display differences between these 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.
The options for got diff
are as
follows:
-C
number-r
repository-pathgot
work tree, use the
repository path associated with this work tree.-s
got stage
instead of
showing local changes. This option is only valid when
got diff
is invoked in a work tree.di
diff
.blame
[-c
commit]
[-r
repository-path]
pathThe options for got blame
are as
follows:
-c
commit-r
repository-pathgot
work tree, use the
repository path associated with this work tree.bl
blame
.tree
[-c
commit]
[-r
repository-path]
[-i
] [-R]
[path]/ | entry is a directory |
* | entry is an executable file |
If no 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.
The options for got tree
are as
follows:
-c
commit-r
repository-pathgot
work tree, use the
repository path associated with this work tree.-i
-R
tr
tree
.ref
[-r
repository-path]
[-l
] [-d
name] [name
target]If no options are passed, expect two arguments and attempt to create, or update, the reference with the given name, and make it point at the given target. The target may be an object ID SHA1 hash or an existing reference which will be resolved to an object ID. An abbreviated hash argument will be expanded to a full SHA1 hash automatically, provided the abbreviation is unique.
The options for got ref
are as
follows:
-r
repository-pathgot
work tree, use the
repository path associated with this work tree.-l
-d
namebranch
[-r
repository-path]
[-l
] [-d
name] [name
[base-branch]]Branches are managed via references which live in the
“refs/heads/” reference namespace. The
got branch
command operates on references in
this namespace only.
If no options are passed, expect one or two arguments and attempt to create a branch with the given name, and make it point at the given base-branch. If no base-branch is specified, default to the work tree's current branch if invoked in a work tree, or to the repository's HEAD reference.
The options for got branch
are as
follows:
-r
repository-pathgot
work tree, use the
repository path associated with this work tree.-l
* | work tree's base commit matches the branch tip |
~ | work tree's base commit is out-of-date |
-d
namebr
branch
.add
file-path ...remove
file-path ...The options for got remove
are as
follows:
-f
rm
remove
.revert
[-p
] [-F
response-script] [-R
]
path ...got revert
!
If a file was added with got add
it
will become an unversioned file again. If a file was deleted with
got remove
it will be restored.
The options for got revert
are as
follows:
-p
-F
response-script-p
option, read “y”,
“n”, and “q” responses line-by-line from
the specified response-script file instead of
prompting interactively.-R
got revert
will refuse to run if a specified
path is a directory.rv
revert
.commit
[-m
message]
[path ...]If changes have been explicitly staged for commit with
got stage,
only commit staged changes and reject
any specified paths which have not been staged.
Show the status of each affected file, using the following status codes:
M | modified file |
D | file was deleted |
A | new file was added |
Files which are not part of the new commit will retain their
previously recorded base commit. Some got
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 got update
across the
entire work tree.
The got commit
command requires the
GOT_AUTHOR
environment variable to be set.
The options for got commit
are as
follows:
-m
message-m
option, got
commit
opens a temporary file in an editor where a log message
can be written.got commit
will refuse to run if
certain preconditions are not met. If the work tree's current branch is
not in the “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,
got update
must be used first in order to merge
local changes with changes made in the repository.
ci
commit
.cherrypick
commitShow the status of each affected file, using the following status codes:
G | file was merged |
C | file was merged and conflicts occurred during merge |
! | changes destined for a missing file were not merged |
D | file was deleted |
d | file's deletion was obstructed by local modifications |
A | new file was added |
~ | changes destined for a non-regular file were not merged |
The merged changes will appear as local changes in the work
tree, which may be viewed with got diff
, amended
manually or with further got cherrypick
comands,
committed with got commit
, or discarded again
with got revert
.
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
got update
. If the work tree already contains
files with merge conflicts, these conflicts must be resolved first.
cy
cherrypick
.backout
commitShow the status of each affected file, using the following status codes:
G | file was merged |
C | file was merged and conflicts occurred during merge |
! | changes destined for a missing file were not merged |
D | file was deleted |
d | file's deletion was obstructed by local modifications |
A | new file was added |
~ | changes destined for a non-regular file were not merged |
The reverse-merged changes will appear as local changes in the
work tree, which may be viewed with got diff
,
amended manually or with further got backout
comands, committed with got commit
, or discarded
again with got revert
.
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
got update
. If the work tree already contains
files with merge conflicts, these conflicts must be resolved first.
bo
backout
.rebase
[-a
] [-c]
[branch]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 branch, but with different commit IDs. Once rebasing has completed successfully, the temporary branch becomes the new version of the specified branch and the work tree is automatically switched to it.
While rebasing commits, show the status of each affected file, using the following status codes:
G | file was merged |
C | file was merged and conflicts occurred during merge |
! | changes destined for a missing file were not merged |
D | file was deleted |
d | file's deletion was obstructed by local modifications |
A | new file was added |
~ | changes destined for a non-regular file were not merged |
If merge conflicts occur the rebase operation is interrupted and may be continued once conflicts have been resolved. Alternatively, the rebase operation may be aborted which will leave branch unmodified and the work tree switched back to its original branch.
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.
got rebase
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
got update
. If changes have been staged with
got stage
, these changes must first be comitted
with got commit
or unstaged with
got unstage
. If the work tree contains local
changes, these changes must first be committed with got
commit
or reverted with got revert
. If
the branch contains changes to files outside of
the work tree's path prefix, the work tree cannot be used to rebase this
branch.
The got update
and
got commit
commands will refuse to run while a
rebase operation is in progress. Other commands which manipulate the
work tree may be used for conflict resolution purposes.
The options for got rebase
are as
follows:
rb
rebase
.histedit
[-a
] [-c]
[-F
histedit-script]Editing of commit history is controlled via a histedit script which can be edited interactively or passed on the command line. The format of the histedit script is line-based. Each line in the script begins with a command name, followed by whitespace and an argument. For most commands, the expected argument is a commit ID SHA1 hash. Any remaining text on the line is ignored. Lines which begin with the ‘#’ character are ignored entirely.
The available commands are as follows:
pick commit | Use the specified commit as it is. |
edit commit | Use the specified commit but once changes have been merged into the work tree interrupt the histedit operation for amending. |
fold commit | Combine the specified commit with the next commit listed further below that will be used. |
drop commit | Remove this commit from the edited history. |
mesg log-message | Use the specified single-line log message for the commit on the previous line. If the log message argument is left empty, open an editor where a new log message can be written. |
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.
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.
While merging commits, show the status of each affected file, using the following status codes:
G | file was merged |
C | file was merged and conflicts occurred during merge |
! | changes destined for a missing file were not merged |
D | file was deleted |
d | file's deletion was obstructed by local modifications |
A | new file was added |
~ | changes destined for a non-regular file were not merged |
If merge conflicts occur the histedit operation is interrupted and may be continued once conflicts have been resolved. Alternatively, the histedit operation may be aborted which will leave the work tree switched back to its original branch.
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.
got histedit
will refuse to run if
certain preconditions are not met. If the work tree's current branch is
not in the “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
got update
. If changes have been staged with
got stage
, these changes must first be comitted
with got commit
or unstaged with
got unstage
. If the work tree contains local
changes, these changes must first be committed with got
commit
or reverted with 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.
The got update
command will refuse to
run while a histedit operation is in progress. Other commands which
manipulate the work tree may be used, and the got
commit
command may be used to commit arbitrary changes to the
temporary branch while the histedit operation is interrupted.
The options for got histedit
are as
follows:
he
histedit
.stage
[-l
] [-p
]
[-F
response-script]
[path ...]got status
.
Show the status of each affected file, using the following status codes:
A | file addition has been staged |
M | file modification has been staged |
D | file deletion has been staged |
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.
Staged changes affect the behaviour of got
commit
, got status
, and
got diff
. While paths with staged changes exist,
the 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 got
status
command will show both local changes and staged changes.
The got diff
command is able to display local
changes relative to staged changes, and to display staged changes
relative to the repository. The got revert
command cannot revert staged changes but may be used to revert local
changes created on top of staged changes.
The options for got stage
are as
follows:
-l
-p
-F
response-script-p
option, read “y”,
“n”, and “q” responses line-by-line from
the specified response-script file instead of
prompting interactively.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 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).
The got update
, got
rebase
, and 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 got unstage
before it can be
updated with got update
, and may then be staged
again if necessary.
sg
stage
.unstage
[-p
] [-F
response-script] [path ...]Show the status of each affected file, using the following status codes:
G | file was unstaged |
C | file was unstaged and conflicts occurred during merge |
! | changes destined for a missing file were not merged |
D | file was staged as deleted and still is deleted |
d | file's deletion was obstructed by local modifications |
~ | changes destined for a non-regular file were not merged |
The options for got unstage
are as
follows:
-p
-F
response-script-p
option, read “y”,
“n”, and “q” responses line-by-line from
the specified response-script file instead of
prompting interactively.ug
unstage
.GOT_AUTHOR
got commit
and got import
, for example: Flan
Hacker
<flan_hacker@openbsd.org>VISUAL,
EDITOR
got commit
.got
utility exits 0 on success,
and >0 if an error occurs.
got
. This
step currently requires git(1):
$ cd /var/git/
$ git clone --bare
https://github.com/openbsd/src.git
Alternatively, for quick and dirty local testing of
got
a new Git repository could be created and
populated with files, e.g. from a temporary CVS checkout located at
/tmp/src:
$ got init
/var/git/src.git
$ got import -r /var/git/src.git -I
CVS -I obj /tmp/src
Check out a work tree from the Git repository to /usr/src:
$ got checkout /var/git/src.git
/usr/src
View local changes in a work tree directory:
$ got status
$ got diff | less
Interactively revert selected local changes in a work tree directory:
$ got revert -p
-R .
In a work tree or a git repository directory, list all branch references:
$ got branch -l
In a work tree or a git repository directory, create a new branch called “unified-buffer-cache” which is forked off the “master” branch:
$ got branch unified-buffer-cache
master
Switch an existing work tree to the branch “unified-buffer-cache”. Local changes in the work tree will be preserved and merged if necessary:
$ got update -b
unified-buffer-cache
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:
$ got commit
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:
$ got log -p -l 3 -f
Add new files and remove obsolete files in a work tree directory:
$ got add
sys/uvm/uvm_ubc.c
$ got remove
sys/uvm/uvm_vnode.c
Create a new commit from local changes in a work tree directory with a pre-defined log message.
$ got commit -m 'unify the buffer
cache'
Update any work tree checked out from the “unified-buffer-cache” branch to the latest commit on this branch:
$ got update
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:
$ got backout
unified-buffer-cache
$ got commit -m 'roll back
previous'
$ # now back out the previous backout
:-)
$ got backout
unified-buffer-cache
Fetch new upstream commits into the local repository's master branch. This step currently requires git(1):
$ cd /var/git/src.git
$ git fetch origin
master:master
Rebase the “unified-buffer-cache” branch on top of the new head commit of the “master” branch.
$ got update -b master
$ got rebase
unified-buffer-cache
Create a patch from all changes on the unified-buffer-cache branch. The patch can be mailed out for review and applied to OpenBSD's CVS tree:
$ got diff master
unified-buffer-cache > /tmp/ubc.diff
Edit the entire commit history of the “unified-buffer-cache” branch:
$ got update -b
unified-buffer-cache
$ got update -c master
$ got histedit
Additional steps are necessary if local changes need to be pushed
back to the remote repository, which currently requires git
fetch
and git push
. Before working against
existing branches in a repository cloned with “git clone
--bare”, a Git “refspec” must be configured to map all
references in the remote repository into the “refs/remotes”
namespace of the local repository. This can achieved by setting Git's
remote.origin.fetch configuration variable to the
value “+refs/heads/*:refs/remotes/origin/*” with the
git config
command:
$ cd /var/git/repo
$ git config remote.origin.fetch
'+refs/heads/*:refs/remotes/origin/*'
Alternatively, the following fetch configuration item can be added manually to the Git repository's config file:
[remote origin]
url = ...
fetch =
+refs/heads/*:refs/remotes/origin/*
This configuration leaves the local repository's
“refs/heads” namespace free for use by local branches checked
out with got checkout
and, if needed, created with
got branch
.
Branches in the “remotes/origin” namespace can be
updated with incoming changes from the remote repository with
git fetch
:
$ cd /var/git/repo
$ git fetch
Before outgoing changes on the local “master” branch can be pushed to the remote repository, the local “master” branch must be rebased onto the “origin/master” branch:
$ got update -b
origin/master
$ got rebase master
Changes on the local “master” branch can then be
pushed to the remote repository with git push
:
$ cd /var/git/repo
$ git push origin master
got
is a work-in-progress and many commands remain to be
implemented. At present, the user has to fall back on git(1)
to perform many tasks, in particular tasks related to repository
administration and tasks which require a network connection.
August 8, 2019 | OpenBSD 6.5 |