NAME
|
git, git/conf, git/query, git/walk, git/clone, git/branch, git/commit,
git/diff, git/init, git/log, git/merge, git/push, git/pull, git/rm,
git/serve, git/hist – manage git repositories |
SYNOPSIS
|
git/add [ –r ] path ... git/branch [ –armns ] [ –b base ] newbranch git/clone [ remote [ local ] ] git/commit [ –re ] [ –m msg ] [ file ... ] git/compat git/conf [ –r ] [ –f file ] keys ... git/diff [ –c branch ] [ –su ] [ file ... ] git/export [ commits ... ] git/import [ –n ] [ commits ... ] git/init [ –b ] [ –u upstream ] [ dir ] git/log [ –c commit | –e expr ] [ –n count ] [ –s ] [ files ... ] git/merge theirs git/rebase [ –s src ] [ –n ] onto git/pull [ –fq ] [ –u upstream ] git/push [ –af ] [ –u upstream ] [ –b branch ] [ –r branch ] git/query [ –pcr ] query git/revert [ –c commit ] file ... git/rm path ... git/serve [ –w ] [ –r path ] git/walk [ –qc ] [ –b branch ] [ –f filters ] [ –r rel ] [ file ... ]
git/hist [ –n count ] files... |
DESCRIPTION
|
Git is a distributed version control system. This means that each
repository contains a full copy of the history. This history is
then synced between computers as needed.
These programs provide tools to manage and interoperate with repositories
hosted in git. |
CONCEPTS
|
Git stores snapshots of the working directory. Files can either
be in a tracked or untracked state. Each commit takes the current
version of all tracked files and adds them to a new commit.
This history is stored in the .git directory. This suite of git
tools provides a file interface to the .git directory mounted
on $repo/.git/fs. Modifications to the repository are done directly
to the .git directory, and are reflected in the file system interface.
This allows for easy scripting, without excessive
complexity in the file API. |
COMMANDS
|
Git/init is used to create a new git repository, with no code
or commits. The repository is created in the current directory
by default. Passing a directory name will cause the repository
to be created there instead. Passing the –b option will cause the
repository to be initialized as a bare repository. Passing the
–u
upstream option will cause the upstream to be configured to upstream.
Git/clone will take an existing repository, served over either the git:// or ssh:// protocols. The first argument is the repository to clone. The second argument, optionally, specifies the location to clone into. If not specified, the repository will be cloned into the last path component of the clone source, with the .git stripped off if present. Git/push is used to push the current changes to a remote repository. When no arguments are provided, the remote repository is taken from the origin configured in .git/config, and only the changes on the current branch are pushed. When passed the –a option, all branches are pushed. When passed the –u upstream option, the changes are pushed to upstream instead of the configured origin. When given the –r option, the branch is deleted from origin, instead of updated. Git/revert restores the named files from HEAD. When passed the –c flag, restores files from the named commit. Git/pull behaves in a similar manner to git/push, however it gets changes from the upstream repository. After fetching, it checks out the changes into the working directory. When passed the –f option, the update of the working copy is suppressed. When passed the –q option, the listing of changes is silenced. When passed the –u upstream option, the changes are pulled from upstream instead of the configured origin. Git/serve serves repositories using the git:// protocol over stdin. By default, it serves them read–only. The –w flag, it allows pushing into repositories. The –r path flag serves repositories relative to path. Git/fs serves a file system on $repo/.git/fs. For full documentation, see gitfs(4) Git/add adds a file to the list of tracked files. When passed the –r flag, the file is removed from the list of tracked files. The copy of the file in the repository is left untouched. Git/rm is an alias for git/add –r. Git/commit creates a new commit consisting of all changes to the specified files. By default, $editor is opened to prepare the commit message. If $editor is undefined hold(1) is used. The –m flag supplies the commit message directly. The –r flag revises the contents of the previous commit, reusing the message. The –e flag opens an editor to finalize the commit message, regardless of whether or not it was specified explicitly or reused. To amend a commit message, –r can be used in conjunction with –m or –e. Git/branch is used to list or switch branches. When invoked with no arguments, it lists the current branch. To list all branches, pass the –a option. To switch between branches, pass a branch name. When passed the –n option, the branch will be created, overwriting existing branch. When passed the –b base option, the branch created is based off of base instead of HEAD. When passed the –s option, the branch is created but the files are not checked out. When passed the –r option, the branch is removed. When switching branches, git/branch will refuse to clobber modifications. Passing the –m option will cause it to attempt to merge the changes between the branches. Git/log shows a history of the current branch. When passed a list of files, only commits affecting those files are shown. The –c commit option logs starting from the provided commit, instead of HEAD. The –s option shows a summary of the commit, instead of the full message. The –n count option stops printing messages after count messages. The –e expr option shows commits matching the query expression provided. The expression is in the syntax of git/query. Git/diff shows the differences between the currently checked out code and the HEAD commit. When passed the –c base option, the diff is computed against base instead of HEAD. When passed the –s option, only the file statuses are printed. When passed the –u option, untracked files are listed. The –u option implies –s. Git/export exports a list of commits in a format that git/import can apply. If multiple patches are generated, they are separated with a ⑨ character. Git/import imports a commit with message, author, and date information. When passed the –n option, it applies the contents of the commit without committing to the branch. Git/import can accept multiple patches on stdin. When multiple patches are supplied, each patch must be separated with a ⑨ character. Git/merge takes two branches and merges them filewise using merge3 (see diff(1)). The next commit made will be a merge commit. Git/rebase prints the commands to move commits from one branch onto another, using git/export and git/import. The –n option is passed directly to git/import. Git/conf is a tool for querying the git configuration. The configuration key is provided as a dotted string. Spaces are accepted. For example, to find the URL of the origin repository, one might pass 'remote ??origin??.url'. When given the –r option, the root of the current repository is printed. Git/query takes an expression describing a commit, or set of commits, and resolves it to a list of commits. The –r option reverses the order of the commit list. With the –p option, instead of printing the commit hashes, the full path to their git/fs path is printed. With the –c option, the query must resolve to two commits. The blobs that have changed in the commits are printed. Git/walk shows the status of files in the repository. It prints a list of paths prefixed with the status character. It exits with a non–empty status if the repository is not clean. The –c option suppresses the status, so only the paths are printed. The –q option suppresses all output. The –r option causes paths to be printed relative to the supplied directory rel. The –f option filters files by status, and only matching items are printed. By default, the filters are TRMA.
The status characters are as follows: Git/compat spawns an rc subshell with a compatibility stub in $path. This compatibility stub provides enough of the Unix git commands to run tools like go get but not much more.
Git/hist provides the diffs of specific files in reverse chronological
order. The –n flag may be used to limit the output to the last
count commits. |
REF SYNTAX
|
Refs are specified with a simple query syntax. A bare hash always
evaluates to itself. Ref names are resolved to their hashes. The
a ^ suffix operator finds the parent of a commit. The a b @ suffix
operator finds the common ancestor of the previous two commits.
The a .. b or a : b operator finds all commits
between a and b. Between is defined as the set of all commits
which are reachable from b but not reachable from a. |
PROTOCOLS
|
Git supports URL schemes of the format transport://dial/repo.
The transport portion specifies the protocol to use. If the transport
portion is omitted, then the transport used is ssh. The dial portion
is either a Plan 9 dial string, or a conventional host:port pair.
For the ssh protocol, it may also include a user@
prefix. repo portion is the path of the repository on the server.
The supported transports are ssh://, git://, hjgit://, gits://,
http://, and https://. Two of these are specific to git9: gits://
and hjgit://. Both are the git:// protocol, tunneled over TLS.
Hjgit:// authenticates with the server using Plan 9 authentication,
using tlsclient –a. Any of
these protocol names may be prefixed with git+, for copy–paste
compatibility with Unix git. |
EXAMPLES
In order to create a new repository, run git/init:
|
FILES
$repo/.git
|
SEE ALSO
|
diff(1), patch(1), replica(1), gitfs(4) |
BUGS
|
Repositories with submodules are effectively read–only. There are some missing commands, features, and tools. Git/compat only works within a git repository.
Sharing git repositories between Plan 9 and Linux leads to indexes
going out of sync. To work around this, reset the state of the
tracked files on Plan 9 with git/add:
|