-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Git User's Manual</title><link rel="stylesheet" href="docbook-xsl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.69.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id232635"></a>Git User's Manual</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id264704">Preface</a></span></dt><dt><span class="chapter"><a href="#id233155">1. Git Quick Start</a></span></dt><dd><dl><dt><span class="section"><a href="#id233166">Creating a new repository</a></span></dt><dt><span class="section"><a href="#id233198">Managing branches</a></span></dt><dt><span class="section"><a href="#id232445">Exploring history</a></span></dt><dt><span class="section"><a href="#id232489">Making changes</a></span></dt><dt><span class="section"><a href="#id233361">Merging</a></span></dt><dt><span class="section"><a href="#id233378">Sharing your changes</a></span></dt><dt><span class="section"><a href="#id233463">Repository maintenance</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id232662">2. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#id232667">How to get a git repository</a></span></dt><dt><span class="section"><a href="#id232724">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#id273520">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#id273583">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#id273622">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#id273650">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#id273673">Manipulating branches</a></span></dt><dt><span class="section"><a href="#id273806">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-with-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#id274051">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id274125">3. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#id274147">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#id274266">Naming commits</a></span></dt><dt><span class="section"><a href="#id274414">Creating tags</a></span></dt><dt><span class="section"><a href="#id274449">Browsing revisions</a></span></dt><dt><span class="section"><a href="#id274523">Generating diffs</a></span></dt><dt><span class="section"><a href="#id274566">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#id274592">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#id274598">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#id274650">Find first tagged version including a given fix</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#id274814">4. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#id274820">Telling git your name</a></span></dt><dt><span class="section"><a href="#id274852">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#id275079">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#id275095">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#id275232">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#id275441">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#id275469">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#id275522">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-editing-history">Fixing a mistake by editing history</a></span></dt><dt><span class="section"><a href="#id275655">Checking out an old version of a file</a></span></dt></dl></dd><dt><span class="section"><a href="#id275713">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#id275751">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#id275756">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#id275831">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#id275981">5. Sharing development with others</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-updates-with-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#id276113">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#id276162">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#id276575">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#id276594">Allow web browsing of a repository</a></span></dt><dt><span class="section"><a href="#id276607">Examples</a></span></dt></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">6. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#id276638">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#id276713">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#id276844">Modifying a single commit</a></span></dt><dt><span class="section"><a href="#id276934">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#id276994">Other tools</a></span></dt><dt><span class="section"><a href="#id277007">Problems with rewriting history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id277078">7. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#id277084">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fast-forwards">Understanding git history: fast-forwards</a></span></dt><dt><span class="section"><a href="#id277204">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#id277231">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-internals">8. Git internals</a></span></dt><dd><dl><dt><span class="section"><a href="#id277369">The Object Database</a></span></dt><dt><span class="section"><a href="#id277485">Blob Object</a></span></dt><dt><span class="section"><a href="#id277528">Tree Object</a></span></dt><dt><span class="section"><a href="#id232240">Commit Object</a></span></dt><dt><span class="section"><a href="#id277720">Trust</a></span></dt><dt><span class="section"><a href="#id277771">Tag Object</a></span></dt><dt><span class="section"><a href="#id277817">The "index" aka "Current Directory Cache"</a></span></dt><dt><span class="section"><a href="#id277893">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#id277911">working directory -> index</a></span></dt><dt><span class="section"><a href="#id278001">index -> object database</a></span></dt><dt><span class="section"><a href="#id278029">object database -> index</a></span></dt><dt><span class="section"><a href="#id278060">index -> working directory</a></span></dt><dt><span class="section"><a href="#id278124">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#id278218">Examining the data</a></span></dt><dt><span class="section"><a href="#id278296">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#id278384">Merging multiple trees, continued</a></span></dt><dt><span class="section"><a href="#id278644">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id278904">9. GIT Glossary</a></span></dt><dt><span class="chapter"><a href="#id282186">10. Notes and todo list for this manual</a></span></dt></dl></div><div class="preface" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id264704"></a>Preface</h2></div></div></div><p>This manual is designed to be readable by someone with basic unix
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Git User's Manual</title><link rel="stylesheet" href="docbook-xsl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.69.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id232635"></a>Git User's Manual</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id264704">Preface</a></span></dt><dt><span class="chapter"><a href="#id233155">1. Git Quick Start</a></span></dt><dd><dl><dt><span class="section"><a href="#id233166">Creating a new repository</a></span></dt><dt><span class="section"><a href="#id233198">Managing branches</a></span></dt><dt><span class="section"><a href="#id232445">Exploring history</a></span></dt><dt><span class="section"><a href="#id232489">Making changes</a></span></dt><dt><span class="section"><a href="#id233361">Merging</a></span></dt><dt><span class="section"><a href="#id233378">Sharing your changes</a></span></dt><dt><span class="section"><a href="#id233463">Repository maintenance</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id232662">2. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#id232667">How to get a git repository</a></span></dt><dt><span class="section"><a href="#id232724">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#id273520">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#id273583">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#id273623">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#id273650">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#id273674">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#id273970">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-with-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#id274113">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id274187">3. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#id274208">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#id274328">Naming commits</a></span></dt><dt><span class="section"><a href="#id274476">Creating tags</a></span></dt><dt><span class="section"><a href="#id274511">Browsing revisions</a></span></dt><dt><span class="section"><a href="#id274585">Generating diffs</a></span></dt><dt><span class="section"><a href="#id274628">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#id274655">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#id274660">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#id274713">Find first tagged version including a given fix</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#id274876">4. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#id274882">Telling git your name</a></span></dt><dt><span class="section"><a href="#id274914">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#id275141">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#id275157">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#id275294">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#id275502">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#id275531">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#id275584">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-editing-history">Fixing a mistake by editing history</a></span></dt><dt><span class="section"><a href="#id275716">Checking out an old version of a file</a></span></dt></dl></dd><dt><span class="section"><a href="#id275775">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#id275812">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#id275818">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#id275893">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#id276043">5. Sharing development with others</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-updates-with-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#id276175">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#id276224">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#id276637">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#id276656">Allow web browsing of a repository</a></span></dt><dt><span class="section"><a href="#id276669">Examples</a></span></dt></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">6. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#id276700">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#id276775">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#id276905">Modifying a single commit</a></span></dt><dt><span class="section"><a href="#id277002">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#id277062">Other tools</a></span></dt><dt><span class="section"><a href="#id277075">Problems with rewriting history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id277146">7. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#id277152">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fast-forwards">Understanding git history: fast-forwards</a></span></dt><dt><span class="section"><a href="#id277273">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#id277300">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-internals">8. Git internals</a></span></dt><dd><dl><dt><span class="section"><a href="#id277438">The Object Database</a></span></dt><dt><span class="section"><a href="#id277591">Blob Object</a></span></dt><dt><span class="section"><a href="#id232225">Tree Object</a></span></dt><dt><span class="section"><a href="#id277780">Commit Object</a></span></dt><dt><span class="section"><a href="#id277827">Trust</a></span></dt><dt><span class="section"><a href="#id277877">Tag Object</a></span></dt><dt><span class="section"><a href="#id277924">The "index" aka "Current Directory Cache"</a></span></dt><dt><span class="section"><a href="#id277999">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#id278018">working directory -> index</a></span></dt><dt><span class="section"><a href="#id278108">index -> object database</a></span></dt><dt><span class="section"><a href="#id278136">object database -> index</a></span></dt><dt><span class="section"><a href="#id278167">index -> working directory</a></span></dt><dt><span class="section"><a href="#id278230">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#id278325">Examining the data</a></span></dt><dt><span class="section"><a href="#id278403">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#id278490">Merging multiple trees, continued</a></span></dt><dt><span class="section"><a href="#id278750">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id279010">9. GIT Glossary</a></span></dt><dt><span class="chapter"><a href="#id282289">10. Notes and todo list for this manual</a></span></dt></dl></div><div class="preface" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id264704"></a>Preface</h2></div></div></div><p>This manual is designed to be readable by someone with basic unix
command-line skills, but no previous knowledge of git.</p><p>Chapter 1 gives a brief overview of git commands, without any
explanation; you may prefer to skip to chapter 2 on a first reading.</p><p>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
current branch:</p><div class="literallayout"><p>$ git pull git://example.com/project.git theirbranch</p></div><p>Store the fetched branch into a local branch before merging into the
current branch:</p><div class="literallayout"><p>$ git pull git://example.com/project.git theirbranch:mybranch</p></div><p>After creating commits on a local branch, update the remote
branch with your commits:</p><div class="literallayout"><p>$ git push ssh://example.com/project.git mybranch:theirbranch</p></div><p>When remote and local branch are both named "test":</p><div class="literallayout"><p>$ git push ssh://example.com/project.git test</p></div><p>Shortcut version for a frequently used remote repository:</p><div class="literallayout"><p>$ git remote add example ssh://example.com/project.git<br>
-$ git push example test</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id233463"></a>Repository maintenance</h2></div></div></div><p>Check for corruption:</p><div class="literallayout"><p>$ git fsck</p></div><p>Recompress, remove unused cruft:</p><div class="literallayout"><p>$ git gc</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id232662"></a>Chapter 2. Repositories and Branches</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id232667">How to get a git repository</a></span></dt><dt><span class="section"><a href="#id232724">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#id273520">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#id273583">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#id273622">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#id273650">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#id273673">Manipulating branches</a></span></dt><dt><span class="section"><a href="#id273806">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-with-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#id274051">Fetching branches from other repositories</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id232667"></a>How to get a git repository</h2></div></div></div><p>It will be useful to have a git repository to experiment with as you
+$ git push example test</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id233463"></a>Repository maintenance</h2></div></div></div><p>Check for corruption:</p><div class="literallayout"><p>$ git fsck</p></div><p>Recompress, remove unused cruft:</p><div class="literallayout"><p>$ git gc</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id232662"></a>Chapter 2. Repositories and Branches</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id232667">How to get a git repository</a></span></dt><dt><span class="section"><a href="#id232724">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#id273520">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#id273583">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#id273623">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#id273650">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#id273674">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#id273970">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-with-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#id274113">Fetching branches from other repositories</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id232667"></a>How to get a git repository</h2></div></div></div><p>It will be useful to have a git repository to experiment with as you
read this manual.</p><p>The best way to get one is by using the <a href="git-clone.html" target="_top">git-clone(1)</a> 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
of them by keeping a list of <a href="#def_head">heads</a> which reference the
latest version on each branch; the <a href="git-branch.html" target="_top">git-branch(1)</a> command shows
you the list of branch heads:</p><div class="literallayout"><p>$ git branch<br>
-* master</p></div><p>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".</p><p>Most projects also use <a href="#def_tag">tags</a>. Tags, like heads, are
+* master</p></div><p>A freshly cloned repository contains a single branch head, by default
+named "master", with the working directory initialized to the state of
+the project referred to by that branch head.</p><p>Most projects also use <a href="#def_tag">tags</a>. Tags, like heads, are
references into the project's history, and can be listed using the
<a href="git-tag.html" target="_top">git-tag(1)</a> command:</p><div class="literallayout"><p>$ git tag -l<br>
v2.6.11<br>
commits will help understand how the git organizes history.</p><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id273622"></a>Understanding history: History diagrams</h3></div></div></div><p>We will sometimes represent git history using diagrams like the one
+leading from commit Y to commit X.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id273623"></a>Understanding history: History diagrams</h3></div></div></div><p>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:</p><pre class="literallayout"> o--o--o <-- Branch A
/
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".</p><p>However, when no confusion will result, we often just use the term
-"branch" both for branches and for branch heads.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id273673"></a>Manipulating branches</h2></div></div></div><p>Creating, deleting, and modifying branches is quick and easy; here's
+"branch" both for branches and for branch heads.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id273674"></a>Manipulating branches</h2></div></div></div><p>Creating, deleting, and modifying branches is quick and easy; here's
a summary of the commands:</p><div class="variablelist"><dl><dt><span class="term">
git branch
</span></dt><dd>
</span></dt><dd>
create a new branch <new> referencing <start-point>, and
check it out.
-</dd></dl></div><p>It is also useful to know that the special symbol "HEAD" can always
-be used to refer to the current branch.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id273806"></a>Examining branches from a remote repository</h2></div></div></div><p>The "master" branch that was created at the time you cloned is a copy
+</dd></dl></div><p>The special symbol "HEAD" can always be used to refer to the current
+branch. In fact, git uses a file named "HEAD" in the .git directory to
+remember which branch is current:</p><div class="literallayout"><p>$ cat .git/HEAD<br>
+ref: refs/heads/master</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="detached-head"></a>Examining an old version without creating a new branch</h2></div></div></div><p>The git-checkout command normally expects a branch head, but will also
+accept an arbitrary commit; for example, you can check out the commit
+referenced by a tag:</p><div class="literallayout"><p>$ git checkout v2.6.17<br>
+Note: moving to "v2.6.17" which isn't a local branch<br>
+If you want to create a new branch from this checkout, you may do so<br>
+(now or later) by using -b with the checkout command again. Example:<br>
+ git checkout -b <new_branch_name><br>
+HEAD is now at 427abfa... Linux v2.6.17</p></div><p>The HEAD then refers to the SHA1 of the commit instead of to a branch,
+and git branch shows that you are no longer on a branch:</p><div class="literallayout"><p>$ cat .git/HEAD<br>
+427abfa28afedffadfca9dd8b067eb6d36bac53f<br>
+git branch<br>
+* (no branch)<br>
+ master</p></div><p>In this case we say that the HEAD is "detached".</p><p>This can be an easy way to check out a particular version without having
+to make up a name for a new branch. However, keep in mind that when you
+switch away from the (for example, by checking out something else), you
+can lose track of what the HEAD used to point to.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id273970"></a>Examining branches from a remote repository</h2></div></div></div><p>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
at the new commits.</p><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274051"></a>Fetching branches from other repositories</h2></div></div></div><p>You can also track branches from repositories other than the one you
+"master" branch that was created for you on clone.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274113"></a>Fetching branches from other repositories</h2></div></div></div><p>You can also track branches from repositories other than the one you
cloned from, using <a href="git-remote.html" target="_top">git-remote(1)</a>:</p><div class="literallayout"><p>$ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git<br>
$ git fetch linux-nfs<br>
* refs/remotes/linux-nfs/master: storing branch 'master' ...<br>
...</p></div><p>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
-<a href="git-config.html" target="_top">git-config(1)</a> for details.)</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id274125"></a>Chapter 3. Exploring git history</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id274147">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#id274266">Naming commits</a></span></dt><dt><span class="section"><a href="#id274414">Creating tags</a></span></dt><dt><span class="section"><a href="#id274449">Browsing revisions</a></span></dt><dt><span class="section"><a href="#id274523">Generating diffs</a></span></dt><dt><span class="section"><a href="#id274566">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#id274592">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#id274598">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#id274650">Find first tagged version including a given fix</a></span></dt></dl></dd></dl></div><p>Git is best thought of as a tool for storing the history of a
+<a href="git-config.html" target="_top">git-config(1)</a> for details.)</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id274187"></a>Chapter 3. Exploring git history</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id274208">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#id274328">Naming commits</a></span></dt><dt><span class="section"><a href="#id274476">Creating tags</a></span></dt><dt><span class="section"><a href="#id274511">Browsing revisions</a></span></dt><dt><span class="section"><a href="#id274585">Generating diffs</a></span></dt><dt><span class="section"><a href="#id274628">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#id274655">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#id274660">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#id274713">Find first tagged version including a given fix</a></span></dt></dl></dd></dl></div><p>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.</p><p>Git provides extremely flexible and fast tools for exploring the
history of a project.</p><p>We start with one specialized tool that is useful for finding the
-commit that introduced a bug into a project.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274147"></a>How to use bisect to find a regression</h2></div></div></div><p>Suppose version 2.6.18 of your project worked, but the version at
+commit that introduced a bug into a project.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274208"></a>How to use bisect to find a regression</h2></div></div></div><p>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
run</p><div class="literallayout"><p>$ git bisect visualize</p></div><p>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:</p><div class="literallayout"><p>$ git reset --hard fb47ddb2db...</p></div><p>then test, run "bisect good" or "bisect bad" as appropriate, and
-continue.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274266"></a>Naming commits</h2></div></div></div><p>We have seen several ways of naming commits already:</p><div class="itemizedlist"><ul type="disc"><li>
+continue.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274328"></a>Naming commits</h2></div></div></div><p>We have seen several ways of naming commits already:</p><div class="itemizedlist"><ul type="disc"><li>
40-hexdigit object name
</li><li>
branch name: refers to the commit at the head of the given
branch.</p><p>The <a href="git-rev-parse.html" target="_top">git-rev-parse(1)</a> command is a low-level command that is
occasionally useful for translating some name for a commit to the object
name for that commit:</p><div class="literallayout"><p>$ git rev-parse origin<br>
-e05db0fd4f31dde7005f075a84f96b360d05984b</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274414"></a>Creating tags</h2></div></div></div><p>We can also create a tag to refer to a particular commit; after
+e05db0fd4f31dde7005f075a84f96b360d05984b</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274476"></a>Creating tags</h2></div></div></div><p>We can also create a tag to refer to a particular commit; after
running</p><div class="literallayout"><p>$ git tag stable-1 1b2e1d63ff</p></div><p>You can use stable-1 to refer to the commit 1b2e1d63ff.</p><p>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 <a href="git-tag.html" target="_top">git-tag(1)</a> man
-page for details.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274449"></a>Browsing revisions</h2></div></div></div><p>The <a href="git-log.html" target="_top">git-log(1)</a> command can show lists of commits. On its
+page for details.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274511"></a>Browsing revisions</h2></div></div></div><p>The <a href="git-log.html" target="_top">git-log(1)</a> 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:</p><div class="literallayout"><p>$ git log v2.5.. # commits since (not reachable from) v2.5<br>
$ git log test..master # commits reachable from master but not test<br>
display options.</p><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274523"></a>Generating diffs</h2></div></div></div><p>You can generate diffs between any two versions using
+commits are listed in may be somewhat arbitrary.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274585"></a>Generating diffs</h2></div></div></div><p>You can generate diffs between any two versions using
<a href="git-diff.html" target="_top">git-diff(1)</a>:</p><div class="literallayout"><p>$ git diff master..test</p></div><p>Sometimes what you want instead is a set of patches:</p><div class="literallayout"><p>$ git format-patch master..test</p></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274566"></a>Viewing old file versions</h2></div></div></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274628"></a>Viewing old file versions</h2></div></div></div><p>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:</p><div class="literallayout"><p>$ git show v2.5:fs/locks.c</p></div><p>Before the colon may be anything that names a commit, and after it
-may be any path to a file tracked by git.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274592"></a>Examples</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id274598"></a>Check whether two branches point at the same history</h3></div></div></div><p>Suppose you want to check whether two branches point at the same point
+may be any path to a file tracked by git.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274655"></a>Examples</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id274660"></a>Check whether two branches point at the same history</h3></div></div></div><p>Suppose you want to check whether two branches point at the same point
in history.</p><div class="literallayout"><p>$ git diff origin..master</p></div><p>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
$ git rev-list master<br>
e05db0fd4f31dde7005f075a84f96b360d05984b</p></div><p>Or you could recall that the … operator selects all commits
contained reachable from either one reference or the other but not
-both: so</p><div class="literallayout"><p>$ git log origin...master</p></div><p>will return no commits when the two branches are equal.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id274650"></a>Find first tagged version including a given fix</h3></div></div></div><p>Suppose you know that the commit e05db0fd fixed a certain problem.
+both: so</p><div class="literallayout"><p>$ git log origin...master</p></div><p>will return no commits when the two branches are equal.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id274713"></a>Find first tagged version including a given fix</h3></div></div></div><p>Suppose you know that the commit e05db0fd fixed a certain problem.
You'd like to find the earliest tagged release that contains that
fix.</p><p>Of course, there may be more than one answer—if the history branched
after commit e05db0fd, then there could be multiple "earliest" tagged
! [v1.5.0-rc2] GIT v1.5.0-rc2<br>
...</p></div><p>then search for a line that looks like</p><div class="literallayout"><p>+ ++ [e05db0fd] Fix warnings in sha1_file.c - use C99 printf format if<br>
available</p></div><p>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.</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id274814"></a>Chapter 4. Developing with git</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id274820">Telling git your name</a></span></dt><dt><span class="section"><a href="#id274852">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#id275079">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#id275095">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#id275232">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#id275441">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#id275469">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#id275522">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-editing-history">Fixing a mistake by editing history</a></span></dt><dt><span class="section"><a href="#id275655">Checking out an old version of a file</a></span></dt></dl></dd><dt><span class="section"><a href="#id275713">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#id275751">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#id275756">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#id275831">Recovering lost changes</a></span></dt></dl></dd></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274820"></a>Telling git your name</h2></div></div></div><p>Before creating any commits, you should introduce yourself to git. The
+from v1.5.0-rc2, but not from v1.5.0-rc0.</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id274876"></a>Chapter 4. Developing with git</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id274882">Telling git your name</a></span></dt><dt><span class="section"><a href="#id274914">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#id275141">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#id275157">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#id275294">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#id275502">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#id275531">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#id275584">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-editing-history">Fixing a mistake by editing history</a></span></dt><dt><span class="section"><a href="#id275716">Checking out an old version of a file</a></span></dt></dl></dd><dt><span class="section"><a href="#id275775">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#id275812">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#id275818">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#id275893">Recovering lost changes</a></span></dt></dl></dd></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274882"></a>Telling git your name</h2></div></div></div><p>Before creating any commits, you should introduce yourself to git. The
easiest way to do so is:</p><div class="literallayout"><p>$ cat >~/.gitconfig <<\EOF<br>
[user]<br>
name = Your Name Comes Here<br>
email = you@yourdomain.example.com<br>
EOF</p></div><p>(See the "CONFIGURATION FILE" section of <a href="git-config.html" target="_top">git-config(1)</a> for
-details on the configuration file.)</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274852"></a>Creating a new repository</h2></div></div></div><p>Creating a new repository from scratch is very easy:</p><div class="literallayout"><p>$ mkdir project<br>
+details on the configuration file.)</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id274914"></a>Creating a new repository</h2></div></div></div><p>Creating a new repository from scratch is very easy:</p><div class="literallayout"><p>$ mkdir project<br>
$ cd project<br>
$ git init</p></div><p>If you have some initial content (say, a tarball):</p><div class="literallayout"><p>$ tar -xzvf project.tar.gz<br>
$ cd project<br>
$ git diff # difference between the index file and your<br>
# working directory; changes that would not<br>
# be included if you ran "commit" now.<br>
-$ git status # a brief per-file summary of the above.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275079"></a>Creating good commit messages</h2></div></div></div><p>Though not required, it's a good idea to begin the commit message
+$ git status # a brief per-file summary of the above.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275141"></a>Creating good commit messages</h2></div></div></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275095"></a>How to merge</h2></div></div></div><p>You can rejoin two diverging branches of development using
+body.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275157"></a>How to merge</h2></div></div></div><p>You can rejoin two diverging branches of development using
<a href="git-merge.html" target="_top">git-merge(1)</a>:</p><div class="literallayout"><p>$ git merge branchname</p></div><p>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
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.</p><p>The above is all you need to know to resolve a simple merge. But git
-also provides more information to help resolve conflicts:</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275232"></a>Getting conflict-resolution help during a merge</h3></div></div></div><p>All of the changes that git was able to merge automatically are
+also provides more information to help resolve conflicts:</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275294"></a>Getting conflict-resolution help during a merge</h3></div></div></div><p>All of the changes that git was able to merge automatically are
already added to the index file, so <a href="git-diff.html" target="_top">git-diff(1)</a> shows only
the conflicts. It uses an unusual syntax:</p><div class="literallayout"><p>$ git diff<br>
diff --cc file.txt<br>
away, you can always return to the pre-merge state with</p><div class="literallayout"><p>$ git reset --hard HEAD</p></div><p>Or, if you've already commited the merge that you want to throw away,</p><div class="literallayout"><p>$ git reset --hard ORIG_HEAD</p></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275441"></a>Fast-forward merges</h2></div></div></div><p>There is one special case not mentioned above, which is treated
+further merges.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275502"></a>Fast-forward merges</h2></div></div></div><p>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.</p><p>However, if one of the two lines of development is completely
already contained in the other—then git just performs a
<a href="#fast-forwards" title="Understanding git history: fast-forwards">fast forward</a>; 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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275469"></a>Fixing mistakes</h2></div></div></div><p>If you've messed up the working tree, but haven't yet committed your
+any new commits being created.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275531"></a>Fixing mistakes</h2></div></div></div><p>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</p><div class="literallayout"><p>$ git reset --hard HEAD</p></div><p>If you make a commit that you later wish you hadn't, there are two
fundamentally different ways to fix the problem:</p><div class="orderedlist"><ol type="1"><li>
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.
-</li></ol></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275522"></a>Fixing a mistake with a new commit</h3></div></div></div><p>Creating a new commit that reverts an earlier change is very easy;
+</li></ol></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275584"></a>Fixing a mistake with a new commit</h3></div></div></div><p>Creating a new commit that reverts an earlier change is very easy;
just pass the <a href="git-revert.html" target="_top">git-revert(1)</a> command a reference to the bad
commit; for example, to revert the most recent commit:</p><div class="literallayout"><p>$ git revert HEAD</p></div><p>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.</p><p>You can also revert an earlier change, for example, the next-to-last:</p><div class="literallayout"><p>$ git revert HEAD^</p></div><p>In this case git will attempt to undo the old change while leaving
been merged into another branch; use <a href="git-revert.html" target="_top">git-revert(1)</a> instead in
that case.</p><p>It is also possible to edit commits further back in the history, but
this is an advanced topic to be left for
-<a href="#cleaning-up-history" title="Chapter 6. Rewriting history and maintaining patch series">another chapter</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275655"></a>Checking out an old version of a file</h3></div></div></div><p>In the process of undoing a previous bad change, you may find it
+<a href="#cleaning-up-history" title="Chapter 6. Rewriting history and maintaining patch series">another chapter</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275716"></a>Checking out an old version of a file</h3></div></div></div><p>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
<a href="git-checkout.html" target="_top">git-checkout(1)</a>. We've used git checkout before to switch
branches, but it has quite different behavior if it is given a path
name: the command</p><div class="literallayout"><p>$ git checkout HEAD^ path/to/file</p></div><p>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.</p><p>If you just want to look at an old version of the file, without
modifying the working directory, you can do that with
-<a href="git-show.html" target="_top">git-show(1)</a>:</p><div class="literallayout"><p>$ git show HEAD^:path/to/file</p></div><p>which will display the given version of the file.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275713"></a>Ensuring good performance</h2></div></div></div><p>On large repositories, git depends on compression to keep the history
+<a href="git-show.html" target="_top">git-show(1)</a>:</p><div class="literallayout"><p>$ git show HEAD^:path/to/file</p></div><p>which will display the given version of the file.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275775"></a>Ensuring good performance</h2></div></div></div><p>On large repositories, git depends on compression to keep the history
information from taking up to much space on disk or in memory.</p><p>This compression is not performed automatically. Therefore you
should occasionally run <a href="git-gc.html" target="_top">git-gc(1)</a>:</p><div class="literallayout"><p>$ git gc</p></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275751"></a>Ensuring reliability</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275756"></a>Checking the repository for corruption</h3></div></div></div><p>The <a href="git-fsck.html" target="_top">git-fsck(1)</a> command runs a number of self-consistency checks
+you may prefer to run git-gc when you are not doing other work.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id275812"></a>Ensuring reliability</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275818"></a>Checking the repository for corruption</h3></div></div></div><p>The <a href="git-fsck.html" target="_top">git-fsck(1)</a> 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:</p><div class="literallayout"><p>$ git fsck<br>
dangling commit 7281251ddd2a61e38657c827739c57015671a6b3<br>
you can remove them at any time with <a href="git-prune.html" target="_top">git-prune(1)</a> or the —prune
option to <a href="git-gc.html" target="_top">git-gc(1)</a>:</p><div class="literallayout"><p>$ git gc --prune</p></div><p>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.</p><p>For more about dangling objects, see <a href="#dangling-objects" title="Dangling objects">the section called “Dangling objects”</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275831"></a>Recovering lost changes</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id275837"></a>Reflogs</h4></div></div></div><p>Say you modify a branch with <a href="git-reset.html" target="_top">git-reset(1)</a> —hard, and then
+other git operations are in progress in the same repository.</p><p>For more about dangling objects, see <a href="#dangling-objects" title="Dangling objects">the section called “Dangling objects”</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id275893"></a>Recovering lost changes</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id275899"></a>Reflogs</h4></div></div></div><p>Say you modify a branch with <a href="git-reset.html" target="_top">git-reset(1)</a> —hard, and then
realize that the branch was the only reference you had to that point in
history.</p><p>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
section of <a href="git-rev-parse.html" target="_top">git-rev-parse(1)</a> for details.</p><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id275915"></a>Examining dangling objects</h4></div></div></div><p>In some situations the reflog may not be able to save you. For
+how the branches in your local repository have changed over time.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id275977"></a>Examining dangling objects</h4></div></div></div><p>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
(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.)</p><p>If you decide you want the history back, you can always create a new
-reference pointing to it, for example, a new branch:</p><div class="literallayout"><p>$ git branch recovered-branch 7281251ddd</p></div></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id275981"></a>Chapter 5. Sharing development with others</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#getting-updates-with-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#id276113">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#id276162">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#id276575">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#id276594">Allow web browsing of a repository</a></span></dt><dt><span class="section"><a href="#id276607">Examples</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-updates-with-git-pull"></a>Getting updates with git pull</h2></div></div></div><p>After you clone a repository and make a few changes of your own, you
+reference pointing to it, for example, a new branch:</p><div class="literallayout"><p>$ git branch recovered-branch 7281251ddd</p></div></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id276043"></a>Chapter 5. Sharing development with others</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#getting-updates-with-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#id276175">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#id276224">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#id276637">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#id276656">Allow web browsing of a repository</a></span></dt><dt><span class="section"><a href="#id276669">Examples</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-updates-with-git-pull"></a>Getting updates with git pull</h2></div></div></div><p>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.</p><p>We have already seen <a href="#Updating-a-repository-with-git-fetch" title="Updating a repository with git fetch">how to keep remote tracking branches up to date</a> with <a href="git-fetch.html" target="_top">git-fetch(1)</a>,
and how to merge two branches. So you can merge in changes from the
updated to point to the latest commit from the upstream branch.)</p><p>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</p><div class="literallayout"><p>$ git pull . branch<br>
-$ git merge branch</p></div><p>are roughly equivalent. The former is actually very commonly used.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276113"></a>Submitting patches to a project</h2></div></div></div><p>If you just have a few changes, the simplest way to submit them may
+$ git merge branch</p></div><p>are roughly equivalent. The former is actually very commonly used.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276175"></a>Submitting patches to a project</h2></div></div></div><p>If you just have a few changes, the simplest way to submit them may
just be to send them as patches in email:</p><p>First, use <a href="git-format-patch.html" target="_top">git-format-patch(1)</a>; for example:</p><div class="literallayout"><p>$ git format-patch origin</p></div><p>will produce a numbered series of files in the current directory, one
for each patch in the current branch but not in origin/HEAD.</p><p>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 <a href="git-send-email.html" target="_top">git-send-email(1)</a> script to automate the process.
Consult the mailing list for your project first to determine how they
-prefer such patches be handled.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276162"></a>Importing patches to a project</h2></div></div></div><p>Git also provides a tool called <a href="git-am.html" target="_top">git-am(1)</a> (am stands for
+prefer such patches be handled.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276224"></a>Importing patches to a project</h2></div></div></div><p>Git also provides a tool called <a href="git-am.html" target="_top">git-am(1)</a> (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</p><div class="literallayout"><p>$ git am -3 patches.mbox</p></div><p>Git will apply each patch in order; if any conflicts are found, it
url = ssh://yourserver.com/~you/proj.git<br>
EOF</p></div><p>you should be able to perform the above push with just</p><div class="literallayout"><p>$ git push public-repo master</p></div><p>See the explanations of the remote.<name>.url, branch.<name>.remote,
and remote.<name>.push options in <a href="git-config.html" target="_top">git-config(1)</a> for
-details.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276575"></a>Setting up a shared repository</h2></div></div></div><p>Another way to collaborate is by using a model similar to that
+details.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276637"></a>Setting up a shared repository</h2></div></div></div><p>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
<a href="cvs-migration.txt" target="_top">git for CVS users</a> for instructions on how to
-set this up.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276594"></a>Allow web browsing of a repository</h2></div></div></div><p>The gitweb cgi script provides users an easy way to browse your
+set this up.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276656"></a>Allow web browsing of a repository</h2></div></div></div><p>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/INSTALL in the git source tree for instructions on setting it up.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276607"></a>Examples</h2></div></div></div><p>TODO: topic branches, typical roles as in everyday.txt, ?</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="cleaning-up-history"></a>Chapter 6. Rewriting history and maintaining patch series</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id276638">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#id276713">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#id276844">Modifying a single commit</a></span></dt><dt><span class="section"><a href="#id276934">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#id276994">Other tools</a></span></dt><dt><span class="section"><a href="#id277007">Problems with rewriting history</a></span></dt></dl></div><p>Normally commits are only added to a project, never taken away or
+gitweb/INSTALL in the git source tree for instructions on setting it up.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276669"></a>Examples</h2></div></div></div><p>TODO: topic branches, typical roles as in everyday.txt, ?</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="cleaning-up-history"></a>Chapter 6. Rewriting history and maintaining patch series</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id276700">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#id276775">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#id276905">Modifying a single commit</a></span></dt><dt><span class="section"><a href="#id277002">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#id277062">Other tools</a></span></dt><dt><span class="section"><a href="#id277075">Problems with rewriting history</a></span></dt></dl></div><p>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.</p><p>However, there is a situation in which it can be useful to violate this
-assumption.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276638"></a>Creating the perfect patch series</h2></div></div></div><p>Suppose you are a contributor to a large project, and you want to add a
+assumption.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276700"></a>Creating the perfect patch series</h2></div></div></div><p>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.</p><p>If you present all of your changes as a single patch (or commit), they
(probably much messier!) development process did.
</li></ol></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276713"></a>Keeping a patch series up to date using git-rebase</h2></div></div></div><p>Suppose that you create a branch "mywork" on a remote-tracking branch
+you are rewriting history.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276775"></a>Keeping a patch series up to date using git-rebase</h2></div></div></div><p>Suppose that you create a branch "mywork" on a remote-tracking branch
"origin", and create some commits on top of it:</p><div class="literallayout"><p>$ git checkout -b mywork origin<br>
$ vi file.txt<br>
$ git commit<br>
and allow you to fix the conflicts; after fixing conflicts, use "git
add" to update the index with those contents, and then, instead of
running git-commit, just run</p><div class="literallayout"><p>$ git rebase --continue</p></div><p>and git will continue applying the rest of the patches.</p><p>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:</p><div class="literallayout"><p>$ git rebase --abort</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276844"></a>Modifying a single commit</h2></div></div></div><p>We saw in <a href="#fixing-a-mistake-by-editing-history" title="Fixing a mistake by editing history">the section called “Fixing a mistake by editing history”</a> that you can replace the
+return mywork to the state it had before you started the rebase:</p><div class="literallayout"><p>$ git rebase --abort</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276905"></a>Modifying a single commit</h2></div></div></div><p>We saw in <a href="#fixing-a-mistake-by-editing-history" title="Fixing a mistake by editing history">the section called “Fixing a mistake by editing history”</a> that you can replace the
most recent commit using</p><div class="literallayout"><p>$ git commit --amend</p></div><p>which will replace the old commit by a new commit incorporating your
changes, giving you a chance to edit the old commit message first.</p><p>You can also use a combination of this and <a href="git-rebase.html" target="_top">git-rebase(1)</a> to edit
-commits further back in your history. First, tag the problematic commit with</p><div class="literallayout"><p>$ git tag bad mywork~5</p></div><p>(Either gitk or git-log may be useful for finding the commit.)</p><p>Then check out a new branch at that commit, edit it, and rebase the rest of
-the series on top of it:</p><div class="literallayout"><p>$ git checkout -b TMP bad<br>
+commits further back in your history. First, tag the problematic commit with</p><div class="literallayout"><p>$ git tag bad mywork~5</p></div><p>(Either gitk or git-log may be useful for finding the commit.)</p><p>Then check out that commit, edit it, and rebase the rest of the series
+on top of it (note that we could check out the commit on a temporary
+branch, but instead we're using a <a href="#detached-head" title="Examining an old version without creating a new branch">detached head</a>):</p><div class="literallayout"><p>$ git checkout bad<br>
$ # make changes here and update the index<br>
$ git commit --amend<br>
-$ git rebase --onto TMP bad mywork</p></div><p>When you're done, you'll be left with mywork checked out, with the top patches
-on mywork reapplied on top of the modified commit you created in TMP. You can
-then clean up with</p><div class="literallayout"><p>$ git branch -d TMP<br>
-$ git tag -d bad</p></div><p>Note that the immutable nature of git history means that you haven't really
+$ git rebase --onto HEAD bad mywork</p></div><p>When you're done, you'll be left with mywork checked out, with the top
+patches on mywork reapplied on top of your modified commit. You can
+then clean up with</p><div class="literallayout"><p>$ git tag -d bad</p></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276934"></a>Reordering or selecting from a patch series</h2></div></div></div><p>Given one existing commit, the <a href="git-cherry-pick.html" target="_top">git-cherry-pick(1)</a> command
+new commits having new object names.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277002"></a>Reordering or selecting from a patch series</h2></div></div></div><p>Given one existing commit, the <a href="git-cherry-pick.html" target="_top">git-cherry-pick(1)</a> 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:</p><div class="literallayout"><p>$ git checkout -b mywork-new origin<br>
—amend.</p><p>Another technique is to use git-format-patch to create a series of
patches, then reset the state to before the patches:</p><div class="literallayout"><p>$ git format-patch origin<br>
$ git reset --hard origin</p></div><p>Then modify, reorder, or eliminate patches as preferred before applying
-them again with <a href="git-am.html" target="_top">git-am(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id276994"></a>Other tools</h2></div></div></div><p>There are numerous other tools, such as stgit, which exist for the
+them again with <a href="git-am.html" target="_top">git-am(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277062"></a>Other tools</h2></div></div></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277007"></a>Problems with rewriting history</h2></div></div></div><p>The primary problem with rewriting the history of a branch has to do
+this manual.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277075"></a>Problems with rewriting history</h2></div></div></div><p>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:</p><pre class="literallayout"> o--o--O--o--o--o <-- origin
\ \
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.</p><p>For true distributed development that supports proper merging,
-published branches should never be rewritten.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id277078"></a>Chapter 7. Advanced branch management</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id277084">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fast-forwards">Understanding git history: fast-forwards</a></span></dt><dt><span class="section"><a href="#id277204">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#id277231">Configuring remote branches</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277084"></a>Fetching individual branches</h2></div></div></div><p>Instead of using <a href="git-remote.html" target="_top">git-remote(1)</a>, you can also choose just
+published branches should never be rewritten.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id277146"></a>Chapter 7. Advanced branch management</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id277152">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fast-forwards">Understanding git history: fast-forwards</a></span></dt><dt><span class="section"><a href="#id277273">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#id277300">Configuring remote branches</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277152"></a>Fetching individual branches</h2></div></div></div><p>Instead of using <a href="git-remote.html" target="_top">git-remote(1)</a>, you can also choose just
to update one branch at a time, and to store it locally under an
arbitrary name:</p><div class="literallayout"><p>$ git fetch origin todo:my-todo-work</p></div><p>The first argument, "origin", just tells git to fetch from the
repository you originally cloned from. The second argument tells git
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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277204"></a>Forcing git fetch to do non-fast-forward updates</h2></div></div></div><p>If git fetch fails because the new head of a branch is not a
+them.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277273"></a>Forcing git fetch to do non-fast-forward updates</h2></div></div></div><p>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:</p><div class="literallayout"><p>$ git fetch git://example.com/proj.git +master:refs/remotes/example/master</p></div><p>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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277231"></a>Configuring remote branches</h2></div></div></div><p>We saw above that "origin" is just a shortcut to refer to the
+the previous section.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277300"></a>Configuring remote branches</h2></div></div></div><p>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
<a href="git-config.html" target="_top">git-config(1)</a>:</p><div class="literallayout"><p>$ git config -l<br>
throwing away commits on mybranch.</p><p>Also note that all of the above configuration can be performed by
directly editing the file .git/config instead of using
<a href="git-config.html" target="_top">git-config(1)</a>.</p><p>See <a href="git-config.html" target="_top">git-config(1)</a> for more details on the configuration
-options mentioned above.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="git-internals"></a>Chapter 8. Git internals</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id277369">The Object Database</a></span></dt><dt><span class="section"><a href="#id277485">Blob Object</a></span></dt><dt><span class="section"><a href="#id277528">Tree Object</a></span></dt><dt><span class="section"><a href="#id232240">Commit Object</a></span></dt><dt><span class="section"><a href="#id277720">Trust</a></span></dt><dt><span class="section"><a href="#id277771">Tag Object</a></span></dt><dt><span class="section"><a href="#id277817">The "index" aka "Current Directory Cache"</a></span></dt><dt><span class="section"><a href="#id277893">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#id277911">working directory -> index</a></span></dt><dt><span class="section"><a href="#id278001">index -> object database</a></span></dt><dt><span class="section"><a href="#id278029">object database -> index</a></span></dt><dt><span class="section"><a href="#id278060">index -> working directory</a></span></dt><dt><span class="section"><a href="#id278124">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#id278218">Examining the data</a></span></dt><dt><span class="section"><a href="#id278296">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#id278384">Merging multiple trees, continued</a></span></dt><dt><span class="section"><a href="#id278644">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt></dl></div><p>There are two object abstractions: the "object database", and the
-"current directory cache" aka "index".</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277369"></a>The Object Database</h2></div></div></div><p>The object database is literally just a content-addressable collection
+options mentioned above.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="git-internals"></a>Chapter 8. Git internals</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id277438">The Object Database</a></span></dt><dt><span class="section"><a href="#id277591">Blob Object</a></span></dt><dt><span class="section"><a href="#id232225">Tree Object</a></span></dt><dt><span class="section"><a href="#id277780">Commit Object</a></span></dt><dt><span class="section"><a href="#id277827">Trust</a></span></dt><dt><span class="section"><a href="#id277877">Tag Object</a></span></dt><dt><span class="section"><a href="#id277924">The "index" aka "Current Directory Cache"</a></span></dt><dt><span class="section"><a href="#id277999">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#id278018">working directory -> index</a></span></dt><dt><span class="section"><a href="#id278108">index -> object database</a></span></dt><dt><span class="section"><a href="#id278136">object database -> index</a></span></dt><dt><span class="section"><a href="#id278167">index -> working directory</a></span></dt><dt><span class="section"><a href="#id278230">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#id278325">Examining the data</a></span></dt><dt><span class="section"><a href="#id278403">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#id278490">Merging multiple trees, continued</a></span></dt><dt><span class="section"><a href="#id278750">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt></dl></div><p>Git depends on two fundamental abstractions: the "object database", and
+the "current directory cache" aka "index".</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277438"></a>The Object Database</h2></div></div></div><p>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
determined at object creation time, and which identifies the format of
the object (i.e. how it is used, and how it can refer to other
objects). There are currently four different object types: "blob",
-"tree", "commit" and "tag".</p><p>A "blob" object cannot refer to any other object, and is, like the type
-implies, a pure storage object containing some user data. It is used to
-actually store the file data, i.e. a blob object is associated with some
-particular version of some file.</p><p>A "tree" object is an object that ties one or more "blob" objects into a
-directory structure. In addition, a tree object can refer to other tree
-objects, thus creating a directory hierarchy.</p><p>A "commit" object ties such directory hierarchies together into
-a DAG of revisions - each "commit" is associated with exactly one tree
-(the directory hierarchy at the time of the commit). In addition, a
-"commit" refers to one or more "parent" commit objects that describe the
-history of how we arrived at that directory hierarchy.</p><p>As a special case, a commit object with no parents is called the "root"
+"tree", "commit", and "tag".</p><p>A <a href="#def_blob_object">"blob" object</a> cannot refer to any other object,
+and is, as the name implies, a pure storage object containing some
+user data. It is used to actually store the file data, i.e. a blob
+object is associated with some particular version of some file.</p><p>A <a href="#def_tree_object">"tree" object</a> is an object that ties one or more
+"blob" objects into a directory structure. In addition, a tree object
+can refer to other tree objects, thus creating a directory hierarchy.</p><p>A <a href="#def_commit_object">"commit" object</a> ties such directory hierarchies
+together into a <a href="#def_DAG">directed acyclic graph</a> of revisions - each
+"commit" is associated with exactly one tree (the directory hierarchy at
+the time of the commit). In addition, a "commit" refers to one or more
+"parent" commit objects that describe the history of how we arrived at
+that directory hierarchy.</p><p>As a special case, a commit object with no parents is called the "root"
object, and is the point of an initial project commit. Each project
must have at least one root, and while you can tie several different
root objects together into one project by creating a commit object which
has two or more separate roots as its ultimate parents, that's probably
just going to confuse people. So aim for the notion of "one root object
-per project", even if git itself does not enforce that.</p><p>A "tag" object symbolically identifies and can be used to sign other
-objects. It contains the identifier and type of another object, a
-symbolic name (of course!) and, optionally, a signature.</p><p>Regardless of object type, all objects share the following
+per project", even if git itself does not enforce that.</p><p>A <a href="#def_tag_object">"tag" object</a> symbolically identifies and can be
+used to sign other objects. It contains the identifier and type of
+another object, a symbolic name (of course!) and, optionally, a
+signature.</p><p>Regardless of object type, all objects share the following
characteristics: they are all deflated with zlib, and have a header
that not only specifies their type, but also provides size information
about the data in the object. It's worth noting that the SHA1 hash
connectivity to other objects verified. This is generally done with
the <code class="literal">git-fsck</code> 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).</p><p>The object types in some more detail:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277485"></a>Blob Object</h2></div></div></div><p>A "blob" object is nothing but a binary blob of data, and doesn't
+to just verifying their superficial consistency through the hash).</p><p>The object types in some more detail:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277591"></a>Blob Object</h2></div></div></div><p>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 <span class="emphasis"><em>is</em></span>
indexed by its sha1 hash, so the data itself is certainly correct), it
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.</p><p>A blob is typically created when <a href="git-update-index.html" target="_top">git-update-index(1)</a>
-is run, and its data can be accessed by <a href="git-cat-file.html" target="_top">git-cat-file(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277528"></a>Tree Object</h2></div></div></div><p>The next hierarchical object type is the "tree" object. A tree object
+is run, and its data can be accessed by <a href="git-cat-file.html" target="_top">git-cat-file(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id232225"></a>Tree Object</h2></div></div></div><p>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.</p><p>Like the "blob" object, a tree object is uniquely determined by the
noticing that the blob stayed the same. However, renames with data
changes need a smarter "diff" implementation.</p><p>A tree is created with <a href="git-write-tree.html" target="_top">git-write-tree(1)</a> and
its data can be accessed by <a href="git-ls-tree.html" target="_top">git-ls-tree(1)</a>.
-Two trees can be compared with <a href="git-diff-tree.html" target="_top">git-diff-tree(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id232240"></a>Commit Object</h2></div></div></div><p>The "commit" object is an object that introduces the notion of
+Two trees can be compared with <a href="git-diff-tree.html" target="_top">git-diff-tree(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277780"></a>Commit Object</h2></div></div></div><p>The "commit" object is an object that introduces the notion of
history into the picture. In contrast to the other objects, it
doesn't just describe the physical state of a tree, it describes how
we got there, and why.</p><p>A "commit" is defined by the tree-object that it results in, the
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.</p><p>A commit is created with <a href="git-commit-tree.html" target="_top">git-commit-tree(1)</a> and
-its data can be accessed by <a href="git-cat-file.html" target="_top">git-cat-file(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277720"></a>Trust</h2></div></div></div><p>An aside on the notion of "trust". Trust is really outside the scope
+its data can be accessed by <a href="git-cat-file.html" target="_top">git-cat-file(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277827"></a>Trust</h2></div></div></div><p>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 <span class="emphasis"><em>can</em></span> trust that an object is
intact and has not been messed with by external sources. So the name
commits tells others that they can trust the whole history.</p><p>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.</p><p>To assist in this, git also provides the tag object…</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277771"></a>Tag Object</h2></div></div></div><p>Git provides the "tag" object to simplify creating, managing and
+like GPG/PGP.</p><p>To assist in this, git also provides the tag object…</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277877"></a>Tag Object</h2></div></div></div><p>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.</p><p>However it can optionally contain additional signature information
verification) has to come from outside.</p><p>A tag is created with <a href="git-mktag.html" target="_top">git-mktag(1)</a>,
its data can be accessed by <a href="git-cat-file.html" target="_top">git-cat-file(1)</a>,
and the signature can be verified by
-<a href="git-verify-tag.html" target="_top">git-verify-tag(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277817"></a>The "index" aka "Current Directory Cache"</h2></div></div></div><p>The index is a simple binary file, which contains an efficient
+<a href="git-verify-tag.html" target="_top">git-verify-tag(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277924"></a>The "index" aka "Current Directory Cache"</h2></div></div></div><p>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
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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277893"></a>The Workflow</h2></div></div></div><p>Generally, all "git" operations work on the index file. Some operations
+been written back to the backing store.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id277999"></a>The Workflow</h2></div></div></div><p>Generally, all "git" operations work on the index file. Some operations
work <span class="strong"><strong>purely</strong></span> 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:</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id277911"></a>working directory -> index</h3></div></div></div><p>You update the index with information from the working directory with
+main combinations:</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278018"></a>working directory -> index</h3></div></div></div><p>You update the index with information from the working directory with
the <a href="git-update-index.html" target="_top">git-update-index(1)</a> command. You
generally update the index information by just specifying the filename
you want to update, like so:</p><div class="literallayout"><p>$ git-update-index filename</p></div><p>but to avoid common mistakes with filename globbing etc, the command
will refresh the "stat" information of each index to match the current
stat information. It will <span class="emphasis"><em>not</em></span> 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.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278001"></a>index -> object database</h3></div></div></div><p>You write your current index file to a "tree" object with the program</p><div class="literallayout"><p>$ git-write-tree</p></div><p>that doesn't come with any options - it will just write out the
+an object still matches its old backing store object.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278108"></a>index -> object database</h3></div></div></div><p>You write your current index file to a "tree" object with the program</p><div class="literallayout"><p>$ git-write-tree</p></div><p>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:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278029"></a>object database -> index</h3></div></div></div><p>You read a "tree" file from the object database, and use that to
+other direction:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278136"></a>object database -> index</h3></div></div></div><p>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</p><div class="literallayout"><p>$ git-read-tree <sha1 of tree></p></div><p>and your index file will now be equivalent to the tree that you saved
earlier. However, that is only your <span class="emphasis"><em>index</em></span> file: your working
-directory contents have not been modified.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278060"></a>index -> working directory</h3></div></div></div><p>You update your working directory from the index by "checking out"
+directory contents have not been modified.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278167"></a>index -> working directory</h3></div></div></div><p>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
if you have an old version of the tree already checked out, you will
need to use the "-f" flag (<span class="emphasis"><em>before</em></span> the "-a" flag or the filename) to
<span class="emphasis"><em>force</em></span> the checkout.</p><p>Finally, there are a few odds and ends which are not purely moving
-from one representation to the other:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278124"></a>Tying it all together</h3></div></div></div><p>To commit a tree you have instantiated with "git-write-tree", you'd
+from one representation to the other:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id278230"></a>Tying it all together</h3></div></div></div><p>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.</p><p>Normally a "commit" has one parent: the previous state of the tree
| Working |<br>
| Directory |<br>
+-----------+<br>
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278218"></a>Examining the data</h2></div></div></div><p>You can examine the data represented in the object database and the
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278325"></a>Examining the data</h2></div></div></div><p>You can examine the data represented in the object database and the
index with various helper tools. For every object, you can use
<a href="git-cat-file.html" target="_top">git-cat-file(1)</a> to examine details about the
object:</p><div class="literallayout"><p>$ git-cat-file -t <objectname></p></div><p>shows the type of the object, and once you have the type (which is
readable form.</p><p>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 <code class="literal">.git/HEAD</code>,
-you can do</p><div class="literallayout"><p>$ git-cat-file commit HEAD</p></div><p>to see what the top commit was.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278296"></a>Merging multiple trees</h2></div></div></div><p>Git helps you do a three-way merge, which you can expand to n-way by
+you can do</p><div class="literallayout"><p>$ git-cat-file commit HEAD</p></div><p>to see what the top commit was.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278403"></a>Merging multiple trees</h2></div></div></div><p>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
always do a merge against your last commit (which should thus match what
you have in your current index anyway).</p><p>To do the merge, do</p><div class="literallayout"><p>$ git-read-tree -m -u <origtree> <yourtree> <targettree></p></div><p>which will do all trivial merge operations for you directly in the
index file, and you can just write the result out with
-<code class="literal">git-write-tree</code>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278384"></a>Merging multiple trees, continued</h2></div></div></div><p>Sadly, many merges aren't trivial. If there are files that have
+<code class="literal">git-write-tree</code>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278490"></a>Merging multiple trees, continued</h2></div></div></div><p>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 <span class="emphasis"><em>NOT</em></span> be written out to a tree
to help you understand what conceptually happens under the hood.
In practice, nobody, not even git itself, uses three <code class="literal">git-cat-file</code>
for this. There is <code class="literal">git-merge-index</code> program that extracts the
-stages to temporary files and calls a "merge" script on it:</p><div class="literallayout"><p>$ git-merge-index git-merge-one-file hello.c</p></div><p>and that is what higher level <code class="literal">git merge -s resolve</code> is implemented with.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278644"></a>How git stores objects efficiently: pack files</h2></div></div></div><p>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:</p><div class="literallayout"><p>$ git-merge-index git-merge-one-file hello.c</p></div><p>and that is what higher level <code class="literal">git merge -s resolve</code> is implemented with.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id278750"></a>How git stores objects efficiently: pack files</h2></div></div></div><p>We've seen how git stores each object in a file named after the
object's SHA1 hash.</p><p>Unfortunately this system becomes inefficient once a project has a
lot of objects. Try this on an old project:</p><div class="literallayout"><p>$ git count-objects<br>
6930 objects, 47620 kilobytes</p></div><p>The first number is the number of objects which are kept in
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 <span class="strong"><strong>BAD</strong></span> idea).</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id278904"></a>Chapter 9. GIT Glossary</h2></div></div></div><div class="variablelist"><dl><dt><span class="term">
+repository is a <span class="strong"><strong>BAD</strong></span> idea).</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id279010"></a>Chapter 9. GIT Glossary</h2></div></div></div><div class="variablelist"><dl><dt><span class="term">
<a name="def_alternate_object_database"></a>alternate object database
</span></dt><dd>
Via the alternates mechanism, a <a href="#def_repository">repository</a> can
</span></dt><dd>
The set of files and directories currently being worked on, i.e. you can
work in your <a href="#def_working_tree">working tree</a> without using git at all.
-</dd></dl></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id282186"></a>Chapter 10. Notes and todo list for this manual</h2></div></div></div><p>This is a work in progress.</p><p>The basic requirements:
+</dd></dl></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id282289"></a>Chapter 10. Notes and todo list for this manual</h2></div></div></div><p>This is a work in progress.</p><p>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