404 lines · 7.2 KB · Text
RawDownload
.TH GIT 1.SH NAMEgit, git/conf, git/fs, git/query, git/walk, git/clone, git/branch,git/commit, git/diff, git/init, git/log, git/merge, git/push, git/pull\- Manage git repositories. .SH SYNOPSIS.PP.B git/add[.B -r].I path....PP.B git/branch[.B -b.I base].I newbranch.PP.B git/clone[.I remote[.I local]].PP.B git/commit.PP.B git/conf[.B -r][.B -f.I file].I keys....PP.B git/diff[.B -b.I branch][.I file...].PP.B git/fs[.B -d].PP.B git/init[.B -b][.I dir][.B -u.I upstream].PP.B git/log[.B -b.I branch][.I files...].PP.B git/merge.I theirs.PP.B git/pull[.B -f][.B -u.I upstream].PP.B git/push[.B -a][.B -u.I upstream][.B -b.I branch][.B -r.I branch].PP.B git/query[.B -p].PP.B git/walk[.B -qc][.B -b.I branch][.B -f.I filters] .SH DESCRIPTION.PPGit 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. .PPThese programs provide tools to manage and interoperate withrepositories hosted in git. .SH 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 andadds them to a new commit. This history is stored in the.I .gitdirectory.This suite of.I gittools provides a file interface to the.I .gitdirectory mounted on.I /mnt/git.Modifications to the repository are done directly to the.I .gitdirectory, and are reflected in the file system interface.This allows for easy scripting, without excessive complexityin the file API. .SH COMMANDS .PP.B Git/initis 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 createdthere instead.Passing the.B -boption will cause the repository to be initialized as a bare repository.Passing the.B -u.I upstreamoption will cause the upstream to be configured to.I upstream. .PP.B Git/clonewill take an existing repository, served over either the.I git://or.I 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 componentof the clone source, with the.I .gitstripped off if present. .B Git/pushis used to push the current changes to a remote repository.When no arguments are provided, the remote repository is taken fromthe origin configured in.I .git/config,and only the changes on the current branch are pushed.When passed the.I -aoption, all branches are pushed.When passed the.I -u upstreamoption, the changed are pushed to.I upstreaminstead of the configured origin.When given the.I -roption, the branch is deleted from origin, instead of updated. .B Git/pullbehaves in a similar manner to git/push, however it gets changes fromthe upstream repository.After fetching, it checks out the changes into the working directory.When passed the.I -foption, the update of the working copy is suppressed.When passed the.I -u upstreamoption, the changes are pulled from.I upstreaminstead of the configured origin. .B Git/fsprovides a read-only file system mounted on /mnt/git.It provides a  view into the repository contents to allow convenient inspection of repository structure.Surrounding scripts and binaries manipulate the repository contents directly.These changes will be immediately mirrored in the file system. .PPGit/fs serves the following directories: .TP/mnt/git/objectThe objects in the repo..TP/mnt/git/branchThe branches and tags in the repo..TP/mnt/git/ctlA file showing the status of the repo.Currently, it only shows the current branch..TP/mnt/git/HEADAn alias for the currently checked out commit directory. .PP.B Git/addadds a file to the list of tracked files. When passed the.I -rflag, the file is removed from the list of tracked files.The copy of the file in the repository is left untouched. .PP.B Git/commitcreates a new commit reflecting the state of the current repository.It takes no arguments: all files must be added or removed using git/add.If a file does not exist in the working directory, it is treated as though it was removed. .PP.B Git/branchis used to switch between branches.When passed the.I -coption, the branch will be created if it does not yet exist.When passed the.I -o originaloption, the branch created is based off of.I originalinstead of.I HEAD.When passed the.I -soption, the branch is created but the files are not checked out. .PP.B Git/logshows a history of the current branch. .PP.B Git/diffshows the differences between the currently checked out code andthe.I HEADcommit.When passed the.I -b baseoption, the diff is computed against.I baseinstead of.I HEAD. .PP.B Git/mergetakes two branches and merges them filewise using.I ape/diff3.The next commit made will be a merge commmit. .PP.B Git/confis a tool for querying the git configuration.The configuration key is provided as a dotted string. Spacesare accepted. For example, to find the URL of the originrepository, one might pass.I 'remote "origin".url".When given the.I -roption, the root of the current repository is printed. .B Git/querytakes an expression describing a commit, or set of commits,and resolves it to a list of commits. With the.I -poption, instead of printing the commit hashes, the fullpath to their.B git/fspath is printed. .PP.B Git/walkprovides 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.I -ccharacter, only the paths are printed.When given the.I -qoption, all output is suppressed, and only the status is printed.When given the.I -foption, the output is filtered by status code, and only matching items are printed. .PPThe status characters are as follows:.TPTTracked, not modified since last commit..TPMModified since last commit..TPRRemoved from either working directory tracking list..TPAAdded, does not yet exist in a commit. .SH REF SYNTAX .PPRefs are specified with a simple query syntax.A bare hash always evaluates to itself.Ref names are resolved to their hashes.The.B a ^suffix operator finds the parent of a commit.The.B a b @suffix operator finds the common ancestor of the previous two commits.The.B a .. bor.B a : boperator finds all commits between.B aand.B b.Between is defined as the set of all commits which are ancestors of.B band descendants of.B a. .SH EXAMPLES .PPIn order to create a new repository, run.B git/init: .EXgit/init myrepo.EE To clone an existing repository from a git server, run:.EXgit/clone git://github.com/Harvey-OS/harveycd harvey# edit filesgit/commitgit/push.EE .SH SOURCE.B /sys/src/cmd/git .SH SEE ALSO.IR hg(1).IR replica(1).IR patch(1).IR diff3 .SH BUGS.PPRepositories with submodules are effectively read-only. .PPThere are a number of missing commands, features, and tools. Notablemissing features include.I httpclones, history editing, and formatted patch management.