From 3d5b41ffbcbc5a107013e17876dd3a1fa1746f20 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 26 Mar 2007 02:33:41 +0000 Subject: [PATCH] Autogenerated HTML docs for v1.5.1-rc2 --- RelNotes-1.5.1.txt | 53 +++- glossary.html | 515 +++++++++++++++--------------- glossary.txt | 742 +++++++++++++++++++++++-------------------- user-manual.html | 774 +++++++++++++++++++++++---------------------- user-manual.txt | 48 ++- 5 files changed, 1108 insertions(+), 1024 deletions(-) diff --git a/RelNotes-1.5.1.txt b/RelNotes-1.5.1.txt index f78cf56bc..8461fb437 100644 --- a/RelNotes-1.5.1.txt +++ b/RelNotes-1.5.1.txt @@ -10,11 +10,15 @@ Updates since v1.5.0 * New commands and options. - - "git log" and friends take --reverse. This makes output - that typically goes reverse order in chronological order. - "git shortlog" usually lists commits in chronological order, - but with "--reverse", they are shown in reverse - chronological order. + - "git log" and friends take --reverse, which instructs them + to give their output in the order opposite from their usual. + They typically output from new to old, but with this option + their output would read from old to new. "git shortlog" + usually lists older commits first, but with this option, + they are shown from new to old. + + - "git log --pretty=format:" to allow more flexible + custom log output. - "git diff" learned --ignore-space-at-eol. This is a weaker form of --ignore-space-change. @@ -22,9 +26,6 @@ Updates since v1.5.0 - "git diff --no-index pathA pathB" can be used as diff replacement with git specific enhancements. - - "git diff --pretty=format:" to allow more flexible - custom log output. - - "git diff --no-index" can read from '-' (standard input). - "git diff" also learned --exit-code to exit with non-zero @@ -33,6 +34,17 @@ Updates since v1.5.0 backward incompatible change; it will stay as an option for now. + - "git diff --quiet" is --exit-code with output turned off, + meant for scripted use to quickly determine if there is any + tree-level difference. + + - Textual patch generation with "git diff" without -w/-b + option has been significantly optimized. "git blame" got + faster because of the same change. + + - "git log" and "git rev-list" has been optimized + significantly when they are used with pathspecs. + - "git branch --track" can be used to set up configuration variables to help it easier to base your work on branches you track from a remote site. @@ -61,6 +73,19 @@ Updates since v1.5.0 symlinks on filesystems that do not support them; they are checked out as regular files instead. + - You can name a commit object with its first line of the + message. The syntax to use is ':/message text'. E.g. + + $ git show ":/object name: introduce ':/' notation" + + means the same thing as: + + $ git show 28a4d940443806412effa246ecc7768a21553ec7 + + - "git bisect" learned a new command "run" that takes a script + to run after each revision is checked out to determine if it + is good or bad, to automate the bisection process. + * Updated behaviour of existing commands. @@ -133,6 +158,9 @@ Updates since v1.5.0 - send-email learned configurable bcc and chain-reply-to. + - "git remote show $remote" also talks about branches that + would be pushed if you run "git push remote". + - Using objects from packs is now seriouly optimized by clever use of a cache. This should be most noticeable in git-log family of commands that involve reading many tree objects. @@ -143,10 +171,9 @@ Updates since v1.5.0 * Hooks - - The sample update hook to show how to send out notification - e-mail was updated to show only new commits that appeared in - the repository. Earlier, it showed new commits that appeared - on the branch. + - The part to send out notification e-mails was removed from + the sample update hook, as it was not an appropriate place + to do so. * Others @@ -156,7 +183,7 @@ Updates since v1.5.0 -- exec >/var/tmp/1 -O=v1.5.0.5-446-g5d86501 +O=v1.5.1-rc1-63-g12d6697 echo O=`git describe master` git shortlog --no-merges $O..master ^maint diff --git a/glossary.html b/glossary.html index 7c7a06458..da2370a42 100644 --- a/glossary.html +++ b/glossary.html @@ -263,139 +263,138 @@ div.exampleblock-content {
-

This list is sorted alphabetically:

-alternate object database +alternate object database

- Via the alternates mechanism, a repository can - inherit part of its object database from another - object database, which is called "alternate". + Via the alternates mechanism, a repository can + inherit part of its object database from another + object database, which is called "alternate".

-bare repository +bare repository

- A bare repository is normally an appropriately - named directory with a .git suffix that does not + A bare repository is normally an appropriately + named directory with a .git suffix that does not have a locally checked-out copy of any of the files under - revision control. That is, all of the git + revision control. That is, all of the git administrative and control files that would normally be present in the hidden .git sub-directory are directly present in the - repository.git directory instead, + repository.git directory instead, and no other files are present and checked out. Usually publishers of public repositories make bare repositories available.

-blob object +blob object

- Untyped object, e.g. the contents of a file. + Untyped object, e.g. the contents of a file.

-branch +branch

A non-cyclical graph of revisions, i.e. the complete history of a - particular revision, which is called the - branch head. The branch heads + particular revision, which is called the + branch head. The heads are stored in $GIT_DIR/refs/heads/.

-cache +cache

- Obsolete for: index. + Obsolete for: index.

-chain +chain

- A list of objects, where each object in the list contains + A list of objects, where each object in the list contains a reference to its successor (for example, the successor of a - commit could be one of its parents). + commit could be one of its parents).

-changeset +changeset

- BitKeeper/cvsps speak for "commit". Since git does not + BitKeeper/cvsps speak for "commit". Since git does not store changes, but states, it really does not make sense to use the term "changesets" with git.

-checkout +checkout

- The action of updating the working tree to a - revision which was stored in the - object database. + The action of updating the working tree to a + revision which was stored in the + object database.

-cherry-picking +cherry-picking

- In SCM jargon, "cherry pick" means to choose a subset of + In SCM jargon, "cherry pick" means to choose a subset of changes out of a series of changes (typically commits) and record them as a new series of changes on top of different codebase. In GIT, this is performed by "git cherry-pick" command to extract the change introduced - by an existing commit and to record it based on the tip - of the current branch as a new commit. + by an existing commit and to record it based on the tip + of the current branch as a new commit.

-clean +clean

- A working tree is clean, if it - corresponds to the revision referenced by the current - head. Also see "dirty". + A working tree is clean, if it + corresponds to the revision referenced by the current + head. Also see "dirty".

-commit +commit

As a verb: The action of storing the current state of the - index in the object database. The - result is a revision. As a noun: Short hand for - commit object. + index in the object database. The + result is a revision. As a noun: Short hand for + commit object.

-commit object +commit object

- An object which contains the information about a - particular revision, such as parents, committer, - author, date and the tree object which corresponds - to the top directory of the stored - revision. + An object which contains the information about a + particular revision, such as parents, committer, + author, date and the tree object which corresponds + to the top directory of the stored + revision.

-core git +core git

@@ -404,30 +403,30 @@ div.exampleblock-content {

-DAG +DAG

- Directed acyclic graph. The commit objects form a + Directed acyclic graph. The commit objects form a directed acyclic graph, because they have parents (directed), and the - graph of commit objects is acyclic (there is no - chain which begins and ends with the same - object). + graph of commit objects is acyclic (there is no + chain which begins and ends with the same + object).

-dangling object +dangling object

- An unreachable object which is not - reachable even from other unreachable objects; a - dangling object has no references to it from any - reference or object in the repository. + An unreachable object which is not + reachable even from other unreachable objects; a + dangling object has no references to it from any + reference or object in the repository.

-dircache +dircache

@@ -435,7 +434,7 @@ div.exampleblock-content {

-directory +directory

@@ -443,54 +442,54 @@ div.exampleblock-content {

-dirty +dirty

- A working tree is said to be dirty if + A working tree is said to be dirty if it contains modifications which have not been committed to the current - branch. + branch.

-ent +ent

- Favorite synonym to "tree-ish" by some total geeks. See + Favorite synonym to "tree-ish" by some total geeks. See http://en.wikipedia.org/wiki/Ent_(Middle-earth) for an in-depth explanation. Avoid this term, not to confuse people.

-fast forward +fast forward

- A fast-forward is a special type of merge where you have a - revision and you are "merging" another - branch's changes that happen to be a descendant of what - you have. In such these cases, you do not make a new merge - commit but instead just update to his - revision. This will happen frequently on a - tracking branch of a remote - repository. + A fast-forward is a special type of merge where you have a + revision and you are "merging" another + branch's changes that happen to be a descendant of what + you have. In such these cases, you do not make a new merge + commit but instead just update to his + revision. This will happen frequently on a + tracking branch of a remote + repository.

-fetch +fetch

- Fetching a branch means to get the - branch's head ref from a remote - repository, to find out which objects are missing - from the local object database, and to get them, + Fetching a branch means to get the + branch's head ref from a remote + repository, to find out which objects are missing + from the local object database, and to get them, too.

-file system +file system

@@ -500,54 +499,54 @@ div.exampleblock-content {

-git archive +git archive

- Synonym for repository (for arch people). + Synonym for repository (for arch people).

-grafts +grafts

Grafts enables two otherwise different lines of development to be joined together by recording fake ancestry information for commits. This way - you can make git pretend the set of parents a commit has - is different from what was recorded when the commit was - created. Configured via the .git/info/grafts file. + you can make git pretend the set of parents a commit has + is different from what was recorded when the commit was + created. Configured via the .git/info/grafts file.

-hash +hash

- In git's context, synonym to object name. + In git's context, synonym to object name.

-head +head

- The top of a branch. It contains a ref to the - corresponding commit object. + The top of a branch. It contains a ref to the + corresponding commit object.

-head ref +head ref

- A ref pointing to a head. Often, this is - abbreviated to "head". Head refs are stored in + A ref pointing to a head. Often, this is + abbreviated to "head". Head refs are stored in $GIT_DIR/refs/heads/.

-hook +hook

@@ -555,132 +554,132 @@ div.exampleblock-content { to optional scripts that allow a developer to add functionality or checking. Typically, the hooks allow for a command to be pre-verified and potentially aborted, and allow for a post-notification after the - operation is done. The hook scripts are found in the - $GIT_DIR/hooks/ directory, and are enabled by simply + operation is done. The hook scripts are found in the + $GIT_DIR/hooks/ directory, and are enabled by simply making them executable.

-index +index

A collection of files with stat information, whose contents are stored - as objects. The index is a stored version of your working - tree. Truth be told, it can also contain a second, and even - a third version of a working tree, which are used + as objects. The index is a stored version of your working + tree. Truth be told, it can also contain a second, and even + a third version of a working tree, which are used when merging.

-index entry +index entry

The information regarding a particular file, stored in the - index. An index entry can be unmerged, - if a merge was started, but not yet finished (i.e. if the - index contains multiple versions of that file). + index. An index entry can be unmerged, + if a merge was started, but not yet finished (i.e. if the + index contains multiple versions of that file).

-master +master

- The default development branch. Whenever you create a git - repository, a branch named - "master" is created, and becomes the active - branch. In most cases, this contains the local + The default development branch. Whenever you create a git + repository, a branch named + "master" is created, and becomes the active + branch. In most cases, this contains the local development, though that is purely conventional and not required.

-merge +merge

- To merge branches means to try to accumulate the changes + To merge branches means to try to accumulate the changes since a common ancestor and apply them to the first - branch. An automatic merge uses heuristics - to accomplish that. Evidently, an automatic merge can + branch. An automatic merge uses heuristics + to accomplish that. Evidently, an automatic merge can fail.

-object +object

The unit of storage in git. It is uniquely identified by the - SHA1 of its contents. Consequently, an - object can not be changed. + SHA1 of its contents. Consequently, an + object can not be changed.

-object database +object database

- Stores a set of "objects", and an individual object is - identified by its object name. The objects usually + Stores a set of "objects", and an individual object is + identified by its object name. The objects usually live in $GIT_DIR/objects/.

-object identifier +object identifier

- Synonym for object name. + Synonym for object name.

-object name +object name

- The unique identifier of an object. The hash - of the object's contents using the Secure Hash Algorithm + The unique identifier of an object. The hash + of the object's contents using the Secure Hash Algorithm 1 and usually represented by the 40 character hexadecimal encoding of - the hash of the object (possibly followed by + the hash of the object (possibly followed by a white space).

-object type +object type

One of the identifiers - "commit","tree","tag" and "blob" - describing the type of an object. + "commit","tree","tag" or "blob" + describing the type of an object.

-octopus +octopus

- To merge more than two branches. Also denotes an + To merge more than two branches. Also denotes an intelligent predator.

-origin +origin

- The default upstream repository. Most projects have + The default upstream repository. Most projects have at least one upstream project which they track. By default - origin is used for that purpose. New upstream updates + origin is used for that purpose. New upstream updates will be fetched into remote tracking branches named - origin/name-of-upstream-branch, which you can see using - "git branch -r". + origin/name-of-upstream-branch, which you can see using + "git branch -r".

-pack +pack

@@ -689,177 +688,177 @@ div.exampleblock-content {

-pack index +pack index

The list of identifiers, and other information, of the objects in a - pack, to assist in efficiently accessing the contents of a - pack. + pack, to assist in efficiently accessing the contents of a + pack.

-parent +parent

- A commit object contains a (possibly empty) list + A commit object contains a (possibly empty) list of the logical predecessor(s) in the line of development, i.e. its parents.

-pickaxe +pickaxe

- The term pickaxe refers to an option to the diffcore + The term pickaxe refers to an option to the diffcore routines that help select changes that add or delete a given text string. With the —pickaxe-all option, it can be used to view the full - changeset that introduced or removed, say, a + changeset that introduced or removed, say, a particular line of text. See git-diff(1).

-plumbing +plumbing

- Cute name for core git. + Cute name for core git.

-porcelain +porcelain

Cute name for programs and program suites depending on - core git, presenting a high level access to - core git. Porcelains expose more of a SCM - interface than the plumbing. + core git, presenting a high level access to + core git. Porcelains expose more of a SCM + interface than the plumbing.

-pull +pull

- Pulling a branch means to fetch it and - merge it. + Pulling a branch means to fetch it and + merge it.

-push +push

- Pushing a branch means to get the branch's - head ref from a remote repository, - find out if it is an ancestor to the branch's local - head ref is a direct, and in that case, putting all - objects, which are reachable from the local - head ref, and which are missing from the remote - repository, into the remote - object database, and updating the remote - head ref. If the remote head is not an - ancestor to the local head, the push fails. + Pushing a branch means to get the branch's + head ref from a remote repository, + find out if it is an ancestor to the branch's local + head ref is a direct, and in that case, putting all + objects, which are reachable from the local + head ref, and which are missing from the remote + repository, into the remote + object database, and updating the remote + head ref. If the remote head is not an + ancestor to the local head, the push fails.

-reachable +reachable

- All of the ancestors of a given commit are said to be - reachable from that commit. More - generally, one object is reachable from - another if we can reach the one from the other by a chain - that follows tags to whatever they tag, commits to their - parents or trees, and trees to the trees or blobs that they contain. + All of the ancestors of a given commit are said to be + reachable from that commit. More + generally, one object is reachable from + another if we can reach the one from the other by a chain + that follows tags to whatever they tag, + commits to their parents or trees, and + trees to the trees or blobs + that they contain.

-rebase +rebase

- To clean a branch by starting from the - head of the main line of development - ("master"), and reapply the (possibly cherry-picked) - changes from that branch. + To reapply a series of changes from a branch to a + different base, and reset the head of that branch + to the result.

-ref +ref

- A 40-byte hex representation of a SHA1 or a name that - denotes a particular object. These may be stored in + A 40-byte hex representation of a SHA1 or a name that + denotes a particular object. These may be stored in $GIT_DIR/refs/.

-refspec +refspec

- A refspec is used by fetch and - push to describe the mapping between remote ref - and local ref. They are combined with a colon in the format + A refspec is used by fetch and + push to describe the mapping between remote ref + and local ref. They are combined with a colon in the format <src>:<dst>, preceded by an optional plus sign, +. For example: git - fetch $URL - refs/heads/master:refs/heads/origin means - "grab the master branch head - from the $URL and store it as my origin - branch head". And git push - $URL refs/heads/master:refs/heads/to-upstream means - "publish my master branch - head as to-upstream branch at $URL". See + fetch $URL refs/heads/master:refs/heads/origin means + "grab the master branch head + from the $URL and store it as my origin + branch head". And git push + $URL refs/heads/master:refs/heads/to-upstream means + "publish my master branch + head as to-upstream branch at $URL". See also git-push(1)

-repository +repository

- A collection of refs together with an object database containing all objects, which are reachable + A collection of refs together with an object database containing all objects which are reachable from the refs, possibly accompanied by meta data from one or more - porcelains. A repository can share an - object database with other repositories. + porcelains. A repository can share an + object database with other repositories.

-resolve +resolve

The action of fixing up manually what a failed automatic - merge left behind. + merge left behind.

-revision +revision

A particular state of files and directories which was stored in the - object database. It is referenced by a - commit object. + object database. It is referenced by a + commit object.

-rewind +rewind

To throw away part of the development, i.e. to assign the - head to an earlier revision. + head to an earlier revision.

-SCM +SCM

@@ -867,72 +866,72 @@ div.exampleblock-content {

-SHA1 +SHA1

- Synonym for object name. + Synonym for object name.

-shallow repository +shallow repository

- A shallow repository has an incomplete + A shallow repository has an incomplete history some of whose commits have parents cauterized away (in other words, git is told to pretend that these commits do not have the - parents, even though they are recorded in the commit object). This is sometimes useful when you are interested only in the + parents, even though they are recorded in the commit object). This is sometimes useful when you are interested only in the recent history of a project even though the real history recorded in the - upstream is much larger. A shallow repository - is created by giving —depth option to git-clone(1), and its - history can be later deepened with git-fetch(1). + upstream is much larger. A shallow repository + is created by giving the —depth option to git-clone(1), and + its history can be later deepened with git-fetch(1).

-symref +symref

- Symbolic reference: instead of containing the SHA1 id - itself, it is of the format ref: refs/some/thing and when + Symbolic reference: instead of containing the SHA1 id + itself, it is of the format ref: refs/some/thing and when referenced, it recursively dereferences to this reference. HEAD is a - prime example of a symref. Symbolic references are + prime example of a symref. Symbolic references are manipulated with the git-symbolic-ref(1) command.

-tag +tag

- A ref pointing to a tag or - commit object. In contrast to a head, - a tag is not changed by a commit. Tags (not - tag objects) are stored in $GIT_DIR/refs/tags/. A git - tag has nothing to do with a Lisp tag (which is - called object type in git's context). A - tag is most typically used to mark a particular point in the - commit ancestry chain. + A ref pointing to a tag or + commit object. In contrast to a head, + a tag is not changed by a commit. Tags (not + tag objects) are stored in $GIT_DIR/refs/tags/. A + git tag has nothing to do with a Lisp tag (which would be + called an object type in git's context). A + tag is most typically used to mark a particular point in the + commit ancestry chain.

-tag object +tag object

- An object containing a ref pointing to - another object, which can contain a message just like a - commit object. It can also contain a (PGP) - signature, in which case it is called a "signed tag object". + An object containing a ref pointing to + another object, which can contain a message just like a + commit object. It can also contain a (PGP) + signature, in which case it is called a "signed tag object".

-topic branch +topic branch

- A regular git branch that is used by a developer to + A regular git branch that is used by a developer to identify a conceptual line of development. Since branches are very easy and inexpensive, it is often desirable to have several small branches that each contain very well defined concepts or small incremental yet @@ -940,86 +939,78 @@ div.exampleblock-content {

-tracking branch +tracking branch

- A regular git branch that is used to follow changes from - another repository. A tracking branch should not contain direct modifications or have local commits - made to it. A tracking branch can usually be - identified as the right-hand-side ref in a Pull: - refspec. + A regular git branch that is used to follow changes from + another repository. A tracking branch should not contain direct modifications or have local commits + made to it. A tracking branch can usually be + identified as the right-hand-side ref in a Pull: + refspec.

-tree +tree

- Either a working tree, or a tree object together with the dependent blob and tree objects - (i.e. a stored representation of a working tree). + Either a working tree, or a tree object together with the dependent blob and tree objects + (i.e. a stored representation of a working tree).

-tree object +tree object

- An object containing a list of file names and modes along - with refs to the associated blob and/or tree objects. A - tree is equivalent to a directory. + An object containing a list of file names and modes along + with refs to the associated blob and/or tree objects. A + tree is equivalent to a directory.

-tree-ish +tree-ish

- A ref pointing to either a commit object, a tree object, or a tag object pointing to a tag or commit or - tree object. + A ref pointing to either a commit object, a tree object, or a tag object pointing to a tag or commit or + tree object.

-unmerged index +unmerged index

- An index which contains unmerged index entries. + An index which contains unmerged + index entries.

-unreachable object +unreachable object

- An object which is not reachable from a - branch, tag, or any other reference. + An object which is not reachable from a + branch, tag, or any other reference.

-working tree +working tree

The set of files and directories currently being worked on, i.e. you can - work in your working tree without using git at all. + work in your working tree without using git at all.

-

Author

-
-

Written by Johannes Schindelin <Johannes.Schindelin@gmx.de> and -the git-list <git@vger.kernel.org>.

-
-

GIT

-
-

Part of the git suite

-
diff --git a/glossary.txt b/glossary.txt index 9f446241e..2465514e4 100644 --- a/glossary.txt +++ b/glossary.txt @@ -1,365 +1,405 @@ -alternate object database:: - Via the alternates mechanism, a repository can inherit part of its - object database from another object database, which is called - "alternate". - -bare repository:: - A bare repository is normally an appropriately named - directory with a `.git` suffix that does not have a - locally checked-out copy of any of the files under revision - control. That is, all of the `git` administrative and - control files that would normally be present in the - hidden `.git` sub-directory are directly present in - the `repository.git` directory instead, and no other files - are present and checked out. Usually publishers of public - repositories make bare repositories available. - -blob object:: - Untyped object, e.g. the contents of a file. - -branch:: - A non-cyclical graph of revisions, i.e. the complete history of - a particular revision, which is called the branch head. The - branch heads are stored in `$GIT_DIR/refs/heads/`. - -cache:: - Obsolete for: index. - -chain:: - A list of objects, where each object in the list contains a - reference to its successor (for example, the successor of a commit - could be one of its parents). - -changeset:: - BitKeeper/cvsps speak for "commit". Since git does not store - changes, but states, it really does not make sense to use - the term "changesets" with git. - -checkout:: - The action of updating the working tree to a revision which was - stored in the object database. - -cherry-picking:: - In SCM jargon, "cherry pick" means to choose a subset of - changes out of a series of changes (typically commits) - and record them as a new series of changes on top of - different codebase. In GIT, this is performed by - "git cherry-pick" command to extract the change - introduced by an existing commit and to record it based - on the tip of the current branch as a new commit. - -clean:: - A working tree is clean, if it corresponds to the revision - referenced by the current head. Also see "dirty". - -commit:: - As a verb: The action of storing the current state of the index in the - object database. The result is a revision. - As a noun: Short hand for commit object. - -commit object:: - An object which contains the information about a particular - revision, such as parents, committer, author, date and the - tree object which corresponds to the top directory of the - stored revision. - -core git:: - Fundamental data structures and utilities of git. Exposes only - limited source code management tools. - -DAG:: - Directed acyclic graph. The commit objects form a directed acyclic - graph, because they have parents (directed), and the graph of commit - objects is acyclic (there is no chain which begins and ends with the - same object). - -dangling object:: - An unreachable object which is not reachable even from other - unreachable objects; a dangling object has no references to it - from any reference or object in the repository. - -dircache:: +GIT Glossary +============ + +[[def_alternate_object_database]]alternate object database:: + Via the alternates mechanism, a <> can + inherit part of its <> from another + <>, which is called "alternate". + +[[def_bare_repository]]bare repository:: + A <> is normally an appropriately + named <> with a `.git` suffix that does not + have a locally checked-out copy of any of the files under + <> control. That is, all of the `git` + administrative and control files that would normally be present in the + hidden `.git` sub-directory are directly present in the + `repository.git` directory instead, + and no other files are present and checked out. Usually publishers of + public repositories make bare repositories available. + +[[def_blob_object]]blob object:: + Untyped <>, e.g. the contents of a file. + +[[def_branch]]branch:: + A non-cyclical graph of revisions, i.e. the complete history of a + particular <>, which is called the + branch <>. The heads + are stored in `$GIT_DIR/refs/heads/`. + +[[def_cache]]cache:: + Obsolete for: <>. + +[[def_chain]]chain:: + A list of objects, where each <> in the list contains + a reference to its successor (for example, the successor of a + <> could be one of its parents). + +[[def_changeset]]changeset:: + BitKeeper/cvsps speak for "<>". Since git does not + store changes, but states, it really does not make sense to use the term + "changesets" with git. + +[[def_checkout]]checkout:: + The action of updating the <> to a + <> which was stored in the + <>. + +[[def_cherry-picking]]cherry-picking:: + In <> jargon, "cherry pick" means to choose a subset of + changes out of a series of changes (typically commits) and record them + as a new series of changes on top of different codebase. In GIT, this is + performed by "git cherry-pick" command to extract the change introduced + by an existing <> and to record it based on the tip + of the current <> as a new <>. + +[[def_clean]]clean:: + A <> is <>, if it + corresponds to the <> referenced by the current + <>. Also see "<>". + +[[def_commit]]commit:: + As a verb: The action of storing the current state of the + <> in the <>. The + result is a <>. As a noun: Short hand for + <>. + +[[def_commit_object]]commit object:: + An <> which contains the information about a + particular <>, such as parents, committer, + author, date and the <> which corresponds + to the top <> of the stored + <>. + +[[def_core_git]]core git:: + Fundamental data structures and utilities of git. Exposes only limited + source code management tools. + +[[def_DAG]]DAG:: + Directed acyclic graph. The <> objects form a + directed acyclic graph, because they have parents (directed), and the + graph of <> objects is acyclic (there is no + <> which begins and ends with the same + <>). + +[[def_dangling_object]]dangling object:: + An <> which is not + <> even from other unreachable objects; a + <> has no references to it from any + reference or <> in the <>. + +[[def_dircache]]dircache:: You are *waaaaay* behind. -dirty:: - A working tree is said to be dirty if it contains modifications - which have not been committed to the current branch. - -directory:: +[[def_directory]]directory:: The list you get with "ls" :-) -ent:: - Favorite synonym to "tree-ish" by some total geeks. See +[[def_dirty]]dirty:: + A <> is said to be <> if + it contains modifications which have not been committed to the current + <>. + +[[def_ent]]ent:: + Favorite synonym to "<>" by some total geeks. See `http://en.wikipedia.org/wiki/Ent_(Middle-earth)` for an in-depth - explanation. Avoid this term, not to confuse people. - -fast forward:: - A fast-forward is a special type of merge where you have - a revision and you are "merging" another branch's changes - that happen to be a descendant of what you have. - In such these cases, you do not make a new merge commit but - instead just update to his revision. This will happen - frequently on a tracking branch of a remote repository. - -fetch:: - Fetching a branch means to get the branch's head ref from a - remote repository, to find out which objects are missing from - the local object database, and to get them, too. - -file system:: - Linus Torvalds originally designed git to be a user space file - system, i.e. the infrastructure to hold files and directories. - That ensured the efficiency and speed of git. - -git archive:: - Synonym for repository (for arch people). - -grafts:: - Grafts enables two otherwise different lines of development to be - joined together by recording fake ancestry information for commits. - This way you can make git pretend the set of parents a commit - has is different from what was recorded when the commit was created. - Configured via the `.git/info/grafts` file. - -hash:: - In git's context, synonym to object name. - -head:: - The top of a branch. It contains a ref to the corresponding - commit object. - -head ref:: - A ref pointing to a head. Often, this is abbreviated to "head". - Head refs are stored in `$GIT_DIR/refs/heads/`. - -hook:: - During the normal execution of several git commands, - call-outs are made to optional scripts that allow - a developer to add functionality or checking. - Typically, the hooks allow for a command to be pre-verified - and potentially aborted, and allow for a post-notification - after the operation is done. - The hook scripts are found in the `$GIT_DIR/hooks/` directory, - and are enabled by simply making them executable. - -index:: - A collection of files with stat information, whose contents are - stored as objects. The index is a stored version of your working - tree. Truth be told, it can also contain a second, and even a third - version of a working tree, which are used when merging. - -index entry:: - The information regarding a particular file, stored in the index. - An index entry can be unmerged, if a merge was started, but not - yet finished (i.e. if the index contains multiple versions of - that file). - -master:: - The default development branch. Whenever you create a git - repository, a branch named "master" is created, and becomes - the active branch. In most cases, this contains the local + explanation. Avoid this term, not to confuse people. + +[[def_fast_forward]]fast forward:: + A fast-forward is a special type of <> where you have a + <> and you are "merging" another + <>'s changes that happen to be a descendant of what + you have. In such these cases, you do not make a new <> + <> but instead just update to his + <>. This will happen frequently on a + <> of a remote + <>. + +[[def_fetch]]fetch:: + Fetching a <> means to get the + <>'s <> from a remote + <>, to find out which objects are missing + from the local <>, and to get them, + too. + +[[def_file_system]]file system:: + Linus Torvalds originally designed git to be a user space file system, + i.e. the infrastructure to hold files and directories. That ensured the + efficiency and speed of git. + +[[def_git_archive]]git archive:: + Synonym for <> (for arch people). + +[[def_grafts]]grafts:: + Grafts enables two otherwise different lines of development to be joined + together by recording fake ancestry information for commits. This way + you can make git pretend the set of parents a <> has + is different from what was recorded when the <> was + created. Configured via the `.git/info/grafts` file. + +[[def_hash]]hash:: + In git's context, synonym to <>. + +[[def_head]]head:: + The top of a <>. It contains a <> to the + corresponding <>. + +[[def_head_ref]]head ref:: + A <> pointing to a <>. Often, this is + abbreviated to "<>". Head refs are stored in + `$GIT_DIR/refs/heads/`. + +[[def_hook]]hook:: + During the normal execution of several git commands, call-outs are made + to optional scripts that allow a developer to add functionality or + checking. Typically, the hooks allow for a command to be pre-verified + and potentially aborted, and allow for a post-notification after the + operation is done. The <> scripts are found in the + `$GIT_DIR/hooks/` <>, and are enabled by simply + making them executable. + +[[def_index]]index:: + A collection of files with stat information, whose contents are stored + as objects. The <> is a stored version of your working + <>. Truth be told, it can also contain a second, and even + a third version of a <>, which are used + when merging. + +[[def_index_entry]]index entry:: + The information regarding a particular file, stored in the + <>. An <> can be unmerged, + if a <> was started, but not yet finished (i.e. if the + <> contains multiple versions of that file). + +[[def_master]]master:: + The default development <>. Whenever you create a git + <>, a <> named + "<>" is created, and becomes the active + <>. In most cases, this contains the local development, though that is purely conventional and not required. -merge:: - To merge branches means to try to accumulate the changes since a - common ancestor and apply them to the first branch. An automatic - merge uses heuristics to accomplish that. Evidently, an automatic - merge can fail. - -object:: - The unit of storage in git. It is uniquely identified by - the SHA1 of its contents. Consequently, an object can not - be changed. - -object database:: - Stores a set of "objects", and an individual object is identified - by its object name. The objects usually live in `$GIT_DIR/objects/`. - -object identifier:: - Synonym for object name. - -object name:: - The unique identifier of an object. The hash of the object's contents - using the Secure Hash Algorithm 1 and usually represented by the 40 - character hexadecimal encoding of the hash of the object (possibly - followed by a white space). - -object type:: - One of the identifiers "commit","tree","tag" and "blob" describing - the type of an object. - -octopus:: - To merge more than two branches. Also denotes an intelligent - predator. - -origin:: - The default upstream repository. Most projects have at - least one upstream project which they track. By default - 'origin' is used for that purpose. New upstream updates +[[def_merge]]merge:: + To <> branches means to try to accumulate the changes + since a common ancestor and apply them to the first + <>. An automatic <> uses heuristics + to accomplish that. Evidently, an automatic <> can + fail. + +[[def_object]]object:: + The unit of storage in git. It is uniquely identified by the + <> of its contents. Consequently, an + <> can not be changed. + +[[def_object_database]]object database:: + Stores a set of "objects", and an individual <> is + identified by its <>. The objects usually + live in `$GIT_DIR/objects/`. + +[[def_object_identifier]]object identifier:: + Synonym for <>. + +[[def_object_name]]object name:: + The unique identifier of an <>. The <> + of the <>'s contents using the Secure Hash Algorithm + 1 and usually represented by the 40 character hexadecimal encoding of + the <> of the <> (possibly followed by + a white space). + +[[def_object_type]]object type:: + One of the identifiers + "<>","<>","<>" or "<>" + describing the type of an <>. + +[[def_octopus]]octopus:: + To <> more than two branches. Also denotes an + intelligent predator. + +[[def_origin]]origin:: + The default upstream <>. Most projects have + at least one upstream project which they track. By default + '<>' is used for that purpose. New upstream updates will be fetched into remote tracking branches named origin/name-of-upstream-branch, which you can see using - "git branch -r". + "git <> -r". -pack:: - A set of objects which have been compressed into one file (to save - space or to transmit them efficiently). +[[def_pack]]pack:: + A set of objects which have been compressed into one file (to save space + or to transmit them efficiently). -pack index:: +[[def_pack_index]]pack index:: The list of identifiers, and other information, of the objects in a - pack, to assist in efficiently accessing the contents of a pack. - -parent:: - A commit object contains a (possibly empty) list of the logical - predecessor(s) in the line of development, i.e. its parents. - -pickaxe:: - The term pickaxe refers to an option to the diffcore routines - that help select changes that add or delete a given text string. - With the --pickaxe-all option, it can be used to view the - full changeset that introduced or removed, say, a particular - line of text. See gitlink:git-diff[1]. - -plumbing:: - Cute name for core git. - -porcelain:: - Cute name for programs and program suites depending on core git, - presenting a high level access to core git. Porcelains expose - more of a SCM interface than the plumbing. - -pull:: - Pulling a branch means to fetch it and merge it. - -push:: - Pushing a branch means to get the branch's head ref from a remote - repository, find out if it is an ancestor to the branch's local - head ref is a direct, and in that case, putting all objects, which - are reachable from the local head ref, and which are missing from - the remote repository, into the remote object database, and updating - the remote head ref. If the remote head is not an ancestor to the - local head, the push fails. - -reachable:: - All of the ancestors of a given commit are said to be reachable from - that commit. More generally, one object is reachable from another if - we can reach the one from the other by a chain that follows tags to - whatever they tag, commits to their parents or trees, and trees to the - trees or blobs that they contain. - -rebase:: - To clean a branch by starting from the head of the main line of - development ("master"), and reapply the (possibly cherry-picked) - changes from that branch. - -ref:: - A 40-byte hex representation of a SHA1 or a name that denotes - a particular object. These may be stored in `$GIT_DIR/refs/`. - -refspec:: - A refspec is used by fetch and push to describe the mapping - between remote ref and local ref. They are combined with - a colon in the format :, preceded by an optional - plus sign, +. For example: - `git fetch $URL refs/heads/master:refs/heads/origin` - means "grab the master branch head from the $URL and store - it as my origin branch head". - And `git push $URL refs/heads/master:refs/heads/to-upstream` - means "publish my master branch head as to-upstream branch - at $URL". See also gitlink:git-push[1] - -repository:: - A collection of refs together with an object database containing - all objects, which are reachable from the refs, possibly accompanied - by meta data from one or more porcelains. A repository can - share an object database with other repositories. - -resolve:: - The action of fixing up manually what a failed automatic merge - left behind. - -revision:: - A particular state of files and directories which was stored in - the object database. It is referenced by a commit object. - -rewind:: - To throw away part of the development, i.e. to assign the head to - an earlier revision. - -SCM:: + <>, to assist in efficiently accessing the contents of a + <>. + +[[def_parent]]parent:: + A <> contains a (possibly empty) list + of the logical predecessor(s) in the line of development, i.e. its + parents. + +[[def_pickaxe]]pickaxe:: + The term <> refers to an option to the diffcore + routines that help select changes that add or delete a given text + string. With the --pickaxe-all option, it can be used to view the full + <> that introduced or removed, say, a + particular line of text. See gitlink:git-diff[1]. + +[[def_plumbing]]plumbing:: + Cute name for <>. + +[[def_porcelain]]porcelain:: + Cute name for programs and program suites depending on + <>, presenting a high level access to + <>. Porcelains expose more of a <> + interface than the <>. + +[[def_pull]]pull:: + Pulling a <> means to <> it and + <> it. + +[[def_push]]push:: + Pushing a <> means to get the <>'s + <> from a remote <>, + find out if it is an ancestor to the <>'s local + <> is a direct, and in that case, putting all + objects, which are <> from the local + <>, and which are missing from the remote + <>, into the remote + <>, and updating the remote + <>. If the remote <> is not an + ancestor to the local <>, the <> fails. + +[[def_reachable]]reachable:: + All of the ancestors of a given <> are said to be + <> from that <>. More + generally, one <> is <> from + another if we can reach the one from the other by a <> + that follows <> to whatever they tag, + <> to their parents or trees, and + <> to the trees or <> + that they contain. + +[[def_rebase]]rebase:: + To reapply a series of changes from a <> to a + different base, and reset the <> of that branch + to the result. + +[[def_ref]]ref:: + A 40-byte hex representation of a <> or a name that + denotes a particular <>. These may be stored in + `$GIT_DIR/refs/`. + +[[def_refspec]]refspec:: + A <> is used by <> and + <> to describe the mapping between remote <> + and local <>. They are combined with a colon in the format + :, preceded by an optional plus sign, +. For example: `git + fetch $URL refs/heads/master:refs/heads/origin` means + "grab the master <> <> + from the $URL and store it as my origin + <> <>". And `git <> + $URL refs/heads/master:refs/heads/to-upstream` means + "publish my master <> + <> as to-upstream <> at $URL". See + also gitlink:git-push[1] + +[[def_repository]]repository:: + A collection of refs together with an <> containing all objects which are <> + from the refs, possibly accompanied by meta data from one or more + porcelains. A <> can share an + <> with other repositories. + +[[def_resolve]]resolve:: + The action of fixing up manually what a failed automatic + <> left behind. + +[[def_revision]]revision:: + A particular state of files and directories which was stored in the + <>. It is referenced by a + <>. + +[[def_rewind]]rewind:: + To throw away part of the development, i.e. to assign the + <> to an earlier <>. + +[[def_SCM]]SCM:: Source code management (tool). -SHA1:: - Synonym for object name. - -shallow repository:: - A shallow repository has an incomplete history some of - whose commits have parents cauterized away (in other - words, git is told to pretend that these commits do not - have the parents, even though they are recorded in the - commit object). This is sometimes useful when you are - interested only in the recent history of a project even - though the real history recorded in the upstream is - much larger. A shallow repository is created by giving - `--depth` option to gitlink:git-clone[1], and its - history can be later deepened with gitlink:git-fetch[1]. - -symref:: - Symbolic reference: instead of containing the SHA1 id itself, it - is of the format 'ref: refs/some/thing' and when referenced, it - recursively dereferences to this reference. 'HEAD' is a prime - example of a symref. Symbolic references are manipulated with - the gitlink:git-symbolic-ref[1] command. - -topic branch:: - A regular git branch that is used by a developer to - identify a conceptual line of development. Since branches - are very easy and inexpensive, it is often desirable to - have several small branches that each contain very well - defined concepts or small incremental yet related changes. - -tracking branch:: - A regular git branch that is used to follow changes from - another repository. A tracking branch should not contain - direct modifications or have local commits made to it. - A tracking branch can usually be identified as the - right-hand-side ref in a Pull: refspec. - -tree object:: - An object containing a list of file names and modes along with refs - to the associated blob and/or tree objects. A tree is equivalent - to a directory. - -tree:: - Either a working tree, or a tree object together with the - dependent blob and tree objects (i.e. a stored representation - of a working tree). - -tree-ish:: - A ref pointing to either a commit object, a tree object, or a - tag object pointing to a tag or commit or tree object. - -tag object:: - An object containing a ref pointing to another object, which can - contain a message just like a commit object. It can also - contain a (PGP) signature, in which case it is called a "signed - tag object". - -tag:: - A ref pointing to a tag or commit object. In contrast to a head, - a tag is not changed by a commit. Tags (not tag objects) are - stored in `$GIT_DIR/refs/tags/`. A git tag has nothing to do with - a Lisp tag (which is called object type in git's context). - A tag is most typically used to mark a particular point in the - commit ancestry chain. - -unmerged index:: - An index which contains unmerged index entries. - -unreachable object:: - An object which is not reachable from a branch, tag, or any - other reference. - -working tree:: - The set of files and directories currently being worked on, - i.e. you can work in your working tree without using git at all. - +[[def_SHA1]]SHA1:: + Synonym for <>. + +[[def_shallow_repository]]shallow repository:: + A <> has an incomplete + history some of whose commits have parents cauterized away (in other + words, git is told to pretend that these commits do not have the + parents, even though they are recorded in the <>). This is sometimes useful when you are interested only in the + recent history of a project even though the real history recorded in the + upstream is much larger. A <> + is created by giving the `--depth` option to gitlink:git-clone[1], and + its history can be later deepened with gitlink:git-fetch[1]. + +[[def_symref]]symref:: + Symbolic reference: instead of containing the <> id + itself, it is of the format 'ref: refs/some/thing' and when + referenced, it recursively dereferences to this reference. 'HEAD' is a + prime example of a <>. Symbolic references are + manipulated with the gitlink:git-symbolic-ref[1] command. + +[[def_tag]]tag:: + A <> pointing to a <> or + <>. In contrast to a <>, + a tag is not changed by a <>. Tags (not + <>) are stored in `$GIT_DIR/refs/tags/`. A + git tag has nothing to do with a Lisp tag (which would be + called an <> in git's context). A + tag is most typically used to mark a particular point in the + <> ancestry <>. + +[[def_tag_object]]tag object:: + An <> containing a <> pointing to + another <>, which can contain a message just like a + <>. It can also contain a (PGP) + signature, in which case it is called a "signed <>". + +[[def_topic_branch]]topic branch:: + A regular git <> that is used by a developer to + identify a conceptual line of development. Since branches are very easy + and inexpensive, it is often desirable to have several small branches + that each contain very well defined concepts or small incremental yet + related changes. + +[[def_tracking_branch]]tracking branch:: + A regular git <> that is used to follow changes from + another <>. A <> should not contain direct modifications or have local commits + made to it. A <> can usually be + identified as the right-hand-side <> in a Pull: + <>. + +[[def_tree]]tree:: + Either a <>, or a <> together with the dependent blob and <> objects + (i.e. a stored representation of a <>). + +[[def_tree_object]]tree object:: + An <> containing a list of file names and modes along + with refs to the associated blob and/or tree objects. A + <> is equivalent to a <>. + +[[def_tree-ish]]tree-ish:: + A <> pointing to either a <>, a <>, or a <> pointing to a <> or <> or + <>. + +[[def_unmerged_index]]unmerged index:: + An <> which contains unmerged + <>. + +[[def_unreachable_object]]unreachable object:: + An <> which is not <> from a + <>, <>, or any other reference. + +[[def_working_tree]]working tree:: + The set of files and directories currently being worked on, i.e. you can + work in your <> without using git at all. diff --git a/user-manual.html b/user-manual.html index 2caf56d1a..47dc72f64 100644 --- a/user-manual.html +++ b/user-manual.html @@ -1,4 +1,4 @@ -Git User's Manual

Git User's Manual


Table of Contents

Preface
1. Git Quick Start
Creating a new repository
Managing branches
Exploring history
Making changes
Merging
Sharing your changes
Repository maintenance
2. Repositories and Branches
How to get a git repository
How to check out a different version of a project
Understanding History: Commits
Understanding history: commits, parents, and reachability
Understanding history: History diagrams
Understanding history: What is a branch?
Manipulating branches
Examining branches from a remote repository
Naming branches, tags, and other references
Updating a repository with git fetch
Fetching branches from other repositories
3. Exploring git history
How to use bisect to find a regression
Naming commits
Creating tags
Browsing revisions
Generating diffs
Viewing old file versions
Examples
Check whether two branches point at the same history
Find first tagged version including a given fix
4. Developing with git
Telling git your name
Creating a new repository
how to make a commit
creating good commit messages
how to merge
Resolving a merge
Getting conflict-resolution help during a merge
undoing a merge
Fast-forward merges
Fixing mistakes
Fixing a mistake with a new commit
Fixing a mistake by editing history
Checking out an old version of a file
Ensuring good performance
Ensuring reliability
Checking the repository for corruption
Recovering lost changes
5. Sharing development with others
Getting updates with git pull
Submitting patches to a project
Importing patches to a project
Setting up a public repository
Exporting a git repository via http
Exporting a git repository via the git protocol
Pushing changes to a public repository
Setting up a shared repository
Allow web browsing of a repository
Examples
6. Rewriting history and maintaining patch series
Creating the perfect patch series
Keeping a patch series up to date using git-rebase
Modifying a single commit
Reordering or selecting from a patch series
Other tools
Problems with rewriting history
7. Advanced branch management
Fetching individual branches
Understanding git history: fast-forwards
Forcing git fetch to do non-fast-forward updates
Configuring remote branches
8. Git internals
The Object Database
Blob Object
Tree Object
Commit Object
Trust
Tag Object
The "index" aka "Current Directory Cache"
The Workflow
working directory -> index
index -> object database
object database -> index
index -> working directory
Tying it all together
Examining the data
Merging multiple trees
Merging multiple trees, continued
How git stores objects efficiently: pack files
Dangling objects
9. Glossary of git terms
10. Notes and todo list for this manual

Preface

This manual is designed to be readable by someone with basic unix +Git User's Manual

Git User's Manual


Table of Contents

Preface
1. Git Quick Start
Creating a new repository
Managing branches
Exploring history
Making changes
Merging
Sharing your changes
Repository maintenance
2. Repositories and Branches
How to get a git repository
How to check out a different version of a project
Understanding History: Commits
Understanding history: commits, parents, and reachability
Understanding history: History diagrams
Understanding history: What is a branch?
Manipulating branches
Examining branches from a remote repository
Naming branches, tags, and other references
Updating a repository with git fetch
Fetching branches from other repositories
3. Exploring git history
How to use bisect to find a regression
Naming commits
Creating tags
Browsing revisions
Generating diffs
Viewing old file versions
Examples
Check whether two branches point at the same history
Find first tagged version including a given fix
4. Developing with git
Telling git your name
Creating a new repository
how to make a commit
creating good commit messages
how to merge
Resolving a merge
Getting conflict-resolution help during a merge
undoing a merge
Fast-forward merges
Fixing mistakes
Fixing a mistake with a new commit
Fixing a mistake by editing history
Checking out an old version of a file
Ensuring good performance
Ensuring reliability
Checking the repository for corruption
Recovering lost changes
5. Sharing development with others
Getting updates with git pull
Submitting patches to a project
Importing patches to a project
Setting up a public repository
Exporting a git repository via http
Exporting a git repository via the git protocol
Pushing changes to a public repository
Setting up a shared repository
Allow web browsing of a repository
Examples
6. Rewriting history and maintaining patch series
Creating the perfect patch series
Keeping a patch series up to date using git-rebase
Modifying a single commit
Reordering or selecting from a patch series
Other tools
Problems with rewriting history
7. Advanced branch management
Fetching individual branches
Understanding git history: fast-forwards
Forcing git fetch to do non-fast-forward updates
Configuring remote branches
8. Git internals
The Object Database
Blob Object
Tree Object
Commit Object
Trust
Tag Object
The "index" aka "Current Directory Cache"
The Workflow
working directory -> index
index -> object database
object database -> index
index -> working directory
Tying it all together
Examining the data
Merging multiple trees
Merging multiple trees, continued
How git stores objects efficiently: pack files
Dangling objects
9. GIT Glossary
10. Notes and todo list for this manual

Preface

This manual is designed to be readable by someone with basic unix command-line skills, but no previous knowledge of git.

Chapter 1 gives a brief overview of git commands, without any explanation; you may prefer to skip to chapter 2 on a first reading.

Chapters 2 and 3 explain how to fetch and study a project using git—the tools you'd need to build and test a particular version of a @@ -75,7 +75,7 @@ $ current branch:

$ git pull git://example.com/project.git theirbranch

Store the fetched branch into a local branch before merging into the current branch:

$ git pull git://example.com/project.git theirbranch:mybranch

After creating commits on a local branch, update the remote branch with your commits:

$ git push ssh://example.com/project.git mybranch:theirbranch

When remote and local branch are both named "test":

$ git push ssh://example.com/project.git test

Shortcut version for a frequently used remote repository:

$ git remote add example ssh://example.com/project.git
-$ git push example test

Repository maintenance

Check for corruption:

$ git fsck

Recompress, remove unused cruft:

$ git gc

Repository maintenance

Check for corruption:

$ git fsck

Recompress, remove unused cruft:

$ git gc

Chapter 2. Repositories and Branches

How to get a git repository

It will be useful to have a git repository to experiment with as you read this manual.

The best way to get one is by using the git-clone(1) command to download a copy of an existing repository for a project that you are interested in. If you don't already have a project in mind, here @@ -91,13 +91,14 @@ contains all the information about the history of the project.

In most of repositories above.

How to check out a different version of a project

Git is best thought of as a tool for storing the history of a collection of files. It stores the history as a compressed collection of interrelated snapshots (versions) of the project's -contents.

A single git repository may contain multiple branches. Each branch -is a bookmark referencing a particular point in the project history. -The git-branch(1) command shows you the list of branches:

$ git branch
-* master

A freshly cloned repository contains a single branch, named "master", -and the working directory contains the version of the project -referred to by the master branch.

Most projects also use tags. Tags, like branches, are references -into the project's history, and can be listed using the +contents.

A single git repository may contain multiple branches. It keeps track +of them by keeping a list of heads which reference the +latest version on each branch; the git-branch(1) command shows +you the list of branch heads:

$ git branch
+* master

A freshly cloned repository contains a single branch head, named +"master", and working directory is initialized to the state of +the project referred to by "master".

Most projects also use tags. Tags, like heads, are +references into the project's history, and can be listed using the git-tag(1) command:

$ git tag -l
v2.6.11
v2.6.11-tree
@@ -109,16 +110,16 @@ v2.6.12-rc5
v2.6.12-rc6
v2.6.13
...

Tags are expected to always point at the same version of a project, -while branches are expected to advance as development progresses.

Create a new branch pointing to one of these versions and check it +while heads are expected to advance as development progresses.

Create a new branch head pointing to one of these versions and check it out using git-checkout(1):

$ git checkout -b new v2.6.13

The working directory then reflects the contents that the project had when it was tagged v2.6.13, and git-branch(1) shows two branches, with an asterisk marking the currently checked-out branch:

$ git branch
  master
* new

If you decide that you'd rather see version 2.6.17, you can modify -the current branch to point at v2.6.17 instead, with

$ git reset --hard v2.6.17

Note that if the current branch was your only reference to a +the current branch to point at v2.6.17 instead, with

$ git reset --hard v2.6.17

Note that if the current branch head was your only reference to a particular point in history, then resetting that branch may leave you -with no way to find the history it used to point to; so use this -command carefully.

Understanding History: Commits

Every change in the history of a project is represented by a commit. +with no way to find the history it used to point to; so use this command +carefully.

Understanding History: Commits

Every change in the history of a project is represented by a commit. The git-show(1) command shows the most recent commit on the current branch:

$ git show
commit 2b5f6dcce5bf94b9b119e9ed8d537098ec61c3d2
@@ -158,7 +159,7 @@ has that commit at all). Since the object name is computed as a hash over the contents of the commit, you are guaranteed that the commit can never change without its name also changing.

In fact, in Chapter 8, Git internals we shall see that everything stored in git history, including file data and directory contents, is stored in an object -with a name that is a hash of its contents.

Understanding history: commits, parents, and reachability

Every commit (except the very first commit in a project) also has a +with a name that is a hash of its contents.

Understanding history: commits, parents, and reachability

Every commit (except the very first commit in a project) also has a parent commit which shows what happened before this commit. Following the chain of parents will eventually take you back to the beginning of the project.

However, the commits do not form a simple list; git allows lines of @@ -171,22 +172,20 @@ command; running gitk now on a git repository and looking for merge commits will help understand how the git organizes history.

In the following, we say that commit X is "reachable" from commit Y if commit X is an ancestor of commit Y. Equivalently, you could say that Y is a descendent of X, or that there is a chain of parents -leading from commit Y to commit X.

Understanding history: History diagrams

We will sometimes represent git history using diagrams like the one +leading from commit Y to commit X.

Understanding history: History diagrams

We will sometimes represent git history using diagrams like the one below. Commits are shown as "o", and the links between them with lines drawn with - / and \. Time goes left to right:

         o--o--o <-- Branch A
         /
  o--o--o <-- master
         \
          o--o--o <-- Branch B

If we need to talk about a particular commit, the character "o" may -be replaced with another letter or number.

Understanding history: What is a branch?

Though we've been using the word "branch" to mean a kind of reference -to a particular commit, the word branch is also commonly used to -refer to the line of commits leading up to that point. In the -example above, git may think of the branch named "A" as just a -pointer to one particular commit, but we may refer informally to the -line of three commits leading up to that point as all being part of -"branch A".

If we need to make it clear that we're just talking about the most -recent commit on the branch, we may refer to that commit as the -"head" of the branch.

Manipulating branches

Creating, deleting, and modifying branches is quick and easy; here's +be replaced with another letter or number.

Understanding history: What is a branch?

When we need to be precise, we will use the word "branch" to mean a line +of development, and "branch head" (or just "head") to mean a reference +to the most recent commit on a branch. In the example above, the branch +head named "A" is a pointer to one particular commit, but we refer to +the line of three commits leading up to that point as all being part of +"branch A".

However, when no confusion will result, we often just use the term +"branch" both for branches and for branch heads.

Manipulating branches

Creating, deleting, and modifying branches is quick and easy; here's a summary of the commands:

git branch
@@ -227,7 +226,7 @@ git checkout -b <new> <start-point> create a new branch <new> referencing <start-point>, and check it out.

It is also useful to know that the special symbol "HEAD" can always -be used to refer to the current branch.

Examining branches from a remote repository

The "master" branch that was created at the time you cloned is a copy +be used to refer to the current branch.

Examining branches from a remote repository

The "master" branch that was created at the time you cloned is a copy of the HEAD in the repository that you cloned from. That repository may also have had other branches, though, and your local repository keeps branches which track each of those remote branches, which you @@ -263,7 +262,7 @@ repository, creating new commits and advancing the branches to point at the new commits.

The command "git fetch", with no arguments, will update all of the remote-tracking branches to the latest version found in her repository. It will not touch any of your own branches—not even the -"master" branch that was created for you on clone.

Fetching branches from other repositories

You can also track branches from repositories other than the one you +"master" branch that was created for you on clone.

Fetching branches from other repositories

You can also track branches from repositories other than the one you cloned from, using git-remote(1):

$ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
$ git fetch
* refs/remotes/linux-nfs/master: storing branch 'master' ...
@@ -280,12 +279,12 @@ a new stanza:

$ ...

This is what causes git to track the remote's branches; you may modify or delete these configuration options by editing .git/config with a text editor. (See the "CONFIGURATION FILE" section of -git-config(1) for details.)

Chapter 3. Exploring git history

Git is best thought of as a tool for storing the history of a collection of files. It does this by storing compressed snapshots of the contents of a file heirarchy, together with "commits" which show the relationships between these snapshots.

Git provides extremely flexible and fast tools for exploring the history of a project.

We start with one specialized tool that is useful for finding the -commit that introduced a bug into a project.

How to use bisect to find a regression

Suppose version 2.6.18 of your project worked, but the version at +commit that introduced a bug into a project.

How to use bisect to find a regression

Suppose version 2.6.18 of your project worked, but the version at "master" crashes. Sometimes the best way to find the cause of such a regression is to perform a brute-force search through the project's history to find the particular commit that caused the problem. The @@ -313,7 +312,7 @@ occasionally you may land on a commit that broke something unrelated; run

$ git bisect-visualize

which will run gitk and label the commit it chose with a marker that says "bisect". Chose a safe-looking commit nearby, note its commit id, and check it out with:

$ git reset --hard fb47ddb2db...

then test, run "bisect good" or "bisect bad" as appropriate, and -continue.

Naming commits

We have seen several ways of naming commits already:

  • +continue.

Naming commits

We have seen several ways of naming commits already:

  • 40-hexdigit object name
  • branch name: refers to the commit at the head of the given @@ -343,11 +342,11 @@ which refers to the other branch that we're merging in to the current branch.

    The git-rev-parse(1) command is a low-level command that is occasionally useful for translating some name for a commit to the object name for that commit:

    $ git rev-parse origin
    -e05db0fd4f31dde7005f075a84f96b360d05984b

Creating tags

We can also create a tag to refer to a particular commit; after +e05db0fd4f31dde7005f075a84f96b360d05984b

Creating tags

We can also create a tag to refer to a particular commit; after running

$ git-tag stable-1 1b2e1d63ff

You can use stable-1 to refer to the commit 1b2e1d63ff.

This creates a "lightweight" tag. If the tag is a tag you wish to share with others, and possibly sign cryptographically, then you should create a tag object instead; see the git-tag(1) man -page for details.

Browsing revisions

The git-log(1) command can show lists of commits. On its +page for details.

Browsing revisions

The git-log(1) command can show lists of commits. On its own, it shows all commits reachable from the parent commit; but you can also make more specific requests:

$ git log v2.5..        # commits since (not reachable from) v2.5
$ git log test..master  # commits reachable from master but not test
@@ -363,15 +362,15 @@ commits since v2.5 which touch the Makefile or any file under fs:

Note that git log starts with the most recent commit and works backwards through the parents; however, since git history can contain multiple independent lines of development, the particular order that -commits are listed in may be somewhat arbitrary.

Generating diffs

You can generate diffs between any two versions using +commits are listed in may be somewhat arbitrary.

Generating diffs

You can generate diffs between any two versions using git-diff(1):

$ git diff master..test

Sometimes what you want instead is a set of patches:

$ git format-patch master..test

will generate a file with a patch for each commit reachable from test but not from master. Note that if master also has commits which are not reachable from test, then the combined result of these patches -will not be the same as the diff produced by the git-diff example.

Viewing old file versions

You can always view an old version of a file by just checking out the +will not be the same as the diff produced by the git-diff example.

Viewing old file versions

You can always view an old version of a file by just checking out the correct revision first. But sometimes it is more convenient to be able to view an old version of a single file without checking anything out; this command does that:

$ git show v2.5:fs/locks.c

Before the colon may be anything that names a commit, and after it -may be any path to a file tracked by git.

Examples

Check whether two branches point at the same history

Suppose you want to check whether two branches point at the same point +may be any path to a file tracked by git.

Examples

Check whether two branches point at the same history

Suppose you want to check whether two branches point at the same point in history.

$ git diff origin..master

will tell you whether the contents of the project are the same at the two branches; in theory, however, it's possible that the same project contents could have been arrived at by two different historical @@ -380,7 +379,7 @@ e05db0fd4f31dde7005f075a84f96b360d05984b
$ git rev-list master
e05db0fd4f31dde7005f075a84f96b360d05984b

Or you could recall that the … operator selects all commits contained reachable from either one reference or the other but not -both: so

$ git log origin...master

will return no commits when the two branches are equal.

Find first tagged version including a given fix

Suppose you know that the commit e05db0fd fixed a certain problem. +both: so

$ git log origin...master

will return no commits when the two branches are equal.

Find first tagged version including a given fix

Suppose you know that the commit e05db0fd fixed a certain problem. You'd like to find the earliest tagged release that contains that fix.

Of course, there may be more than one answer—if the history branched after commit e05db0fd, then there could be multiple "earliest" tagged @@ -407,13 +406,13 @@ available
   ! [v1.5.0-rc2] GIT v1.5.0-rc2
...

then search for a line that looks like

+ ++ [e05db0fd] Fix warnings in sha1_file.c - use C99 printf format if
available

Which shows that e05db0fd is reachable from itself, from v1.5.0-rc1, and -from v1.5.0-rc2, but not from v1.5.0-rc0.

Chapter 4. Developing with git

Telling git your name

Before creating any commits, you should introduce yourself to git. The easiest way to do so is:

$ cat >~/.gitconfig <<\EOF
[user]
        name = Your Name Comes Here
        email = you@yourdomain.example.com
EOF

(See the "CONFIGURATION FILE" section of git-config(1) for -details on the configuration file.)

Creating a new repository

Creating a new repository from scratch is very easy:

$ mkdir project
+details on the configuration file.)

Creating a new repository

Creating a new repository from scratch is very easy:

$ mkdir project
$ cd project
$ git init

If you have some initial content (say, a tarball):

$ tar -xzvf project.tar.gz
$ cd project
@@ -444,12 +443,12 @@ about to commit:

$ $ git diff          # difference between the index file and your
                    # working directory; changes that would not
                    # be included if you ran "commit" now.
-$ git status        # a brief per-file summary of the above.

creating good commit messages

Though not required, it's a good idea to begin the commit message +$ git status        # a brief per-file summary of the above.

creating good commit messages

Though not required, it's a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. Tools that turn commits into email, for example, use the first line on the Subject line and the rest of the commit in the -body.

how to merge

You can rejoin two diverging branches of development using +body.

how to merge

You can rejoin two diverging branches of development using git-merge(1):

$ git merge branchname

merges the development in the branch "branchname" into the current branch. If there are conflicts—for example, if the same file is modified in two different ways in the remote branch and the local @@ -477,7 +476,7 @@ $ some information about the merge. Normally you can just use this default message unchanged, but you may add additional commentary of your own if desired.

The above is all you need to know to resolve a simple merge. But git -also provides more information to help resolve conflicts:

Getting conflict-resolution help during a merge

All of the changes that git was able to merge automatically are +also provides more information to help resolve conflicts:

Getting conflict-resolution help during a merge

All of the changes that git was able to merge automatically are already added to the index file, so git-diff(1) shows only the conflicts. It uses an unusual syntax:

$ git diff
diff --cc file.txt
@@ -531,7 +530,7 @@ git-diff will (by default) no longer show diffs for that file.

$ git reset --hard HEAD

Or, if you've already commited the merge that you want to throw away,

$ git reset --hard ORIG_HEAD

However, this last command can be dangerous in some cases—never throw away a commit you have already committed if that commit may itself have been merged into another branch, as doing so may confuse -further merges.

Fast-forward merges

There is one special case not mentioned above, which is treated +further merges.

Fast-forward merges

There is one special case not mentioned above, which is treated differently. Normally, a merge results in a merge commit, with two parents, one pointing at each of the two lines of development that were merged.

However, if one of the two lines of development is completely @@ -539,7 +538,7 @@ contained within the other—so every commit present in the one is already contained in the other—then git just performs a fast forward; the head of the current branch is moved forward to point at the head of the merged-in branch, without -any new commits being created.

Fixing mistakes

If you've messed up the working tree, but haven't yet committed your +any new commits being created.

Fixing mistakes

If you've messed up the working tree, but haven't yet committed your mistake, you can return the entire working tree to the last committed state with

$ git reset --hard HEAD

If you make a commit that you later wish you hadn't, there are two fundamentally different ways to fix the problem:

  1. @@ -552,7 +551,7 @@ You can go back and modify the old commit. You should git does not normally expect the "history" of a project to change, and cannot correctly perform repeated merges from a branch that has had its history changed. -

Fixing a mistake with a new commit

Creating a new commit that reverts an earlier change is very easy; +

Fixing a mistake with a new commit

Creating a new commit that reverts an earlier change is very easy; just pass the git-revert(1) command a reference to the bad commit; for example, to revert the most recent commit:

$ git revert HEAD

This will create a new commit which undoes the change in HEAD. You will be given a chance to edit the commit message for the new commit.

You can also revert an earlier change, for example, the next-to-last:

$ git revert HEAD^

In this case git will attempt to undo the old change while leaving @@ -567,17 +566,17 @@ changes, giving you a chance to edit the old commit message first.

Again, been merged into another branch; use git-revert(1) instead in that case.

It is also possible to edit commits further back in the history, but this is an advanced topic to be left for -another chapter.

Checking out an old version of a file

In the process of undoing a previous bad change, you may find it +another chapter.

Checking out an old version of a file

In the process of undoing a previous bad change, you may find it useful to check out an older version of a particular file using git-checkout(1). We've used git checkout before to switch branches, but it has quite different behavior if it is given a path name: the command

$ git checkout HEAD^ path/to/file

replaces path/to/file by the contents it had in the commit HEAD^, and also updates the index to match. It does not change branches.

If you just want to look at an old version of the file, without modifying the working directory, you can do that with -git-show(1):

$ git show HEAD^:path/to/file

which will display the given version of the file.

Ensuring good performance

On large repositories, git depends on compression to keep the history +git-show(1):

$ git show HEAD^:path/to/file

which will display the given version of the file.

Ensuring good performance

On large repositories, git depends on compression to keep the history information from taking up to much space on disk or in memory.

This compression is not performed automatically. Therefore you should occasionally run git-gc(1):

$ git gc

to recompress the archive. This can be very time-consuming, so -you may prefer to run git-gc when you are not doing other work.

Ensuring reliability

Checking the repository for corruption

The git-fsck(1) command runs a number of self-consistency checks +you may prefer to run git-gc when you are not doing other work.

Ensuring reliability

Checking the repository for corruption

The git-fsck(1) command runs a number of self-consistency checks on the repository, and reports on any problems. This may take some time. The most common warning by far is about "dangling" objects:

$ git fsck
dangling commit 7281251ddd2a61e38657c827739c57015671a6b3
@@ -592,7 +591,7 @@ dangling you can remove them at any time with git-prune(1) or the —prune option to git-gc(1):

$ git gc --prune

This may be time-consuming. Unlike most other git operations (including git-gc when run without any options), it is not safe to prune while -other git operations are in progress in the same repository.

For more about dangling objects, see the section called “Dangling objects”.

Recovering lost changes

Reflogs

Say you modify a branch with git-reset(1) —hard, and then +other git operations are in progress in the same repository.

For more about dangling objects, see the section called “Dangling objects”.

Recovering lost changes

Reflogs

Say you modify a branch with git-reset(1) —hard, and then realize that the branch was the only reference you had to that point in history.

Fortunately, git also keeps a log, called a "reflog", of all the previous values of each branch. So in this case you can still find the @@ -607,7 +606,7 @@ how to control this pruning, and see the "SPECIFYING REVISIONS" section of git-rev-parse(1) for details.

Note that the reflog history is very different from normal git history. While normal history is shared by every repository that works on the same project, the reflog history is not shared: it tells you only about -how the branches in your local repository have changed over time.

Examining dangling objects

In some situations the reflog may not be able to save you. For +how the branches in your local repository have changed over time.

Examining dangling objects

In some situations the reflog may not be able to save you. For example, suppose you delete a branch, then realize you need the history it contained. The reflog is also deleted; however, if you have not yet pruned the repository, then you may still be able to find @@ -624,7 +623,7 @@ you get exactly the history reachable from that commit that is lost. (And notice that it might not be just one commit: we only report the "tip of the line" as being dangling, but there might be a whole deep and complex commit history that was dropped.)

If you decide you want the history back, you can always create a new -reference pointing to it, for example, a new branch:

$ git branch recovered-branch 7281251ddd

Chapter 5. Sharing development with others

Getting updates with git pull

After you clone a repository and make a few changes of your own, you +reference pointing to it, for example, a new branch:

$ git branch recovered-branch 7281251ddd

Chapter 5. Sharing development with others

Getting updates with git pull

After you clone a repository and make a few changes of your own, you may wish to check the original repository for updates and merge them into your own work.

We have already seen how to keep remote tracking branches up to date with git-fetch(1), and how to merge two branches. So you can merge in changes from the @@ -641,13 +640,13 @@ repository that you pulled from.

(But note that no such commit will be cre updated to point to the latest commit from the upstream branch.)

The git-pull command can also be given "." as the "remote" repository, in which case it just merges in a branch from the current repository; so the commands

$ git pull . branch
-$ git merge branch

are roughly equivalent. The former is actually very commonly used.

Submitting patches to a project

If you just have a few changes, the simplest way to submit them may +$ git merge branch

are roughly equivalent. The former is actually very commonly used.

Submitting patches to a project

If you just have a few changes, the simplest way to submit them may just be to send them as patches in email:

First, use git-format-patch(1); for example:

$ git format-patch origin

will produce a numbered series of files in the current directory, one for each patch in the current branch but not in origin/HEAD.

You can then import these into your mail client and send them by hand. However, if you have a lot to send at once, you may prefer to use the git-send-email(1) script to automate the process. Consult the mailing list for your project first to determine how they -prefer such patches be handled.

Importing patches to a project

Git also provides a tool called git-am(1) (am stands for +prefer such patches be handled.

Importing patches to a project

Git also provides a tool called git-am(1) (am stands for "apply mailbox"), for importing such an emailed series of patches. Just save all of the patch-containing messages, in order, into a single mailbox file, say "patches.mbox", then run

$ git am -3 patches.mbox

Git will apply each patch in order; if any conflicts are found, it @@ -664,7 +663,7 @@ you did in the section "git-clone(1), git-fetch[1], git-pull[1], etc.) that accept a URL as an argument -will also accept a local file patch; so, for example, you can +will also accept a local directory name; so, for example, you can use

$ git clone /path/to/repository
$ git pull /path/to/other/repository

If this sort of setup is inconvenient or impossible, another (more common) option is to set up a public repository on a public server. @@ -719,16 +718,16 @@ save typing; so, for example, after

$         url = ssh://yourserver.com/~you/proj.git
EOF

you should be able to perform the above push with just

$ git push public-repo master

See the explanations of the remote.<name>.url, branch.<name>.remote, and remote.<name>.push options in git-config(1) for -details.

Setting up a shared repository

Another way to collaborate is by using a model similar to that +details.

Setting up a shared repository

Another way to collaborate is by using a model similar to that commonly used in CVS, where several developers with special rights all push to and pull from a single shared repository. See git for CVS users for instructions on how to -set this up.

Allow web browsing of a repository

The gitweb cgi script provides users an easy way to browse your +set this up.

Allow web browsing of a repository

The gitweb cgi script provides users an easy way to browse your project's files and history without having to install git; see the file -gitweb/README in the git source tree for instructions on setting it up.

Examples

TODO: topic branches, typical roles as in everyday.txt, ?

Chapter 6. Rewriting history and maintaining patch series

Normally commits are only added to a project, never taken away or +gitweb/README in the git source tree for instructions on setting it up.

Examples

TODO: topic branches, typical roles as in everyday.txt, ?

Chapter 6. Rewriting history and maintaining patch series

Normally commits are only added to a project, never taken away or replaced. Git is designed with this assumption, and violating it will cause git's merge machinery (for example) to do the wrong thing.

However, there is a situation in which it can be useful to violate this -assumption.

Creating the perfect patch series

Suppose you are a contributor to a large project, and you want to add a +assumption.

Creating the perfect patch series

Suppose you are a contributor to a large project, and you want to add a complicated feature, and to present it to the other developers in a way that makes it easy for them to read your changes, verify that they are correct, and understand why you made each change.

If you present all of your changes as a single patch (or commit), they @@ -747,7 +746,7 @@ The complete series produces the same end result as your own (probably much messier!) development process did.

We will introduce some tools that can help you do this, explain how to use them, and then explain some of the problems that can arise because -you are rewriting history.

Keeping a patch series up to date using git-rebase

Suppose that you create a branch "mywork" on a remote-tracking branch +you are rewriting history.

Keeping a patch series up to date using git-rebase

Suppose that you create a branch "mywork" on a remote-tracking branch "origin", and create some commits on top of it:

$ git checkout -b mywork origin
$ vi file.txt
$ git commit
@@ -774,7 +773,7 @@ patches to the new mywork. The result will look like:

$ git rebase --continue

and git will continue applying the rest of the patches.

At any point you may use the —abort option to abort this process and -return mywork to the state it had before you started the rebase:

$ git rebase --abort

Modifying a single commit

We saw in the section called “Fixing a mistake by editing history” that you can replace the +return mywork to the state it had before you started the rebase:

$ git rebase --abort

Modifying a single commit

We saw in the section called “Fixing a mistake by editing history” that you can replace the most recent commit using

$ git commit --amend

which will replace the old commit by a new commit incorporating your changes, giving you a chance to edit the old commit message first.

You can also use a combination of this and git-rebase(1) to edit commits further back in your history. First, tag the problematic commit with

$ git tag bad mywork~5

(Either gitk or git-log may be useful for finding the commit.)

Then check out a new branch at that commit, edit it, and rebase the rest of @@ -786,7 +785,7 @@ on mywork reapplied on top of the modified commit you created in TMP. You can then clean up with

$ git branch -d TMP
$ git tag -d bad

Note that the immutable nature of git history means that you haven't really "modified" existing commits; instead, you have replaced the old commits with -new commits having new object names.

Reordering or selecting from a patch series

Given one existing commit, the git-cherry-pick(1) command +new commits having new object names.

Reordering or selecting from a patch series

Given one existing commit, the git-cherry-pick(1) command allows you to apply the change introduced by that commit and create a new commit that records it. So, for example, if "mywork" points to a series of patches on top of "origin", you might do something like:

$ git checkout -b mywork-new origin
@@ -796,9 +795,9 @@ cherry-pick, and possibly modifying them as you go using commit —amend.

Another technique is to use git-format-patch to create a series of patches, then reset the state to before the patches:

$ git format-patch origin
$ git reset --hard origin

Then modify, reorder, or eliminate patches as preferred before applying -them again with git-am(1).

Other tools

There are numerous other tools, such as stgit, which exist for the +them again with git-am(1).

Other tools

There are numerous other tools, such as stgit, which exist for the purpose of maintaining a patch series. These are outside of the scope of -this manual.

Problems with rewriting history

The primary problem with rewriting the history of a branch has to do +this manual.

Problems with rewriting history

The primary problem with rewriting the history of a branch has to do with merging. Suppose somebody fetches your branch and merges it into their branch, with a result something like this:

 o--o--O--o--o--o <-- origin
         \        \
@@ -819,7 +818,7 @@ new.  The results are likely to be unexpected.

You may still choose to pub and it may be useful for others to be able to fetch those branches in order to examine or test them, but they should not attempt to pull such branches into their own work.

For true distributed development that supports proper merging, -published branches should never be rewritten.

Chapter 7. Advanced branch management

Fetching individual branches

Instead of using git-remote(1), you can also choose just +published branches should never be rewritten.

Chapter 7. Advanced branch management

Fetching individual branches

Instead of using git-remote(1), you can also choose just to update one branch at a time, and to store it locally under an arbitrary name:

$ git fetch origin todo:my-todo-work

The first argument, "origin", just tells git to fetch from the repository you originally cloned from. The second argument tells git @@ -843,10 +842,10 @@ resulting in a situation like:

 o--o--o--o--a--b &
 described in the following section.  However, note that in the
 situation above this may mean losing the commits labeled "a" and "b",
 unless you've already created a reference of your own pointing to
-them.

Forcing git fetch to do non-fast-forward updates

If git fetch fails because the new head of a branch is not a +them.

Forcing git fetch to do non-fast-forward updates

If git fetch fails because the new head of a branch is not a descendant of the old head, you may force the update with:

$ git fetch git://example.com/proj.git +master:refs/remotes/example/master

Note the addition of the "+" sign. Be aware that commits that the old version of example/master pointed at may be lost, as we saw in -the previous section.

Configuring remote branches

We saw above that "origin" is just a shortcut to refer to the +the previous section.

Configuring remote branches

We saw above that "origin" is just a shortcut to refer to the repository that you originally cloned from. This information is stored in git configuration variables, which you can see using git-config(1):

$ git config -l
@@ -866,8 +865,8 @@ $ throwing away commits on mybranch.

Also note that all of the above configuration can be performed by directly editing the file .git/config instead of using git-config(1).

See git-config(1) for more details on the configuration -options mentioned above.

Chapter 8. Git internals

There are two object abstractions: the "object database", and the -"current directory cache" aka "index".

The Object Database

The object database is literally just a content-addressable collection +options mentioned above.

Chapter 8. Git internals

There are two object abstractions: the "object database", and the +"current directory cache" aka "index".

The Object Database

The object database is literally just a content-addressable collection of objects. All objects are named by their content, which is approximated by the SHA1 hash of the object itself. Objects may refer to other objects (by referencing their SHA1 hash), and so you can @@ -909,7 +908,7 @@ size> + <byte\0> + <binary object data>.

The structured obj connectivity to other objects verified. This is generally done with the git-fsck program, which generates a full dependency graph of all objects, and verifies their internal consistency (in addition -to just verifying their superficial consistency through the hash).

The object types in some more detail:

Blob Object

A "blob" object is nothing but a binary blob of data, and doesn't +to just verifying their superficial consistency through the hash).

The object types in some more detail:

Blob Object

A "blob" object is nothing but a binary blob of data, and doesn't refer to anything else. There is no signature or any other verification of the data, so while the object is consistent (it is indexed by its sha1 hash, so the data itself is certainly correct), it @@ -921,7 +920,7 @@ repository) have the same contents, they will share the same blob object. The object is totally independent of its location in the directory tree, and renaming a file does not change the object that file is associated with in any way.

A blob is typically created when git-update-index(1) -is run, and its data can be accessed by git-cat-file(1).

Tree Object

The next hierarchical object type is the "tree" object. A tree object +is run, and its data can be accessed by git-cat-file(1).

Tree Object

The next hierarchical object type is the "tree" object. A tree object is a list of mode/name/blob data, sorted by name. Alternatively, the mode data may specify a directory mode, in which case instead of naming a blob, that name is associated with another TREE object.

Like the "blob" object, a tree object is uniquely determined by the @@ -960,7 +959,7 @@ rename information or file mode change information. All of that is implicit in the trees involved (the result tree, and the result trees of the parents), and describing that makes no sense in this idiotic file manager.

A commit is created with git-commit-tree(1) and -its data can be accessed by git-cat-file(1).

Trust

An aside on the notion of "trust". Trust is really outside the scope +its data can be accessed by git-cat-file(1).

Trust

An aside on the notion of "trust". Trust is really outside the scope of "git", but it's worth noting a few things. First off, since everything is hashed with SHA1, you can trust that an object is intact and has not been messed with by external sources. So the name @@ -976,7 +975,7 @@ that you trust that commit, and the immutability of the history of commits tells others that they can trust the whole history.

In other words, you can easily validate a whole archive by just sending out a single email that tells the people the name (SHA1 hash) of the top commit, and digitally sign that email using something -like GPG/PGP.

To assist in this, git also provides the tag object…

Tag Object

Git provides the "tag" object to simplify creating, managing and +like GPG/PGP.

To assist in this, git also provides the tag object…

Tag Object

Git provides the "tag" object to simplify creating, managing and exchanging symbolic and signed tokens. The "tag" object at its simplest simply symbolically identifies another object by containing the sha1, type and symbolic name.

However it can optionally contain additional signature information @@ -986,7 +985,7 @@ integrity; the trust framework (and signature provision and verification) has to come from outside.

A tag is created with git-mktag(1), its data can be accessed by git-cat-file(1), and the signature can be verified by -git-verify-tag(1).

The "index" aka "Current Directory Cache"

The index is a simple binary file, which contains an efficient +git-verify-tag(1).

The "index" aka "Current Directory Cache"

The index is a simple binary file, which contains an efficient representation of a virtual directory content at some random time. It does so by a simple array that associates a set of names, dates, permissions and content (aka "blob") objects together. The cache is @@ -1019,11 +1018,11 @@ involves a controlled modification of the index file. In particular, the index file can have the representation of an intermediate tree that has not yet been instantiated. So the index can be thought of as a write-back cache, which can contain dirty information that has not yet -been written back to the backing store.

The Workflow

Generally, all "git" operations work on the index file. Some operations +been written back to the backing store.

The Workflow

Generally, all "git" operations work on the index file. Some operations work purely on the index file (showing the current state of the index), but most operations move data to and from the index file. Either from the database or from the working directory. Thus there are four -main combinations:

working directory -> index

You update the index with information from the working directory with +main combinations:

working directory -> index

You update the index with information from the working directory with the git-update-index(1) command. You generally update the index information by just specifying the filename you want to update, like so:

$ git-update-index filename

but to avoid common mistakes with filename globbing etc, the command @@ -1039,16 +1038,16 @@ does not exist any more, it will update the index accordingly.

As a specia will refresh the "stat" information of each index to match the current stat information. It will not update the object status itself, and it will only update the fields that are used to quickly test whether -an object still matches its old backing store object.

index -> object database

You write your current index file to a "tree" object with the program

$ git-write-tree

that doesn't come with any options - it will just write out the +an object still matches its old backing store object.

index -> object database

You write your current index file to a "tree" object with the program

$ git-write-tree

that doesn't come with any options - it will just write out the current index into the set of tree objects that describe that state, and it will return the name of the resulting top-level tree. You can use that tree to re-generate the index at any time by going in the -other direction:

object database -> index

You read a "tree" file from the object database, and use that to +other direction:

object database -> index

You read a "tree" file from the object database, and use that to populate (and overwrite - don't do this if your index contains any unsaved state that you might want to restore later!) your current index. Normal operation is just

$ git-read-tree <sha1 of tree>

and your index file will now be equivalent to the tree that you saved earlier. However, that is only your index file: your working -directory contents have not been modified.

index -> working directory

You update your working directory from the index by "checking out" +directory contents have not been modified.

index -> working directory

You update your working directory from the index by "checking out" files. This is not a very common operation, since normally you'd just keep your files updated, and rather than write to your working directory, you'd tell the index files about the changes in your @@ -1059,7 +1058,7 @@ with

$ if you have an old version of the tree already checked out, you will need to use the "-f" flag (before the "-a" flag or the filename) to force the checkout.

Finally, there are a few odds and ends which are not purely moving -from one representation to the other:

Tying it all together

To commit a tree you have instantiated with "git-write-tree", you'd +from one representation to the other:

Tying it all together

To commit a tree you have instantiated with "git-write-tree", you'd create a "commit" object that refers to that tree and the history behind it - most notably the "parent" commits that preceded it in history.

Normally a "commit" has one parent: the previous state of the tree @@ -1108,7 +1107,7 @@ various pieces fit together.


                    |  Working  |
                    | Directory |
                    +-----------+
-

Examining the data

You can examine the data represented in the object database and the +

Examining the data

You can examine the data represented in the object database and the index with various helper tools. For every object, you can use git-cat-file(1) to examine details about the object:

$ git-cat-file -t <objectname>

shows the type of the object, and once you have the type (which is @@ -1118,7 +1117,7 @@ there is a special helper for showing that content, called readable form.

It's especially instructive to look at "commit" objects, since those tend to be small and fairly self-explanatory. In particular, if you follow the convention of having the top commit name in .git/HEAD, -you can do

$ git-cat-file commit HEAD

to see what the top commit was.

Merging multiple trees

Git helps you do a three-way merge, which you can expand to n-way by +you can do

$ git-cat-file commit HEAD

to see what the top commit was.

Merging multiple trees

Git helps you do a three-way merge, which you can expand to n-way by repeating the merge procedure arbitrary times until you finally "commit" the state. The normal situation is that you'd only do one three-way merge (two parents), and commit it, but if you like to, you @@ -1137,7 +1136,7 @@ make sure that you've committed those - in fact you would normally always do a merge against your last commit (which should thus match what you have in your current index anyway).

To do the merge, do

$ git-read-tree -m -u <origtree> <yourtree> <targettree>

which will do all trivial merge operations for you directly in the index file, and you can just write the result out with -git-write-tree.

Merging multiple trees, continued

Sadly, many merges aren't trivial. If there are files that have +git-write-tree.

Merging multiple trees, continued

Sadly, many merges aren't trivial. If there are files that have been added.moved or removed, or if both branches have modified the same file, you will be left with an index tree that contains "merge entries" in it. Such an index tree can NOT be written out to a tree @@ -1172,7 +1171,7 @@ that path tells git to mark the path resolved.

The above is the descriptio to help you understand what conceptually happens under the hood. In practice, nobody, not even git itself, uses three git-cat-file for this. There is git-merge-index program that extracts the -stages to temporary files and calls a "merge" script on it:

$ git-merge-index git-merge-one-file hello.c

and that is what higher level git merge -s resolve is implemented with.

How git stores objects efficiently: pack files

We've seen how git stores each object in a file named after the +stages to temporary files and calls a "merge" script on it:

$ git-merge-index git-merge-one-file hello.c

and that is what higher level git merge -s resolve is implemented with.

How git stores objects efficiently: pack files

We've seen how git stores each object in a file named after the object's SHA1 hash.

Unfortunately this system becomes inefficient once a project has a lot of objects. Try this on an old project:

$ git count-objects
6930 objects, 47620 kilobytes

The first number is the number of objects which are kept in @@ -1236,441 +1235,472 @@ on what it found, git-fsck itself is never "dangerous" to run. Running it while somebody is actually changing the repository can cause confusing and scary messages, but it won't actually do anything bad. In contrast, running "git prune" while somebody is actively changing the -repository is a BAD idea).

Chapter 9. Glossary of git terms

-alternate object database +repository is a BAD idea).

Chapter 9. GIT Glossary

+alternate object database
- Via the alternates mechanism, a repository can inherit part of its - object database from another object database, which is called - "alternate". + Via the alternates mechanism, a repository can + inherit part of its object database from another + object database, which is called "alternate".
-bare repository +bare repository
- A bare repository is normally an appropriately named - directory with a .git suffix that does not have a - locally checked-out copy of any of the files under revision - control. That is, all of the git administrative and - control files that would normally be present in the - hidden .git sub-directory are directly present in - the repository.git directory instead, and no other files - are present and checked out. Usually publishers of public - repositories make bare repositories available. + A bare repository is normally an appropriately + named directory with a .git suffix that does not + have a locally checked-out copy of any of the files under + revision control. That is, all of the git + administrative and control files that would normally be present in the + hidden .git sub-directory are directly present in the + repository.git directory instead, + and no other files are present and checked out. Usually publishers of + public repositories make bare repositories available.
-blob object +blob object
- Untyped object, e.g. the contents of a file. + Untyped object, e.g. the contents of a file.
-branch +branch
- A non-cyclical graph of revisions, i.e. the complete history of - a particular revision, which is called the branch head. The - branch heads are stored in $GIT_DIR/refs/heads/. + A non-cyclical graph of revisions, i.e. the complete history of a + particular revision, which is called the + branch head. The heads + are stored in $GIT_DIR/refs/heads/.
-cache +cache
- Obsolete for: index. + Obsolete for: index.
-chain +chain
- A list of objects, where each object in the list contains a - reference to its successor (for example, the successor of a commit - could be one of its parents). + A list of objects, where each object in the list contains + a reference to its successor (for example, the successor of a + commit could be one of its parents).
-changeset +changeset
- BitKeeper/cvsps speak for "commit". Since git does not store - changes, but states, it really does not make sense to use - the term "changesets" with git. + BitKeeper/cvsps speak for "commit". Since git does not + store changes, but states, it really does not make sense to use the term + "changesets" with git.
-checkout +checkout
- The action of updating the working tree to a revision which was - stored in the object database. + The action of updating the working tree to a + revision which was stored in the + object database.
-cherry-picking +cherry-picking
- In SCM jargon, "cherry pick" means to choose a subset of - changes out of a series of changes (typically commits) - and record them as a new series of changes on top of - different codebase. In GIT, this is performed by - "git cherry-pick" command to extract the change - introduced by an existing commit and to record it based - on the tip of the current branch as a new commit. + In SCM jargon, "cherry pick" means to choose a subset of + changes out of a series of changes (typically commits) and record them + as a new series of changes on top of different codebase. In GIT, this is + performed by "git cherry-pick" command to extract the change introduced + by an existing commit and to record it based on the tip + of the current branch as a new commit.
-clean +clean
- A working tree is clean, if it corresponds to the revision - referenced by the current head. Also see "dirty". + A working tree is clean, if it + corresponds to the revision referenced by the current + head. Also see "dirty".
-commit +commit
- As a verb: The action of storing the current state of the index in the - object database. The result is a revision. - As a noun: Short hand for commit object. + As a verb: The action of storing the current state of the + index in the object database. The + result is a revision. As a noun: Short hand for + commit object.
-commit object +commit object
- An object which contains the information about a particular - revision, such as parents, committer, author, date and the - tree object which corresponds to the top directory of the - stored revision. + An object which contains the information about a + particular revision, such as parents, committer, + author, date and the tree object which corresponds + to the top directory of the stored + revision.
-core git +core git
- Fundamental data structures and utilities of git. Exposes only - limited source code management tools. + Fundamental data structures and utilities of git. Exposes only limited + source code management tools.
-DAG +DAG
- Directed acyclic graph. The commit objects form a directed acyclic - graph, because they have parents (directed), and the graph of commit - objects is acyclic (there is no chain which begins and ends with the - same object). + Directed acyclic graph. The commit objects form a + directed acyclic graph, because they have parents (directed), and the + graph of commit objects is acyclic (there is no + chain which begins and ends with the same + object).
-dangling object +dangling object
- An unreachable object which is not reachable even from other - unreachable objects; a dangling object has no references to it - from any reference or object in the repository. + An unreachable object which is not + reachable even from other unreachable objects; a + dangling object has no references to it from any + reference or object in the repository.
-dircache +dircache
You are waaaaay behind.
-dirty +directory
- A working tree is said to be dirty if it contains modifications - which have not been committed to the current branch. + The list you get with "ls" :-)
-directory +dirty
- The list you get with "ls" :-) + A working tree is said to be dirty if + it contains modifications which have not been committed to the current + branch.
-ent +ent
- Favorite synonym to "tree-ish" by some total geeks. See + Favorite synonym to "tree-ish" by some total geeks. See http://en.wikipedia.org/wiki/Ent_(Middle-earth) for an in-depth - explanation. Avoid this term, not to confuse people. + explanation. Avoid this term, not to confuse people.
-fast forward +fast forward
- A fast-forward is a special type of merge where you have - a revision and you are "merging" another branch's changes - that happen to be a descendant of what you have. - In such these cases, you do not make a new merge commit but - instead just update to his revision. This will happen - frequently on a tracking branch of a remote repository. + A fast-forward is a special type of merge where you have a + revision and you are "merging" another + branch's changes that happen to be a descendant of what + you have. In such these cases, you do not make a new merge + commit but instead just update to his + revision. This will happen frequently on a + tracking branch of a remote + repository.
-fetch +fetch
- Fetching a branch means to get the branch's head ref from a - remote repository, to find out which objects are missing from - the local object database, and to get them, too. + Fetching a branch means to get the + branch's head ref from a remote + repository, to find out which objects are missing + from the local object database, and to get them, + too.
-file system +file system
- Linus Torvalds originally designed git to be a user space file - system, i.e. the infrastructure to hold files and directories. - That ensured the efficiency and speed of git. + Linus Torvalds originally designed git to be a user space file system, + i.e. the infrastructure to hold files and directories. That ensured the + efficiency and speed of git.
-git archive +git archive
- Synonym for repository (for arch people). + Synonym for repository (for arch people).
-grafts +grafts
- Grafts enables two otherwise different lines of development to be - joined together by recording fake ancestry information for commits. - This way you can make git pretend the set of parents a commit - has is different from what was recorded when the commit was created. - Configured via the .git/info/grafts file. + Grafts enables two otherwise different lines of development to be joined + together by recording fake ancestry information for commits. This way + you can make git pretend the set of parents a commit has + is different from what was recorded when the commit was + created. Configured via the .git/info/grafts file.
-hash +hash
- In git's context, synonym to object name. + In git's context, synonym to object name.
-head +head
- The top of a branch. It contains a ref to the corresponding - commit object. + The top of a branch. It contains a ref to the + corresponding commit object.
-head ref +head ref
- A ref pointing to a head. Often, this is abbreviated to "head". - Head refs are stored in $GIT_DIR/refs/heads/. + A ref pointing to a head. Often, this is + abbreviated to "head". Head refs are stored in + $GIT_DIR/refs/heads/.
-hook +hook
- During the normal execution of several git commands, - call-outs are made to optional scripts that allow - a developer to add functionality or checking. - Typically, the hooks allow for a command to be pre-verified - and potentially aborted, and allow for a post-notification - after the operation is done. - The hook scripts are found in the $GIT_DIR/hooks/ directory, - and are enabled by simply making them executable. + During the normal execution of several git commands, call-outs are made + to optional scripts that allow a developer to add functionality or + checking. Typically, the hooks allow for a command to be pre-verified + and potentially aborted, and allow for a post-notification after the + operation is done. The hook scripts are found in the + $GIT_DIR/hooks/ directory, and are enabled by simply + making them executable.
-index +index
- A collection of files with stat information, whose contents are - stored as objects. The index is a stored version of your working - tree. Truth be told, it can also contain a second, and even a third - version of a working tree, which are used when merging. + A collection of files with stat information, whose contents are stored + as objects. The index is a stored version of your working + tree. Truth be told, it can also contain a second, and even + a third version of a working tree, which are used + when merging.
-index entry +index entry
- The information regarding a particular file, stored in the index. - An index entry can be unmerged, if a merge was started, but not - yet finished (i.e. if the index contains multiple versions of - that file). + The information regarding a particular file, stored in the + index. An index entry can be unmerged, + if a merge was started, but not yet finished (i.e. if the + index contains multiple versions of that file).
-master +master
- The default development branch. Whenever you create a git - repository, a branch named "master" is created, and becomes - the active branch. In most cases, this contains the local + The default development branch. Whenever you create a git + repository, a branch named + "master" is created, and becomes the active + branch. In most cases, this contains the local development, though that is purely conventional and not required.
-merge +merge
- To merge branches means to try to accumulate the changes since a - common ancestor and apply them to the first branch. An automatic - merge uses heuristics to accomplish that. Evidently, an automatic - merge can fail. + To merge branches means to try to accumulate the changes + since a common ancestor and apply them to the first + branch. An automatic merge uses heuristics + to accomplish that. Evidently, an automatic merge can + fail.
-object +object
- The unit of storage in git. It is uniquely identified by - the SHA1 of its contents. Consequently, an object can not - be changed. + The unit of storage in git. It is uniquely identified by the + SHA1 of its contents. Consequently, an + object can not be changed.
-object database +object database
- Stores a set of "objects", and an individual object is identified - by its object name. The objects usually live in $GIT_DIR/objects/. + Stores a set of "objects", and an individual object is + identified by its object name. The objects usually + live in $GIT_DIR/objects/.
-object identifier +object identifier
- Synonym for object name. + Synonym for object name.
-object name +object name
- The unique identifier of an object. The hash of the object's contents - using the Secure Hash Algorithm 1 and usually represented by the 40 - character hexadecimal encoding of the hash of the object (possibly - followed by a white space). + The unique identifier of an object. The hash + of the object's contents using the Secure Hash Algorithm + 1 and usually represented by the 40 character hexadecimal encoding of + the hash of the object (possibly followed by + a white space).
-object type +object type
- One of the identifiers "commit","tree","tag" and "blob" describing - the type of an object. + One of the identifiers + "commit","tree","tag" or "blob" + describing the type of an object.
-octopus +octopus
- To merge more than two branches. Also denotes an intelligent - predator. + To merge more than two branches. Also denotes an + intelligent predator.
-origin +origin
- The default upstream repository. Most projects have at - least one upstream project which they track. By default - origin is used for that purpose. New upstream updates + The default upstream repository. Most projects have + at least one upstream project which they track. By default + origin is used for that purpose. New upstream updates will be fetched into remote tracking branches named origin/name-of-upstream-branch, which you can see using - "git branch -r". + "git branch -r".
-pack +pack
- A set of objects which have been compressed into one file (to save - space or to transmit them efficiently). + A set of objects which have been compressed into one file (to save space + or to transmit them efficiently).
-pack index +pack index
The list of identifiers, and other information, of the objects in a - pack, to assist in efficiently accessing the contents of a pack. + pack, to assist in efficiently accessing the contents of a + pack.
-parent +parent
- A commit object contains a (possibly empty) list of the logical - predecessor(s) in the line of development, i.e. its parents. + A commit object contains a (possibly empty) list + of the logical predecessor(s) in the line of development, i.e. its + parents.
-pickaxe +pickaxe
- The term pickaxe refers to an option to the diffcore routines - that help select changes that add or delete a given text string. - With the —pickaxe-all option, it can be used to view the - full changeset that introduced or removed, say, a particular - line of text. See git-diff(1). + The term pickaxe refers to an option to the diffcore + routines that help select changes that add or delete a given text + string. With the —pickaxe-all option, it can be used to view the full + changeset that introduced or removed, say, a + particular line of text. See git-diff(1).
-plumbing +plumbing
- Cute name for core git. + Cute name for core git.
-porcelain +porcelain
- Cute name for programs and program suites depending on core git, - presenting a high level access to core git. Porcelains expose - more of a SCM interface than the plumbing. + Cute name for programs and program suites depending on + core git, presenting a high level access to + core git. Porcelains expose more of a SCM + interface than the plumbing.
-pull +pull
- Pulling a branch means to fetch it and merge it. + Pulling a branch means to fetch it and + merge it.
-push +push
- Pushing a branch means to get the branch's head ref from a remote - repository, find out if it is an ancestor to the branch's local - head ref is a direct, and in that case, putting all objects, which - are reachable from the local head ref, and which are missing from - the remote repository, into the remote object database, and updating - the remote head ref. If the remote head is not an ancestor to the - local head, the push fails. + Pushing a branch means to get the branch's + head ref from a remote repository, + find out if it is an ancestor to the branch's local + head ref is a direct, and in that case, putting all + objects, which are reachable from the local + head ref, and which are missing from the remote + repository, into the remote + object database, and updating the remote + head ref. If the remote head is not an + ancestor to the local head, the push fails.
-reachable +reachable
- All of the ancestors of a given commit are said to be reachable from - that commit. More generally, one object is reachable from another if - we can reach the one from the other by a chain that follows tags to - whatever they tag, commits to their parents or trees, and trees to the - trees or blobs that they contain. + All of the ancestors of a given commit are said to be + reachable from that commit. More + generally, one object is reachable from + another if we can reach the one from the other by a chain + that follows tags to whatever they tag, + commits to their parents or trees, and + trees to the trees or blobs + that they contain.
-rebase +rebase
- To clean a branch by starting from the head of the main line of - development ("master"), and reapply the (possibly cherry-picked) - changes from that branch. + To reapply a series of changes from a branch to a + different base, and reset the head of that branch + to the result.
-ref +ref
- A 40-byte hex representation of a SHA1 or a name that denotes - a particular object. These may be stored in $GIT_DIR/refs/. + A 40-byte hex representation of a SHA1 or a name that + denotes a particular object. These may be stored in + $GIT_DIR/refs/.
-refspec +refspec
- A refspec is used by fetch and push to describe the mapping - between remote ref and local ref. They are combined with - a colon in the format <src>:<dst>, preceded by an optional - plus sign, +. For example: - git fetch $URL refs/heads/master:refs/heads/origin - means "grab the master branch head from the $URL and store - it as my origin branch head". - And git push $URL refs/heads/master:refs/heads/to-upstream - means "publish my master branch head as to-upstream branch - at $URL". See also git-push(1) + A refspec is used by fetch and + push to describe the mapping between remote ref + and local ref. They are combined with a colon in the format + <src>:<dst>, preceded by an optional plus sign, +. For example: git + fetch $URL refs/heads/master:refs/heads/origin means + "grab the master branch head + from the $URL and store it as my origin + branch head". And git push + $URL refs/heads/master:refs/heads/to-upstream means + "publish my master branch + head as to-upstream branch at $URL". See + also git-push(1)
-repository +repository
- A collection of refs together with an object database containing - all objects, which are reachable from the refs, possibly accompanied - by meta data from one or more porcelains. A repository can - share an object database with other repositories. + A collection of refs together with an object database containing all objects which are reachable + from the refs, possibly accompanied by meta data from one or more + porcelains. A repository can share an + object database with other repositories.
-resolve +resolve
- The action of fixing up manually what a failed automatic merge - left behind. + The action of fixing up manually what a failed automatic + merge left behind.
-revision +revision
- A particular state of files and directories which was stored in - the object database. It is referenced by a commit object. + A particular state of files and directories which was stored in the + object database. It is referenced by a + commit object.
-rewind +rewind
- To throw away part of the development, i.e. to assign the head to - an earlier revision. + To throw away part of the development, i.e. to assign the + head to an earlier revision.
-SCM +SCM
Source code management (tool).
-SHA1 +SHA1
- Synonym for object name. + Synonym for object name.
-shallow repository +shallow repository
- A shallow repository has an incomplete history some of - whose commits have parents cauterized away (in other - words, git is told to pretend that these commits do not - have the parents, even though they are recorded in the - commit object). This is sometimes useful when you are - interested only in the recent history of a project even - though the real history recorded in the upstream is - much larger. A shallow repository is created by giving - —depth option to git-clone(1), and its - history can be later deepened with git-fetch(1). + A shallow repository has an incomplete + history some of whose commits have parents cauterized away (in other + words, git is told to pretend that these commits do not have the + parents, even though they are recorded in the commit object). This is sometimes useful when you are interested only in the + recent history of a project even though the real history recorded in the + upstream is much larger. A shallow repository + is created by giving the —depth option to git-clone(1), and + its history can be later deepened with git-fetch(1).
-symref +symref
- Symbolic reference: instead of containing the SHA1 id itself, it - is of the format ref: refs/some/thing and when referenced, it - recursively dereferences to this reference. HEAD is a prime - example of a symref. Symbolic references are manipulated with - the git-symbolic-ref(1) command. + Symbolic reference: instead of containing the SHA1 id + itself, it is of the format ref: refs/some/thing and when + referenced, it recursively dereferences to this reference. HEAD is a + prime example of a symref. Symbolic references are + manipulated with the git-symbolic-ref(1) command.
-topic branch +tag
- A regular git branch that is used by a developer to - identify a conceptual line of development. Since branches - are very easy and inexpensive, it is often desirable to - have several small branches that each contain very well - defined concepts or small incremental yet related changes. + A ref pointing to a tag or + commit object. In contrast to a head, + a tag is not changed by a commit. Tags (not + tag objects) are stored in $GIT_DIR/refs/tags/. A + git tag has nothing to do with a Lisp tag (which would be + called an object type in git's context). A + tag is most typically used to mark a particular point in the + commit ancestry chain.
-tracking branch +tag object
- A regular git branch that is used to follow changes from - another repository. A tracking branch should not contain - direct modifications or have local commits made to it. - A tracking branch can usually be identified as the - right-hand-side ref in a Pull: refspec. + An object containing a ref pointing to + another object, which can contain a message just like a + commit object. It can also contain a (PGP) + signature, in which case it is called a "signed tag object".
-tree object +topic branch
- An object containing a list of file names and modes along with refs - to the associated blob and/or tree objects. A tree is equivalent - to a directory. + A regular git branch that is used by a developer to + identify a conceptual line of development. Since branches are very easy + and inexpensive, it is often desirable to have several small branches + that each contain very well defined concepts or small incremental yet + related changes.
-tree +tracking branch
- Either a working tree, or a tree object together with the - dependent blob and tree objects (i.e. a stored representation - of a working tree). + A regular git branch that is used to follow changes from + another repository. A tracking branch should not contain direct modifications or have local commits + made to it. A tracking branch can usually be + identified as the right-hand-side ref in a Pull: + refspec.
-tree-ish +tree
- A ref pointing to either a commit object, a tree object, or a - tag object pointing to a tag or commit or tree object. + Either a working tree, or a tree object together with the dependent blob and tree objects + (i.e. a stored representation of a working tree).
-tag object +tree object
- An object containing a ref pointing to another object, which can - contain a message just like a commit object. It can also - contain a (PGP) signature, in which case it is called a "signed - tag object". + An object containing a list of file names and modes along + with refs to the associated blob and/or tree objects. A + tree is equivalent to a directory.
-tag +tree-ish
- A ref pointing to a tag or commit object. In contrast to a head, - a tag is not changed by a commit. Tags (not tag objects) are - stored in $GIT_DIR/refs/tags/. A git tag has nothing to do with - a Lisp tag (which is called object type in git's context). - A tag is most typically used to mark a particular point in the - commit ancestry chain. + A ref pointing to either a commit object, a tree object, or a tag object pointing to a tag or commit or + tree object.
-unmerged index +unmerged index
- An index which contains unmerged index entries. + An index which contains unmerged + index entries.
-unreachable object +unreachable object
- An object which is not reachable from a branch, tag, or any - other reference. + An object which is not reachable from a + branch, tag, or any other reference.
-working tree +working tree
- The set of files and directories currently being worked on, - i.e. you can work in your working tree without using git at all. -

Chapter 10. Notes and todo list for this manual

This is a work in progress.

The basic requirements: + The set of files and directories currently being worked on, i.e. you can + work in your working tree without using git at all. +

Chapter 10. Notes and todo list for this manual

This is a work in progress.

The basic requirements: - It must be readable in order, from beginning to end, by someone intelligent with a basic grasp of the unix commandline, but without any special knowledge of git. If diff --git a/user-manual.txt b/user-manual.txt index d7b227e64..1c49e6995 100644 --- a/user-manual.txt +++ b/user-manual.txt @@ -288,21 +288,22 @@ collection of files. It stores the history as a compressed collection of interrelated snapshots (versions) of the project's contents. -A single git repository may contain multiple branches. Each branch -is a bookmark referencing a particular point in the project history. -The gitlink:git-branch[1] command shows you the list of branches: +A single git repository may contain multiple branches. It keeps track +of them by keeping a list of <> which reference the +latest version on each branch; the gitlink:git-branch[1] command shows +you the list of branch heads: ------------------------------------------------ $ git branch * master ------------------------------------------------ -A freshly cloned repository contains a single branch, named "master", -and the working directory contains the version of the project -referred to by the master branch. +A freshly cloned repository contains a single branch head, named +"master", and working directory is initialized to the state of +the project referred to by "master". -Most projects also use tags. Tags, like branches, are references -into the project's history, and can be listed using the +Most projects also use <>. Tags, like heads, are +references into the project's history, and can be listed using the gitlink:git-tag[1] command: ------------------------------------------------ @@ -320,9 +321,9 @@ v2.6.13 ------------------------------------------------ Tags are expected to always point at the same version of a project, -while branches are expected to advance as development progresses. +while heads are expected to advance as development progresses. -Create a new branch pointing to one of these versions and check it +Create a new branch head pointing to one of these versions and check it out using gitlink:git-checkout[1]: ------------------------------------------------ @@ -346,10 +347,10 @@ the current branch to point at v2.6.17 instead, with $ git reset --hard v2.6.17 ------------------------------------------------ -Note that if the current branch was your only reference to a +Note that if the current branch head was your only reference to a particular point in history, then resetting that branch may leave you -with no way to find the history it used to point to; so use this -command carefully. +with no way to find the history it used to point to; so use this command +carefully. Understanding History: Commits ------------------------------ @@ -452,17 +453,15 @@ be replaced with another letter or number. Understanding history: What is a branch? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Though we've been using the word "branch" to mean a kind of reference -to a particular commit, the word branch is also commonly used to -refer to the line of commits leading up to that point. In the -example above, git may think of the branch named "A" as just a -pointer to one particular commit, but we may refer informally to the -line of three commits leading up to that point as all being part of +When we need to be precise, we will use the word "branch" to mean a line +of development, and "branch head" (or just "head") to mean a reference +to the most recent commit on a branch. In the example above, the branch +head named "A" is a pointer to one particular commit, but we refer to +the line of three commits leading up to that point as all being part of "branch A". -If we need to make it clear that we're just talking about the most -recent commit on the branch, we may refer to that commit as the -"head" of the branch. +However, when no confusion will result, we often just use the term +"branch" both for branches and for branch heads. Manipulating branches --------------------- @@ -1698,7 +1697,7 @@ If you and maintainer both have accounts on the same machine, then then you can just pull changes from each other's repositories directly; note that all of the commands (gitlink:git-clone[1], git-fetch[1], git-pull[1], etc.) that accept a URL as an argument -will also accept a local file patch; so, for example, you can +will also accept a local directory name; so, for example, you can use ------------------------------------------------- @@ -3013,9 +3012,6 @@ confusing and scary messages, but it won't actually do anything bad. In contrast, running "git prune" while somebody is actively changing the repository is a *BAD* idea). -Glossary of git terms -===================== - include::glossary.txt[] Notes and todo list for this manual -- 2.26.2