7 git - the stupid content tracker
12 'git-<command>' <args>
17 This is reference information for the core git commands.
19 The Discussion section below contains much useful definition and
20 clarification info - read that first. And of the commands, I suggest
21 reading link:git-update-cache.html[git-update-cache] and
22 link:git-read-tree.html[git-read-tree] first - I wish I had!
24 David Greaves <david@dgreaves.com>
27 Updated by Junio C Hamano <junkio@cox.net> on 2005-05-05 to
28 reflect recent changes.
32 The git commands can helpfully be split into those that manipulate
33 the repository, the cache and the working fileset and those that
34 interrogate and compare them.
36 There are also some ancilliary programs that can be viewed as useful
37 aids for using the core commands but which are unlikely to be used by
38 SCMs layered over git.
42 link:git-checkout-cache.html[git-checkout-cache]::
43 Copy files from the cache to the working directory
45 link:git-commit-tree.html[git-commit-tree]::
46 Creates a new commit object
48 link:git-init-db.html[git-init-db]::
49 Creates an empty git object database
51 link:git-merge-base.html[git-merge-base]::
52 Finds as good a common ancestor as possible for a merge
54 link:git-mktag.html[git-mktag]::
57 link:git-read-tree.html[git-read-tree]::
58 Reads tree information into the directory cache
60 link:git-update-cache.html[git-update-cache]::
61 Modifies the index or directory cache
63 link:git-write-blob.html[git-write-blob]::
64 Creates a blob from a file
66 link:git-write-tree.html[git-write-tree]::
67 Creates a tree from the current cache
69 Interrogation commands
70 ~~~~~~~~~~~~~~~~~~~~~~
71 link:git-cat-file.html[git-cat-file]::
72 Provide content or type information for repository objects
74 link:git-check-files.html[git-check-files]::
75 Verify a list of files are up-to-date
77 link:git-diff-cache.html[git-diff-cache]::
78 Compares content and mode of blobs between the cache and repository
80 link:git-diff-files.html[git-diff-files]::
81 Compares files in the working tree and the cache
83 link:git-diff-tree.html[git-diff-tree]::
84 Compares the content and mode of blobs found via two tree objects
86 link:git-export.html[git-export]::
87 Exports each commit and a diff against each of its parents
89 link:git-fsck-cache.html[git-fsck-cache]::
90 Verifies the connectivity and validity of the objects in the database
92 link:git-ls-files.html[git-ls-files]::
93 Information about files in the cache/working directory
95 link:git-ls-tree.html[git-ls-tree]::
96 Displays a tree object in human readable form
98 link:git-merge-cache.html[git-merge-cache]::
99 Runs a merge for files needing merging
101 link:git-rev-list.html[git-rev-list]::
102 Lists commit objects in reverse chronological order
104 link:git-rev-tree.html[git-rev-tree]::
105 Provides the revision tree for one or more commits
107 link:git-tar-tree.html[git-tar-tree]::
108 Creates a tar archive of the files in the named tree
110 link:git-unpack-file.html[git-unpack-file]::
111 Creates a temporary file with a blob's contents
113 The interrogate commands may create files - and you can force them to
114 touch the working file set - but in general they don't
121 link:git-apply-patch-script.html[git-apply-patch-script]::
122 Sample script to apply the diffs from git-diff-*
124 link:git-convert-cache.html[git-convert-cache]::
125 Converts old-style GIT repository
127 link:git-http-pull.html[git-http-pull]::
128 Downloads a remote GIT repository via HTTP
130 link:git-local-pull.html[git-local-pull]::
131 Duplicates another GIT repository on a local system
133 link:git-merge-one-file-script.html[git-merge-one-file-script]::
134 The standard helper program to use with "git-merge-cache"
136 link:git-pull-script.html[git-pull-script]::
137 Script used by Linus to pull and merge a remote repository
139 link:git-prune-script.html[git-prune-script]::
140 Prunes all unreachable objects from the object database
142 link:git-resolve-script.html[git-resolve-script]::
143 Script used to merge two trees
145 link:git-tag-script.html[git-tag-script]::
146 An example script to create a tag object signed with GPG
148 link:git-ssh-pull.html[git-ssh-pull]::
149 Pulls from a remote repository over ssh connection
153 link:git-diff-helper.html[git-diff-helper]::
154 Generates patch format output for git-diff-*
156 link:git-ssh-push.html[git-ssh-push]::
157 Helper "server-side" program used by git-ssh-pull
161 Identifier Terminology
162 ----------------------
164 Indicates the sha1 identifier for any type of object
167 Indicates a blob object sha1 identifier
170 Indicates a tree object sha1 identifier
173 Indicates a commit object sha1 identifier
176 Indicates a tree, commit or tag object sha1 identifier. A
177 command that takes a <tree-ish> argument ultimately wants to
178 operate on a <tree> object but automatically dereferences
179 <commit> and <tag> objects that point at a <tree>.
182 Indicates that an object type is required.
183 Currently one of: blob/tree/commit/tag
186 Indicates a filename - always relative to the root of
187 the tree structure GIT_INDEX_FILE describes.
191 Any git comand accepting any <object> can also use the following
195 indicates the head of the repository (ie the contents of
199 (ie the contents of `$GIT_DIR/refs/tags/<tag>`)
202 (ie the contents of `$GIT_DIR/refs/heads/<head>`)
204 a valid snapshot 'name'+
205 (ie the contents of `$GIT_DIR/refs/snap/<snap>`)
208 File/Directory Structure
209 ------------------------
210 The git-core manipulates the following areas in the directory:
212 .git/ The base (overridden with $GIT_DIR)
213 objects/ The object base (overridden with $GIT_OBJECT_DIRECTORY)
214 ??/ 'First 2 chars of object' directories
216 It can interrogate (but never updates) the following areas:
218 refs/ Directories containing symbolic names for objects
219 (each file contains the hex SHA1 + newline)
220 heads/ Commits which are heads of various sorts
221 tags/ Tags, by the tag name (or some local renaming of it)
223 ... Everything else isn't shared
224 HEAD Symlink to refs/heads/<something>
226 Higher level SCMs may provide and manage additional information in the
231 Each line contains terms which you may see used interchangeably
233 object database, .git directory
234 directory cache, index
235 id, sha1, sha1-id, sha1 hash
239 Environment Variables
240 ---------------------
241 Various git commands use the following environment variables:
245 These environment variables apply to 'all' core git commands. Nb: it
246 is worth noting that they may be used/overridden by SCMS sitting above
247 git so take care if using Cogito etc
250 This environment allows the specification of an alternate
251 cache/index file. If not specified, the default of
252 `$GIT_DIR/index` is used.
254 'GIT_OBJECT_DIRECTORY'::
255 If the object storage directory is specified via this
256 environment variable then the sha1 directories are created
257 underneath - otherwise the default `$GIT_DIR/objects`
260 'GIT_ALTERNATE_OBJECT_DIRECTORIES'::
261 Due to the immutable nature of git objects, old objects can be
262 archived into shared, read-only directories. This variable
263 specifies a ":" seperated list of git object directories which
264 can be used to search for git objects. New objects will not be
265 written to these directories.
268 If the 'GIT_DIR' environment variable is set then it specifies
269 a path to use instead of `./.git` for the base of the
277 'GIT_COMMITTER_NAME'::
278 'GIT_COMMITTER_EMAIL'::
279 see link:git-commit-tree.html[git-commit-tree]
284 'GIT_EXTERNAL_DIFF'::
285 see the "generating patches" section in :
286 link:git-diff-cache.html[git-diff-cache];
287 link:git-diff-files.html[git-diff-files];
288 link:git-diff-tree.html[git-diff-tree]
296 Written by Linus Torvalds <torvalds@osdl.org> and the git-list <git@vger.kernel.org>.
300 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
304 Part of the link:git.html[git] suite