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 – Manage git repositories.

SYNOPSIS

git/add [ –r ] path... git/rm path...

git/branch [ –adns ] [ –b base ] newbranch

git/clone [ remote [ local ] ]

git/commit [ –m msg ] file...

git/compat

git/conf [ –r ] [ –f file ] keys...

git/diff [ –c branch ] [ –a ] [ –s ] [ file... ]

git/revert [ –c commit ] file...

git/export [ commits... ]

git/import [ commits... ]

git/init [ –b ] [ dir ] [ –u upstream ]

git/log [ –c commit | –q query ] [ –s ] [ files... ]

git/merge theirs

git/pull [ –f ] [ –q ] [ –a ] [ –u upstream ]

git/push [ –a ] [ –u upstream ] [ –b branch ] [ –r branch ]

git/serve [ –w ] [ –r path ]

git/query [ –pc ] query

git/walk [ –qc ] [ –b branch ] [ –f filters ] [ [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 /mnt/git. 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.
·PP 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 changed 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 –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 /mnt/git. 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.

Git/commit creates a new commit which updates the files passed.

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 –d option, the branch is deleted.

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 –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 a the file statuses are printed.

Git/export exports a list of commits in a format that git/import can apply.

Git/import imports a commit with message, author, and date information.

Git/merge takes two branches and merges them filewise using ape/diff3. The next commit made will be a merge commmit.

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. 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 provides a tool for walking the list of tracked objects and printing their status. With no arguments, it prints a list of paths prefixed with the status character. When given the –c character, only the paths are printed. When given the –q option, all output is suppressed, and only the status is printed. When given the –f option, the output is filtered by status code, and only matching items are printed.

The status characters are as follows:
T     Tracked, not modified since last commit.
M     Modified since last commit.
R     Removed from either working directory tracking list.
A     Added, does not yet exist in a commit.

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.

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 ancestors of b and descendants of a.

PROTOCOLS

Git9 supports URL schemes of the format transport://dial/repo/path. The transport portion specifies the protocol to use. 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/path 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, tunnelled 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:
git/init myrepo
To clone an existing repository from a git server, run:
git/clone git://github.com/Harvey–OS/harvey
cd harvey
# edit files
git/commit foo.c
git/push

FILES
git/compat only works within a git repository.