1git(7) 2====== 3 4NAME 5---- 6git - the stupid content tracker 7 8 9SYNOPSIS 10-------- 11[verse] 12'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] 13 [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS] 14 15DESCRIPTION 16----------- 17Git is a fast, scalable, distributed revision control system with an 18unusually rich command set that provides both high-level operations 19and full access to internals. 20 21See this link:tutorial.html[tutorial] to get started, then see 22link:everyday.html[Everyday Git] for a useful minimum set of commands, and 23"man git-commandname" for documentation of each command. CVS users may 24also want to read link:cvs-migration.html[CVS migration]. 25link:user-manual.html[Git User's Manual] is still work in 26progress, but when finished hopefully it will guide a new user 27in a coherent way to git enlightenment ;-). 28 29The COMMAND is either a name of a Git command (see below) or an alias 30as defined in the configuration file (see gitlink:git-config[1]). 31 32ifdef::stalenotes[] 33[NOTE] 34============ 35You are reading the documentation for the latest version of git. 36Documentation for older releases are available here: 37 38* link:v1.4.4.4/git.html[documentation for release 1.4.4.4] 39 40* link:v1.3.3/git.html[documentation for release 1.3.3] 41 42* link:v1.2.6/git.html[documentation for release 1.2.6] 43 44* link:v1.0.13/git.html[documentation for release 1.0.13] 45 46============ 47 48endif::stalenotes[] 49 50OPTIONS 51------- 52--version:: 53 Prints the git suite version that the 'git' program came from. 54 55--help:: 56 Prints the synopsis and a list of the most commonly used 57 commands. If a git command is named this option will bring up 58 the man-page for that command. If the option '--all' or '-a' is 59 given then all available commands are printed. 60 61--exec-path:: 62 Path to wherever your core git programs are installed. 63 This can also be controlled by setting the GIT_EXEC_PATH 64 environment variable. If no path is given 'git' will print 65 the current setting and then exit. 66 67-p|--paginate:: 68 Pipe all output into 'less' (or if set, $PAGER). 69 70--git-dir=<path>:: 71 Set the path to the repository. This can also be controlled by 72 setting the GIT_DIR environment variable. 73 74--bare:: 75 Same as --git-dir=`pwd`. 76 77FURTHER DOCUMENTATION 78--------------------- 79 80See the references above to get started using git. The following is 81probably more detail than necessary for a first-time user. 82 83The <<Discussion,Discussion>> section below and the 84link:core-tutorial.html[Core tutorial] both provide introductions to the 85underlying git architecture. 86 87See also the link:howto-index.html[howto] documents for some useful 88examples. 89 90GIT COMMANDS 91------------ 92 93We divide git into high level ("porcelain") commands and low level 94("plumbing") commands. 95 96High-level commands (porcelain) 97------------------------------- 98 99We separate the porcelain commands into the main commands and some 100ancillary user utilities. 101 102Main porcelain commands 103~~~~~~~~~~~~~~~~~~~~~~~ 104 105include::cmds-mainporcelain.txt[] 106 107Ancillary Commands 108~~~~~~~~~~~~~~~~~~ 109Manipulators: 110 111include::cmds-ancillarymanipulators.txt[] 112 113Interrogators: 114 115include::cmds-ancillaryinterrogators.txt[] 116 117 118Interacting with Others 119~~~~~~~~~~~~~~~~~~~~~~~ 120 121These commands are to interact with foreign SCM and with other 122people via patch over e-mail. 123 124include::cmds-foreignscminterface.txt[] 125 126 127Low-level commands (plumbing) 128----------------------------- 129 130Although git includes its 131own porcelain layer, its low-level commands are sufficient to support 132development of alternative porcelains. Developers of such porcelains 133might start by reading about gitlink:git-update-index[1] and 134gitlink:git-read-tree[1]. 135 136The interface (input, output, set of options and the semantics) 137to these low-level commands are meant to be a lot more stable 138than Porcelain level commands, because these commands are 139primarily for scripted use. The interface to Porcelain commands 140on the other hand are subject to change in order to improve the 141end user experience. 142 143The following description divides 144the low-level commands into commands that manipulate objects (in 145the repository, index, and working tree), commands that interrogate and 146compare objects, and commands that move objects and references between 147repositories. 148 149 150Manipulation commands 151~~~~~~~~~~~~~~~~~~~~~ 152 153include::cmds-plumbingmanipulators.txt[] 154 155 156Interrogation commands 157~~~~~~~~~~~~~~~~~~~~~~ 158 159include::cmds-plumbinginterrogators.txt[] 160 161In general, the interrogate commands do not touch the files in 162the working tree. 163 164 165Synching repositories 166~~~~~~~~~~~~~~~~~~~~~ 167 168include::cmds-synchingrepositories.txt[] 169 170The following are helper programs used by the above; end users 171typically do not use them directly. 172 173include::cmds-synchelpers.txt[] 174 175 176Internal helper commands 177~~~~~~~~~~~~~~~~~~~~~~~~ 178 179These are internal helper commands used by other commands; end 180users typically do not use them directly. 181 182include::cmds-purehelpers.txt[] 183 184 185Configuration Mechanism 186----------------------- 187 188Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file 189is used to hold per-repository configuration options. It is a 190simple text file modeled after `.ini` format familiar to some 191people. Here is an example: 192 193------------ 194# 195# A '#' or ';' character indicates a comment. 196# 197 198; core variables 199[core] 200 ; Don't trust file modes 201 filemode = false 202 203; user identity 204[user] 205 name = "Junio C Hamano" 206 email = "junkio@twinsun.com" 207 208------------ 209 210Various commands read from the configuration file and adjust 211their operation accordingly. 212 213 214Identifier Terminology 215---------------------- 216<object>:: 217 Indicates the object name for any type of object. 218 219<blob>:: 220 Indicates a blob object name. 221 222<tree>:: 223 Indicates a tree object name. 224 225<commit>:: 226 Indicates a commit object name. 227 228<tree-ish>:: 229 Indicates a tree, commit or tag object name. A 230 command that takes a <tree-ish> argument ultimately wants to 231 operate on a <tree> object but automatically dereferences 232 <commit> and <tag> objects that point at a <tree>. 233 234<type>:: 235 Indicates that an object type is required. 236 Currently one of: `blob`, `tree`, `commit`, or `tag`. 237 238<file>:: 239 Indicates a filename - almost always relative to the 240 root of the tree structure `GIT_INDEX_FILE` describes. 241 242Symbolic Identifiers 243-------------------- 244Any git command accepting any <object> can also use the following 245symbolic notation: 246 247HEAD:: 248 indicates the head of the current branch (i.e. the 249 contents of `$GIT_DIR/HEAD`). 250 251<tag>:: 252 a valid tag 'name' 253 (i.e. the contents of `$GIT_DIR/refs/tags/<tag>`). 254 255<head>:: 256 a valid head 'name' 257 (i.e. the contents of `$GIT_DIR/refs/heads/<head>`). 258 259For a more complete list of ways to spell object names, see 260"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1]. 261 262 263File/Directory Structure 264------------------------ 265 266Please see link:repository-layout.html[repository layout] document. 267 268Read link:hooks.html[hooks] for more details about each hook. 269 270Higher level SCMs may provide and manage additional information in the 271`$GIT_DIR`. 272 273 274Terminology 275----------- 276Please see link:glossary.html[glossary] document. 277 278 279Environment Variables 280--------------------- 281Various git commands use the following environment variables: 282 283The git Repository 284~~~~~~~~~~~~~~~~~~ 285These environment variables apply to 'all' core git commands. Nb: it 286is worth noting that they may be used/overridden by SCMS sitting above 287git so take care if using Cogito etc. 288 289'GIT_INDEX_FILE':: 290 This environment allows the specification of an alternate 291 index file. If not specified, the default of `$GIT_DIR/index` 292 is used. 293 294'GIT_OBJECT_DIRECTORY':: 295 If the object storage directory is specified via this 296 environment variable then the sha1 directories are created 297 underneath - otherwise the default `$GIT_DIR/objects` 298 directory is used. 299 300'GIT_ALTERNATE_OBJECT_DIRECTORIES':: 301 Due to the immutable nature of git objects, old objects can be 302 archived into shared, read-only directories. This variable 303 specifies a ":" separated list of git object directories which 304 can be used to search for git objects. New objects will not be 305 written to these directories. 306 307'GIT_DIR':: 308 If the 'GIT_DIR' environment variable is set then it 309 specifies a path to use instead of the default `.git` 310 for the base of the repository. 311 312git Commits 313~~~~~~~~~~~ 314'GIT_AUTHOR_NAME':: 315'GIT_AUTHOR_EMAIL':: 316'GIT_AUTHOR_DATE':: 317'GIT_COMMITTER_NAME':: 318'GIT_COMMITTER_EMAIL':: 319 see gitlink:git-commit-tree[1] 320 321git Diffs 322~~~~~~~~~ 323'GIT_DIFF_OPTS':: 324 Only valid setting is "--unified=??" or "-u??" to set the 325 number of context lines shown when a unified diff is created. 326 This takes precedence over any "-U" or "--unified" option 327 value passed on the git diff command line. 328 329'GIT_EXTERNAL_DIFF':: 330 When the environment variable 'GIT_EXTERNAL_DIFF' is set, the 331 program named by it is called, instead of the diff invocation 332 described above. For a path that is added, removed, or modified, 333 'GIT_EXTERNAL_DIFF' is called with 7 parameters: 334 335 path old-file old-hex old-mode new-file new-hex new-mode 336+ 337where: 338 339 <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the 340 contents of <old|new>, 341 <old|new>-hex:: are the 40-hexdigit SHA1 hashes, 342 <old|new>-mode:: are the octal representation of the file modes. 343 344+ 345The file parameters can point at the user's working file 346(e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file` 347when a new file is added), or a temporary file (e.g. `old-file` in the 348index). 'GIT_EXTERNAL_DIFF' should not worry about unlinking the 349temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits. 350+ 351For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1 352parameter, <path>. 353 354other 355~~~~~ 356'GIT_PAGER':: 357 This environment variable overrides `$PAGER`. 358 359'GIT_TRACE':: 360 If this variable is set to "1", "2" or "true" (comparison 361 is case insensitive), git will print `trace:` messages on 362 stderr telling about alias expansion, built-in command 363 execution and external command execution. 364 If this variable is set to an integer value greater than 1 365 and lower than 10 (strictly) then git will interpret this 366 value as an open file descriptor and will try to write the 367 trace messages into this file descriptor. 368 Alternatively, if this variable is set to an absolute path 369 (starting with a '/' character), git will interpret this 370 as a file path and will try to write the trace messages 371 into it. 372 373Discussion[[Discussion]] 374------------------------ 375include::core-intro.txt[] 376 377Authors 378------- 379* git's founding father is Linus Torvalds <torvalds@osdl.org>. 380* The current git nurse is Junio C Hamano <junkio@cox.net>. 381* The git potty was written by Andres Ericsson <ae@op5.se>. 382* General upbringing is handled by the git-list <git@vger.kernel.org>. 383 384Documentation 385-------------- 386The documentation for git suite was started by David Greaves 387<david@dgreaves.com>, and later enhanced greatly by the 388contributors on the git-list <git@vger.kernel.org>. 389 390GIT 391--- 392Part of the gitlink:git[7] suite 393