NAME
gitglossary - A Git Glossary
SYNOPSIS
*
DESCRIPTION
- alternate object database
Via the alternates mechanism, a repositorycan inherit part of its object databasefrom another object database, which is called an "alternate".
A bare repository is normally an appropriatelynamed directory with a
.git
suffix that does nothave a locally checked-out copy of any of the files underrevision control. That is, all of the Gitadministrative and control files that would normally be present in thehidden.git
sub-directory are directly present in therepository.git
directory instead,and no other files are present and checked out. Usually publishers ofpublic repositories make bare repositories available.Untyped object, e.g. the contents of a file.
A "branch" is an active line of development. The most recentcommit on a branch is referred to as the tip ofthat branch. The tip of the branch is referenced by a branchhead, which moves forward as additional developmentis done on the branch. A single Gitrepository can track an arbitrary number ofbranches, but your working tree isassociated with just one of them (the "current" or "checked out"branch), and HEAD points to that branch.
Obsolete for: index.
A list of objects, where each object in the list containsa reference to its successor (for example, the successor of acommit could be one of its parents).
BitKeeper/cvsps speak for "commit". Since Git does notstore changes, but states, it really does not make sense to use the term"changesets" with Git.
The action of updating all or part of theworking tree with a tree objector blob from theobject database, and updating theindex and HEAD if the whole working tree hasbeen pointed at a new branch.
In SCM jargon, "cherry pick" means to choose a subset ofchanges out of a series of changes (typically commits) and record themas a new series of changes on top of a different codebase. In Git, this isperformed by the "git cherry-pick" command to extract the change introducedby an existing commit and to record it based on the tipof the current branch as a new commit.
A working tree is clean, if itcorresponds to the revision referenced by the currenthead. Also see "dirty".
- As a noun: A single point in theGit history; the entire history of a project is represented as aset of interrelated commits. The word "commit" is oftenused by Git in the same places other revision control systemsuse the words "revision" or "version". Also used as a shorthand for commit object.
As a verb: The action of storing a new snapshot of the project’sstate in the Git history, by creating a new commit representing the currentstate of the index and advancing HEADto point at the new commit.
- commit object
An object which contains the information about aparticular revision, such as parents, committer,author, date and the tree object which correspondsto the top directory of the storedrevision.
A commit object or anobject that can be recursively dereferenced toa commit object.The following are all commit-ishes:a commit object,a tag object that points to a commitobject,a tag object that points to a tag object that points to acommit object,etc.
Fundamental data structures and utilities of Git. Exposes only limitedsource code management tools.
Directed acyclic graph. The commit objects form adirected acyclic graph, because they have parents (directed), and thegraph of commit objects is acyclic (there is no chainwhich begins and ends with the same object).
An unreachable object which is notreachable even from other unreachable objects; adangling object has no references to it from anyreference or object in the repository.
- Normally the HEAD stores the name of abranch, and commands that operate on thehistory HEAD represents operate on the history leading to thetip of the branch the HEAD points at. However, Git alsoallows you to check out an arbitrarycommit that isn’t necessarily the tip of anyparticular branch. The HEAD in such a state is called"detached".
Note that commands that operate on the history of the current branch(e.g. git commit
to build a new history on top of it) still workwhile the HEAD is detached. They update the HEAD to point at the tipof the updated history without affecting any branch. Commands thatupdate or inquire information about the current branch (e.g. gitbranch —set-upstream-to
that sets what remote-tracking branch thecurrent branch integrates with) obviously do not work, as there is no(real) current branch to ask about in this state.
- directory
The list you get with "ls" :-)
A working tree is said to be "dirty" ifit contains modifications which have not been committed to the currentbranch.
An evil merge is a merge that introduces changes thatdo not appear in any parent.
A fast-forward is a special type of merge where you have arevision and you are "merging" anotherbranch's changes that happen to be a descendant of whatyou have. In such a case, you do not make a new mergecommit but instead just update to hisrevision. This will happen frequently on aremote-tracking branch of a remoterepository.
Fetching a branch means to get thebranch’s head ref from a remoterepository, to find out which objects aremissing from the local object database,and to get them, too. See also git-fetch[1].
Linus Torvalds originally designed Git to be a user space file system,i.e. the infrastructure to hold files and directories. That ensured theefficiency and speed of Git.
Synonym for repository (for arch people).
A plain file
.git
at the root of a working tree thatpoints at the directory that is the real repository.- Grafts enables two otherwise different lines of development to be joinedtogether by recording fake ancestry information for commits. This wayyou can make Git pretend the set of parents a commit hasis different from what was recorded when the commit wascreated. Configured via the
.git/info/grafts
file.
Note that the grafts mechanism is outdated and can lead to problemstransferring objects between repositories; see git-replace[1]for a more flexible and robust system to do the same thing.
- hash
In Git’s context, synonym for object name.
A named reference to the commit at the tip of abranch. Heads are stored in a file in
$GIT_DIR/refs/heads/
directory, except when using packed refs. (Seegit-pack-refs[1].)The current branch. In more detail: Your working tree is normally derived from the state of the treereferred to by HEAD. HEAD is a reference to one of theheads in your repository, except when using adetached HEAD, in which case it directlyreferences an arbitrary commit.
A synonym for head.
During the normal execution of several Git commands, call-outs are madeto optional scripts that allow a developer to add functionality orchecking. Typically, the hooks allow for a command to be pre-verifiedand potentially aborted, and allow for a post-notification after theoperation is done. The hook scripts are found in the
$GIT_DIR/hooks/
directory, and are enabled by simplyremoving the.sample
suffix from the filename. In earlier versionsof Git you had to make them executable.A collection of files with stat information, whose contents are storedas objects. The index is a stored version of yourworking tree. Truth be told, it can also contain a second, and evena third version of a working tree, which are usedwhen merging.
The information regarding a particular file, stored in theindex. An index entry can be unmerged, if amerge was started, but not yet finished (i.e. ifthe index contains multiple versions of that file).
The default development branch. Whenever youcreate a Git repository, a branch named"master" is created, and becomes the active branch. In mostcases, this contains the local development, though that ispurely by convention and is not required.
- As a verb: To bring the contents of anotherbranch (possibly from an externalrepository) into the current branch. In thecase where the merged-in branch is from a different repository,this is done by first fetching the remote branchand then merging the result into the current branch. Thiscombination of fetch and merge operations is called apull. Merging is performed by an automatic processthat identifies changes made since the branches diverged, andthen applies all those changes together. In cases where changesconflict, manual intervention may be required to complete themerge.
As a noun: unless it is a fast-forward, asuccessful merge results in the creation of a new commitrepresenting the result of the merge, and having asparents the tips of the merged branches.This commit is referred to as a "merge commit", or sometimes just a"merge".
- object
The unit of storage in Git. It is uniquely identified by theSHA-1 of its contents. Consequently, anobject cannot be changed.
Stores a set of "objects", and an individual object isidentified by its object name. The objects usuallylive in
$GIT_DIR/objects/
.Synonym for object name.
The unique identifier of an object. Theobject name is usually represented by a 40 characterhexadecimal string. Also colloquially called SHA-1.
One of the identifiers "commit","tree", "tag" or"blob" describing the type of anobject.
The default upstream repository. Most projects haveat least one upstream project which they track. By defaultorigin is used for that purpose. New upstream updateswill be fetched into remote-tracking branches namedorigin/name-of-upstream-branch, which you can see using
git branch -r
.Only update and add files to the working directory, but don’tdelete them, similar to how cp -R would update the contentsin the destination directory. This is the default mode in acheckout when checking out files from theindex or a tree-ish. Incontrast, no-overlay mode also deletes tracked files notpresent in the source, similar to rsync —delete.
A set of objects which have been compressed into one file (to save spaceor to transmit them efficiently).
The list of identifiers, and other information, of the objects in apack, to assist in efficiently accessing the contents of apack.
- Pattern used to limit paths in Git commands.
Pathspecs are used on the command line of "git ls-files", "gitls-tree", "git add", "git grep", "git diff", "git checkout",and many other commands tolimit the scope of operations to some subset of the tree orworktree. See the documentation of each command for whetherpaths are relative to the current directory or toplevel. Thepathspec syntax is as follows:
any path matches itself
the pathspec up to the last slash represents adirectory prefix. The scope of that pathspec islimited to that subtree.
the rest of the pathspec is a pattern for the remainderof the pathname. Paths relative to the directoryprefix will be matched against that pattern using fnmatch(3);in particular, * and ?__can match directory separators.
For example, Documentation/*.jpg will match all .jpg filesin the Documentation subtree,including Documentation/chapter_1/figure_1.jpg.
A pathspec that begins with a colon :
has special meaning. In theshort form, the leading colon :
is followed by zero or more "magicsignature" letters (which optionally is terminated by another colon :
),and the remainder is the pattern to match against the path.The "magic signature" consists of ASCII symbols that are neitheralphanumeric, glob, regex special characters nor colon.The optional colon that terminates the "magic signature" can beomitted if the pattern begins with a character that does not belong to"magic signature" symbol set and is not a colon.
In the long form, the leading colon :
is followed by an openparenthesis (
, a comma-separated list of zero or more "magic words",and a close parentheses )
, and the remainder is the pattern to matchagainst the path.
A pathspec with only a colon means "there is no pathspec". This formshould not be combined with other pathspec.
- top
The magic word
top
(magic signature:/
) makes the patternmatch from the root of the working tree, even when you arerunning the command from inside a subdirectory.Wildcards in the pattern such as
*
or?
are treatedas literal characters.Case insensitive match.
- Git treats the pattern as a shell glob suitable forconsumption by fnmatch(3) with the FNM_PATHNAME flag:wildcards in the pattern will not match a / in the pathname.For example, "Documentation/*.html" matches"Documentation/git.html" but not "Documentation/ppc/ppc.html"or "tools/perf/Documentation/perf.html".
Two consecutive asterisks ("**
") in patterns matched againstfull pathname may have special meaning:
-
A leading "" followed by a slash means match in alldirectories. For example, "
/foo
" matches file or directory"foo
" anywhere, the same as pattern "foo
". "**/foo/bar
"matches file or directory "bar
" anywhere that is directlyunder directory "foo
".
-
A trailing "/
" matches everything inside. For example,"abc/
" matches all files inside directory "abc", relativeto the location of the .gitignore
file, with infinite depth.
-
A slash followed by two consecutive asterisks then a slashmatches zero or more directories. For example, "a/**/b
"matches "a/b
", "a/x/b
", "a/x/y/b
" and so on.
-
Other consecutive asterisks are considered invalid.
Glob magic is incompatible with literal magic.
- attr
- After
attr:
comes a space separated list of "attributerequirements", all of which must be met in order for thepath to be considered a match; this is in addition to theusual non-magic pathspec pattern matching.See gitattributes[5].
Each of the attribute requirements for the path takes one ofthese forms:
-
"ATTR
" requires that the attribute ATTR
be set.
-
"-ATTR
" requires that the attribute ATTR
be unset.
-
"ATTR=VALUE
" requires that the attribute ATTR
beset to the string VALUE
.
-
"!ATTR
" requires that the attribute ATTR
beunspecified.
Note that when matching against a tree object, attributes are stillobtained from working tree, not from the given tree object.
- exclude
- After a path matches any non-exclude pathspec, it will be runthrough all exclude pathspecs (magic signature:
!
or itssynonym^
). If it matches, the path is ignored. When thereis no non-exclude pathspec, the exclusion is applied to theresult set as if invoked without any pathspec.
- parent
A commit object contains a (possibly empty) listof the logical predecessor(s) in the line of development, i.e. itsparents.
The term pickaxe refers to an option to the diffcoreroutines that help select changes that add or delete a given textstring. With the
—pickaxe-all
option, it can be used to view the fullchangeset that introduced or removed, say, aparticular line of text. See git-diff[1].Cute name for core Git.
Cute name for programs and program suites depending oncore Git, presenting a high level access tocore Git. Porcelains expose more of a SCMinterface than the plumbing.
Refs that are per-worktree, rather thanglobal. This is presently only HEAD and any refsthat start with
refs/bisect/
, but might later include otherunusual refs.Pseudorefs are a class of files under
$GIT_DIR
which behavelike refs for the purposes of rev-parse, but which are treatedspecially by git. Pseudorefs both have names that are all-caps,and always start with a line consisting of aSHA-1 followed by whitespace. So, HEAD is not apseudoref, because it is sometimes a symbolic ref. They mightoptionally contain some additional data.MERGE_HEAD
andCHERRY_PICK_HEAD
are examples. Unlikeper-worktree refs, these files cannotbe symbolic refs, and never have reflogs. They also cannot beupdated through the normal ref update machinery. Instead,they are updated by directly writing to the files. However,they can be read as if they were refs, sogit rev-parseMERGE_HEAD
will work.Pulling a branch means to fetch it andmerge it. See also git-pull[1].
Pushing a branch means to get the branch’shead ref from a remote repository,find out if it is an ancestor to the branch’s localhead ref, and in that case, putting allobjects, which are reachable from the localhead ref, and which are missing from the remoterepository, into the remoteobject database, and updating the remotehead ref. If the remote head is not anancestor to the local head, the push fails.
All of the ancestors of a given commit are said to be"reachable" from that commit. Moregenerally, one object is reachable fromanother if we can reach the one from the other by a chainthat follows tags to whatever they tag,commits to their parents or trees, andtrees to the trees or blobsthat they contain.
To reapply a series of changes from a branch to adifferent base, and reset the head of that branchto the result.
- A name that begins with
refs/
(e.g.refs/heads/master
)that points to an object name or anotherref (the latter is called a symbolic ref).For convenience, a ref can sometimes be abbreviated when usedas an argument to a Git command; see gitrevisions[7]for details.Refs are stored in the repository.
The ref namespace is hierarchical.Different subhierarchies are used for different purposes (e.g. therefs/heads/
hierarchy is used to represent local branches).
There are a few special-purpose refs that do not begin with refs/
.The most notable example is HEAD
.
- reflog
A reflog shows the local "history" of a ref. In other words,it can tell you what the 3rd last revision in this repositorywas, and what was the current state in this repository,yesterday 9:14pm. See git-reflog[1] for details.
A "refspec" is used by fetch andpush to describe the mapping between remoteref and local ref.
A repository which is used to track the sameproject but resides somewhere else. To communicate with remotes,see fetch or push.
A ref that is used to follow changes from anotherrepository. It typically looks likerefs/remotes/foo/bar (indicating that it tracks a branch namedbar in a remote named foo), and matches the right-hand-side ofa configured fetch refspec. A remote-trackingbranch should not contain direct modifications or have localcommits made to it.
A collection of refs together with anobject database containing all objectswhich are reachable from the refs, possiblyaccompanied by meta data from one or more porcelains. Arepository can share an object database with other repositoriesvia alternates mechanism.
The action of fixing up manually what a failed automaticmerge left behind.
Synonym for commit (the noun).
To throw away part of the development, i.e. to assign thehead to an earlier revision.
Source code management (tool).
"Secure Hash Algorithm 1"; a cryptographic hash function.In the context of Git used as a synonym for object name.
Mostly a synonym to shallow repositorybut the phrase makes it more explicit that it was created byrunning
git clone —depth=…
command.A shallow repository has an incompletehistory some of whose commits have parents cauterized away (in otherwords, Git is told to pretend that these commits do not have theparents, even though they are recorded in the commitobject). This is sometimes useful when you are interested only in therecent history of a project even though the real history recorded in theupstream is much larger. A shallow repositoryis created by giving the
—depth
option to git-clone[1], andits history can be later deepened with git-fetch[1].An object used to temporarily store the contents of adirty working directory and the index for future reuse.
A repository that holds the history of aseparate project inside another repository (the latter ofwhich is called superproject).
A repository that references repositoriesof other projects in its working tree as submodules.The superproject knows about the names of (but does not holdcopies of) commit objects of the contained submodules.
Symbolic reference: instead of containing the SHA-1id itself, it is of the format ref: refs/some/thing and whenreferenced, it recursively dereferences to this reference.HEAD is a prime example of a symref. Symbolicreferences are manipulated with the git-symbolic-ref[1]command.
A ref under
refs/tags/
namespace that points to anobject of an arbitrary type (typically a tag points to either atag or a commit object).In contrast to a head, a tag is not updated bythecommit
command. A Git tag has nothing to do with a Lisptag (which would be called an object typein Git’s context). A tag is most typically used to mark a particularpoint in the commit ancestry chain.An object containing a ref pointing toanother object, which can contain a message just like acommit object. It can also contain a (PGP)signature, in which case it is called a "signed tag object".
A regular Git branch that is used by a developer toidentify a conceptual line of development. Since branches are very easyand inexpensive, it is often desirable to have several small branchesthat each contain very well defined concepts or small incremental yetrelated changes.
Either a working tree, or a treeobject together with the dependent blob and tree objects(i.e. a stored representation of a working tree).
An object containing a list of file names and modes alongwith refs to the associated blob and/or tree objects. Atree is equivalent to a directory.
A tree object or an objectthat can be recursively dereferenced to a tree object.Dereferencing a commit object yields thetree object corresponding to the revision'stop directory.The following are all tree-ishes:a commit-ish,a tree object,a tag object that points to a tree object,a tag object that points to a tag object that points to a treeobject,etc.
An index which contains unmergedindex entries.
An object which is not reachable from abranch, tag, or any other reference.
The default branch that is merged into the branch inquestion (or the branch in question is rebased onto). It is configuredvia branch.
.remote and branch. .merge. If the upstream branchof A is origin/B sometimes we say "A is tracking origin/B". - The tree of actual checked out files. The working tree normallycontains the contents of the HEAD commit’s tree,plus any local changes that you have made but not yet committed.
SEE ALSO
gittutorial[7],gittutorial-2[7],gitcvs-migration[7],giteveryday[7],The Git User’s Manual
GIT
Part of the git[1] suite