* "git init --bare" is a synonym for "git --bare init" now.
-* "git gc --auto" honors a new pre-aut-gc hook to temporarily disable it.
+* "git gc --auto" honors a new pre-auto-gc hook to temporarily disable it.
* "git log --pretty=tformat:<custom format>" gives a LF after each entry,
instead of giving a LF between each pair of entries which is how
</li>\r
</ul>\r
</li>\r
+<li>\r
+<p>\r
+<em>tformat:</em>\r
+</p>\r
+<p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it\r
+provides "terminator" semantics instead of "separator" semantics. In\r
+other words, each commit has the message terminator character (usually a\r
+newline) appended, rather than a separator placed between entries.\r
+This means that the final entry of a single-line format will be properly\r
+terminated with a new line, just as the "oneline" format does.\r
+For example:</p>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973 -- NO NEWLINE\r
+\r
+$ git log -2 --pretty=tformat:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973</tt></pre>\r
+</div></div>\r
+</li>\r
</ul>\r
</div>\r
<h2>Limiting Output</h2>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 01:33:35 UTC\r
+Last updated 13-Jun-2008 10:02:41 UTC\r
</div>\r
</div>\r
</body>\r
</li>\r
</ul>\r
</li>\r
+<li>\r
+<p>\r
+<em>tformat:</em>\r
+</p>\r
+<p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it\r
+provides "terminator" semantics instead of "separator" semantics. In\r
+other words, each commit has the message terminator character (usually a\r
+newline) appended, rather than a separator placed between entries.\r
+This means that the final entry of a single-line format will be properly\r
+terminated with a new line, just as the "oneline" format does.\r
+For example:</p>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973 -- NO NEWLINE\r
+\r
+$ git log -2 --pretty=tformat:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973</tt></pre>\r
+</div></div>\r
+</li>\r
</ul>\r
</div>\r
<h2>Generating patches with -p</h2>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 22:46:44 UTC\r
+Last updated 13-Jun-2008 10:02:41 UTC\r
</div>\r
</div>\r
</body>\r
for branch <tt><name></tt>, set configuration <tt>branch.<name>.rebase</tt>\r
to <tt>true</tt>.\r
</p>\r
-<p><strong>NOTE:</strong> This is a potentially _dangerous_ mode of operation.\r
+<div class="admonitionblock">\r
+<table><tr>\r
+<td class="icon">\r
+<div class="title">Note</div>\r
+</td>\r
+<td class="content">This is a potentially _dangerous_ mode of operation.\r
It rewrites history, which does not bode well when you\r
published that history already. Do <strong>not</strong> use this option\r
-unless you have read <a href="git-rebase.html">git-rebase(1)</a> carefully.</p>\r
+unless you have read <a href="git-rebase.html">git-rebase(1)</a> carefully.</td>\r
+</tr></table>\r
+</div>\r
</dd>\r
<dt>\r
--no-rebase\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 22:46:54 UTC\r
+Last updated 13-Jun-2008 10:02:42 UTC\r
</div>\r
</div>\r
</body>\r
for branch `<name>`, set configuration `branch.<name>.rebase`
to `true`.
+
-*NOTE:* This is a potentially _dangerous_ mode of operation.
+[NOTE]
+This is a potentially _dangerous_ mode of operation.
It rewrites history, which does not bode well when you
published that history already. Do *not* use this option
unless you have read linkgit:git-rebase[1] carefully.
<div class="content"><em>git-remote</em> [-v | --verbose]\r
<em>git-remote</em> add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>\r
<em>git-remote</em> rm <name>\r
-<em>git-remote</em> show <name>\r
-<em>git-remote</em> prune <name>\r
+<em>git-remote</em> show [-n] <name>\r
+<em>git-remote</em> prune [-n | --dry-run] <name>\r
<em>git-remote</em> update [group]</div></div>\r
</div>\r
<h2>DESCRIPTION</h2>\r
referenced by <name>, but are still locally available in\r
"remotes/<name>".\r
</p>\r
-<p>With <tt>-n</tt> option, the remote heads are not confirmed first with <tt>git\r
-ls-remote <name></tt>; cached information is used instead. Use with\r
-caution.</p>\r
+<p>With <tt>--dry-run</tt> option, report what branches will be pruned, but do no\r
+actually prune them.</p>\r
</dd>\r
<dt>\r
<em>update</em>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 22:46:57 UTC\r
+Last updated 13-Jun-2008 10:02:42 UTC\r
</div>\r
</div>\r
</body>\r
'git-remote' [-v | --verbose]
'git-remote' add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>
'git-remote' rm <name>
-'git-remote' show <name>
-'git-remote' prune <name>
+'git-remote' show [-n] <name>
+'git-remote' prune [-n | --dry-run] <name>
'git-remote' update [group]
DESCRIPTION
referenced by <name>, but are still locally available in
"remotes/<name>".
+
-With `-n` option, the remote heads are not confirmed first with `git
-ls-remote <name>`; cached information is used instead. Use with
-caution.
+With `--dry-run` option, report what branches will be pruned, but do no
+actually prune them.
'update'::
</li>\r
</ul>\r
</li>\r
+<li>\r
+<p>\r
+<em>tformat:</em>\r
+</p>\r
+<p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it\r
+provides "terminator" semantics instead of "separator" semantics. In\r
+other words, each commit has the message terminator character (usually a\r
+newline) appended, rather than a separator placed between entries.\r
+This means that the final entry of a single-line format will be properly\r
+terminated with a new line, just as the "oneline" format does.\r
+For example:</p>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973 -- NO NEWLINE\r
+\r
+$ git log -2 --pretty=tformat:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973</tt></pre>\r
+</div></div>\r
+</li>\r
</ul>\r
</div>\r
<h2>Author</h2>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 22:46:59 UTC\r
+Last updated 13-Jun-2008 10:02:43 UTC\r
</div>\r
</div>\r
</body>\r
</li>\r
</ul>\r
</li>\r
+<li>\r
+<p>\r
+<em>tformat:</em>\r
+</p>\r
+<p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it\r
+provides "terminator" semantics instead of "separator" semantics. In\r
+other words, each commit has the message terminator character (usually a\r
+newline) appended, rather than a separator placed between entries.\r
+This means that the final entry of a single-line format will be properly\r
+terminated with a new line, just as the "oneline" format does.\r
+For example:</p>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973 -- NO NEWLINE\r
+\r
+$ git log -2 --pretty=tformat:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973</tt></pre>\r
+</div></div>\r
+</li>\r
</ul>\r
</div>\r
<h2>EXAMPLES</h2>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 01:34:14 UTC\r
+Last updated 13-Jun-2008 10:02:43 UTC\r
</div>\r
</div>\r
</body>\r
</li>\r
</ul>\r
</li>\r
+<li>\r
+<p>\r
+<em>tformat:</em>\r
+</p>\r
+<p>The <em>tformat:</em> format works exactly like <em>format:</em>, except that it\r
+provides "terminator" semantics instead of "separator" semantics. In\r
+other words, each commit has the message terminator character (usually a\r
+newline) appended, rather than a separator placed between entries.\r
+This means that the final entry of a single-line format will be properly\r
+terminated with a new line, just as the "oneline" format does.\r
+For example:</p>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>$ git log -2 --pretty=format:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973 -- NO NEWLINE\r
+\r
+$ git log -2 --pretty=tformat:%h 4da45bef \\r
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'\r
+4da45be\r
+7134973</tt></pre>\r
+</div></div>\r
+</li>\r
</ul>\r
</div>\r
<h2>Examples</h2>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 01:34:24 UTC\r
+Last updated 13-Jun-2008 10:02:45 UTC\r
</div>\r
</div>\r
</body>\r
<div class="content">\r
<pre><tt>$ git commit</tt></pre>\r
</div></div>\r
-<p>This will again prompt your for a message describing the change, and then\r
+<p>This will again prompt you for a message describing the change, and then\r
record a new version of the project.</p>\r
<p>Alternatively, instead of running <tt>git add</tt> beforehand, you can use</p>\r
<div class="listingblock">\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 08-Jun-2008 01:34:29 UTC\r
+Last updated 13-Jun-2008 10:02:46 UTC\r
</div>\r
</div>\r
</body>\r
$ git commit
------------------------------------------------
-This will again prompt your for a message describing the change, and then
+This will again prompt you for a message describing the change, and then
record a new version of the project.
Alternatively, instead of running `git add` beforehand, you can use
- '%m': left, right or boundary mark
- '%n': newline
- '%x00': print a byte from a hex code
+
+* 'tformat:'
++
+The 'tformat:' format works exactly like 'format:', except that it
+provides "terminator" semantics instead of "separator" semantics. In
+other words, each commit has the message terminator character (usually a
+newline) appended, rather than a separator placed between entries.
+This means that the final entry of a single-line format will be properly
+terminated with a new line, just as the "oneline" format does.
+For example:
++
+---------------------
+$ git log -2 --pretty=format:%h 4da45bef \
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
+4da45be
+7134973 -- NO NEWLINE
+
+$ git log -2 --pretty=tformat:%h 4da45bef \
+ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/'
+4da45be
+7134973
+---------------------
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Git User's Manual (for version 1.5.3 or newer)</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="id189136"></a>Git User's Manual (for version 1.5.3 or newer)</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id264725">Preface</a></span></dt><dt><span class="chapter"><a href="#repositories-and-branches">1. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">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="#examining-remote-branches">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="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#exploring-git-history">2. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#using-bisect">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#naming-commits">Naming commits</a></span></dt><dt><span class="section"><a href="#creating-tags">Creating tags</a></span></dt><dt><span class="section"><a href="#browsing-revisions">Browsing revisions</a></span></dt><dt><span class="section"><a href="#generating-diffs">Generating diffs</a></span></dt><dt><span class="section"><a href="#viewing-old-file-versions">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#history-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#counting-commits-on-a-branch">Counting the number of commits on a branch</a></span></dt><dt><span class="section"><a href="#checking-for-equal-branches">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#finding-tagged-descendants">Find first tagged version including a given fix</a></span></dt><dt><span class="section"><a href="#showing-commits-unique-to-a-branch">Showing commits unique to a given branch</a></span></dt><dt><span class="section"><a href="#making-a-release">Creating a changelog and tarball for a software release</a></span></dt><dt><span class="section"><a href="#Finding-comments-with-given-content">Finding commits referencing a file with given content</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Developing-with-git">3. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#telling-git-your-name">Telling git your name</a></span></dt><dt><span class="section"><a href="#creating-a-new-repository">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="#creating-good-commit-messages">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#ignoring-files">Ignoring files</a></span></dt><dt><span class="section"><a href="#how-to-merge">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="#conflict-resolution">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="#fast-forwards">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#fixing-mistakes">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#reverting-a-commit">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-rewriting-history">Fixing a mistake by rewriting history</a></span></dt><dt><span class="section"><a href="#checkout-of-path">Checking out an old version of a file</a></span></dt><dt><span class="section"><a href="#interrupted-work">Temporarily setting aside work in progress</a></span></dt></dl></dd><dt><span class="section"><a href="#ensuring-good-performance">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#ensuring-reliability">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#checking-for-corruption">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#recovering-lost-changes">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sharing-development">4. 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="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><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-git">Exporting a git repository via the git protocol</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="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#forcing-push">What to do when a push fails</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">5. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#rewriting-one-commit">Rewriting a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-with-rewriting-history">Problems with rewriting history</a></span></dt><dt><span class="section"><a href="#bisect-merges">Why bisecting merge commits can be harder than bisecting linear history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#advanced-branch-management">6. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-concepts">7. Git concepts</a></span></dt><dd><dl><dt><span class="section"><a href="#the-object-database">The Object Database</a></span></dt><dd><dl><dt><span class="section"><a href="#commit-object">Commit Object</a></span></dt><dt><span class="section"><a href="#tree-object">Tree Object</a></span></dt><dt><span class="section"><a href="#blob-object">Blob Object</a></span></dt><dt><span class="section"><a href="#trust">Trust</a></span></dt><dt><span class="section"><a href="#tag-object">Tag Object</a></span></dt><dt><span class="section"><a href="#pack-files">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt><dt><span class="section"><a href="#recovering-from-repository-corruption">Recovering from repository corruption</a></span></dt></dl></dd><dt><span class="section"><a href="#the-index">The index</a></span></dt></dl></dd><dt><span class="chapter"><a href="#submodules">8. Submodules</a></span></dt><dd><dl><dt><span class="section"><a href="#id280265">Pitfalls with submodules</a></span></dt></dl></dd><dt><span class="chapter"><a href="#low-level-operations">9. Low-level git operations</a></span></dt><dd><dl><dt><span class="section"><a href="#object-manipulation">Object access and manipulation</a></span></dt><dt><span class="section"><a href="#the-workflow">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#working-directory-to-index">working directory -> index</a></span></dt><dt><span class="section"><a href="#index-to-object-database">index -> object database</a></span></dt><dt><span class="section"><a href="#object-database-to-index">object database -> index</a></span></dt><dt><span class="section"><a href="#index-to-working-directory">index -> working directory</a></span></dt><dt><span class="section"><a href="#tying-it-all-together">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#examining-the-data">Examining the data</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees-2">Merging multiple trees, continued</a></span></dt></dl></dd><dt><span class="chapter"><a href="#hacking-git">10. Hacking git</a></span></dt><dd><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">11. GIT Glossary</a></span></dt><dt><span class="appendix"><a href="#git-quick-start">A. Git Quick Reference</a></span></dt><dd><dl><dt><span class="section"><a href="#quick-creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#managing-branches">Managing branches</a></span></dt><dt><span class="section"><a href="#exploring-history">Exploring history</a></span></dt><dt><span class="section"><a href="#making-changes">Making changes</a></span></dt><dt><span class="section"><a href="#merging">Merging</a></span></dt><dt><span class="section"><a href="#sharing-your-changes">Sharing your changes</a></span></dt><dt><span class="section"><a href="#repository-maintenance">Repository maintenance</a></span></dt></dl></dd><dt><span class="appendix"><a href="#todo">B. 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="id264725"></a>Preface</h2></div></div></div><p>Git is a fast distributed revision control system.</p><p>This manual is designed to be readable by someone with basic UNIX
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Git User's Manual (for version 1.5.3 or newer)</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="id189136"></a>Git User's Manual (for version 1.5.3 or newer)</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id264725">Preface</a></span></dt><dt><span class="chapter"><a href="#repositories-and-branches">1. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">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="#examining-remote-branches">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="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#exploring-git-history">2. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#using-bisect">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#naming-commits">Naming commits</a></span></dt><dt><span class="section"><a href="#creating-tags">Creating tags</a></span></dt><dt><span class="section"><a href="#browsing-revisions">Browsing revisions</a></span></dt><dt><span class="section"><a href="#generating-diffs">Generating diffs</a></span></dt><dt><span class="section"><a href="#viewing-old-file-versions">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#history-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#counting-commits-on-a-branch">Counting the number of commits on a branch</a></span></dt><dt><span class="section"><a href="#checking-for-equal-branches">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#finding-tagged-descendants">Find first tagged version including a given fix</a></span></dt><dt><span class="section"><a href="#showing-commits-unique-to-a-branch">Showing commits unique to a given branch</a></span></dt><dt><span class="section"><a href="#making-a-release">Creating a changelog and tarball for a software release</a></span></dt><dt><span class="section"><a href="#Finding-comments-with-given-content">Finding commits referencing a file with given content</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Developing-with-git">3. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#telling-git-your-name">Telling git your name</a></span></dt><dt><span class="section"><a href="#creating-a-new-repository">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="#creating-good-commit-messages">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#ignoring-files">Ignoring files</a></span></dt><dt><span class="section"><a href="#how-to-merge">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="#conflict-resolution">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="#fast-forwards">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#fixing-mistakes">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#reverting-a-commit">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-rewriting-history">Fixing a mistake by rewriting history</a></span></dt><dt><span class="section"><a href="#checkout-of-path">Checking out an old version of a file</a></span></dt><dt><span class="section"><a href="#interrupted-work">Temporarily setting aside work in progress</a></span></dt></dl></dd><dt><span class="section"><a href="#ensuring-good-performance">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#ensuring-reliability">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#checking-for-corruption">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#recovering-lost-changes">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sharing-development">4. 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="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><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-git">Exporting a git repository via the git protocol</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="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#forcing-push">What to do when a push fails</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">5. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#rewriting-one-commit">Rewriting a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-with-rewriting-history">Problems with rewriting history</a></span></dt><dt><span class="section"><a href="#bisect-merges">Why bisecting merge commits can be harder than bisecting linear history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#advanced-branch-management">6. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-concepts">7. Git concepts</a></span></dt><dd><dl><dt><span class="section"><a href="#the-object-database">The Object Database</a></span></dt><dd><dl><dt><span class="section"><a href="#commit-object">Commit Object</a></span></dt><dt><span class="section"><a href="#tree-object">Tree Object</a></span></dt><dt><span class="section"><a href="#blob-object">Blob Object</a></span></dt><dt><span class="section"><a href="#trust">Trust</a></span></dt><dt><span class="section"><a href="#tag-object">Tag Object</a></span></dt><dt><span class="section"><a href="#pack-files">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt><dt><span class="section"><a href="#recovering-from-repository-corruption">Recovering from repository corruption</a></span></dt></dl></dd><dt><span class="section"><a href="#the-index">The index</a></span></dt></dl></dd><dt><span class="chapter"><a href="#submodules">8. Submodules</a></span></dt><dd><dl><dt><span class="section"><a href="#id280264">Pitfalls with submodules</a></span></dt></dl></dd><dt><span class="chapter"><a href="#low-level-operations">9. Low-level git operations</a></span></dt><dd><dl><dt><span class="section"><a href="#object-manipulation">Object access and manipulation</a></span></dt><dt><span class="section"><a href="#the-workflow">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#working-directory-to-index">working directory -> index</a></span></dt><dt><span class="section"><a href="#index-to-object-database">index -> object database</a></span></dt><dt><span class="section"><a href="#object-database-to-index">object database -> index</a></span></dt><dt><span class="section"><a href="#index-to-working-directory">index -> working directory</a></span></dt><dt><span class="section"><a href="#tying-it-all-together">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#examining-the-data">Examining the data</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees-2">Merging multiple trees, continued</a></span></dt></dl></dd><dt><span class="chapter"><a href="#hacking-git">10. Hacking git</a></span></dt><dd><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">11. GIT Glossary</a></span></dt><dt><span class="appendix"><a href="#git-quick-start">A. Git Quick Reference</a></span></dt><dd><dl><dt><span class="section"><a href="#quick-creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#managing-branches">Managing branches</a></span></dt><dt><span class="section"><a href="#exploring-history">Exploring history</a></span></dt><dt><span class="section"><a href="#making-changes">Making changes</a></span></dt><dt><span class="section"><a href="#merging">Merging</a></span></dt><dt><span class="section"><a href="#sharing-your-changes">Sharing your changes</a></span></dt><dt><span class="section"><a href="#repository-maintenance">Repository maintenance</a></span></dt></dl></dd><dt><span class="appendix"><a href="#todo">B. 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="id264725"></a>Preface</h2></div></div></div><p>Git is a fast distributed revision control system.</p><p>This manual is designed to be readable by someone with basic UNIX
command-line skills, but no previous knowledge of git.</p><p><a href="#repositories-and-branches" title="Chapter 1. Repositories and Branches">Chapter 1, <i>Repositories and Branches</i></a> and <a href="#exploring-git-history" title="Chapter 2. Exploring git history">Chapter 2, <i>Exploring git history</i></a> explain how
to fetch and study a project using git—read these chapters to learn how
to build and test a particular version of a software project, search for
will be HEAD, the tip of the current branch; the other will be the
tip of the other branch, which is stored temporarily in MERGE_HEAD.</p><p>During the merge, the index holds three versions of each file. Each of
these three "file stages" represents a different version of the file:</p><div class="literallayout"><p>$ git show :1:file.txt # the file in a common ancestor of both branches<br>
-$ git show :2:file.txt # the version from HEAD, but including any<br>
- # nonconflicting changes from MERGE_HEAD<br>
-$ git show :3:file.txt # the version from MERGE_HEAD, but including any<br>
- # nonconflicting changes from HEAD.</p></div><p>Since the stage 2 and stage 3 versions have already been updated with
-nonconflicting changes, the only remaining differences between them are
-the important ones; thus <a href="git-diff.html" target="_top">git-diff(1)</a> can use the information in
-the index to show only those conflicts.</p><p>The diff above shows the differences between the working-tree version of
+$ git show :2:file.txt # the version from HEAD.<br>
+$ git show :3:file.txt # the version from MERGE_HEAD.</p></div><p>When you ask <a href="git-diff.html" target="_top">git-diff(1)</a> to show the conflicts, it runs a
+three-way diff between the conflicted merge results in the work tree with
+stages 2 and 3 to show only hunks whose contents come from both sides,
+mixed (in other words, when a hunk's merge results come only from stage 2,
+that part is not conflicting and is not shown. Same for stage 3).</p><p>The diff above shows the differences between the working-tree version of
file.txt and the stage 2 and stage 3 versions. So instead of preceding
each line by a single "+" or "-", it now uses two columns: the first
column is used for differences between the first parent and the working
number, and will take on values other than 0 for files with merge
conflicts.</p></li></ol></div><p>The index is thus a sort of temporary staging area, which is filled with
a tree which you are in the process of working on.</p><p>If you blow the index away entirely, you generally haven't lost any
-information as long as you have the name of the tree that it described.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="submodules"></a>Chapter 8. Submodules</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id280265">Pitfalls with submodules</a></span></dt></dl></div><p>Large projects are often composed of smaller, self-contained modules. For
+information as long as you have the name of the tree that it described.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="submodules"></a>Chapter 8. Submodules</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id280264">Pitfalls with submodules</a></span></dt></dl></div><p>Large projects are often composed of smaller, self-contained modules. For
example, an embedded Linux distribution's source tree would include every
piece of software in the distribution with some local modifications; a movie
player might need to build against a specific, known-working version of a
$ git add a<br>
$ git commit -m "Updated submodule a."<br>
$ git push</p></div><p>You have to run <code class="literal">git submodule update</code> after <code class="literal">git pull</code> if you want to update
-submodules, too.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id280265"></a>Pitfalls with submodules</h2></div></div></div><p>Always publish the submodule change before publishing the change to the
+submodules, too.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id280264"></a>Pitfalls with submodules</h2></div></div></div><p>Always publish the submodule change before publishing the change to the
superproject that references it. If you forget to publish the submodule change,
others won't be able to clone the repository:</p><div class="literallayout"><p>$ cd ~/git/super/a<br>
$ echo i added another line to this file >> a.txt<br>
-------------------------------------------------
$ git show :1:file.txt # the file in a common ancestor of both branches
-$ git show :2:file.txt # the version from HEAD, but including any
- # nonconflicting changes from MERGE_HEAD
-$ git show :3:file.txt # the version from MERGE_HEAD, but including any
- # nonconflicting changes from HEAD.
+$ git show :2:file.txt # the version from HEAD.
+$ git show :3:file.txt # the version from MERGE_HEAD.
-------------------------------------------------
-Since the stage 2 and stage 3 versions have already been updated with
-nonconflicting changes, the only remaining differences between them are
-the important ones; thus linkgit:git-diff[1] can use the information in
-the index to show only those conflicts.
+When you ask linkgit:git-diff[1] to show the conflicts, it runs a
+three-way diff between the conflicted merge results in the work tree with
+stages 2 and 3 to show only hunks whose contents come from both sides,
+mixed (in other words, when a hunk's merge results come only from stage 2,
+that part is not conflicting and is not shown. Same for stage 3).
The diff above shows the differences between the working-tree version of
file.txt and the stage 2 and stage 3 versions. So instead of preceding