Mercurial > hg > kdocs
annotate local/git-quick.html @ 94:d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
as an example.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 15 Nov 2007 16:27:45 -0600 |
parents | 1bd46b3c996d |
children | ae115ea731f2 |
rev | line source |
---|---|
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 <title>Following Linux kernel development with git</title> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
3 <ul> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
4 <li><a href="#what">A "git bisect HOWTO" with a few extras.</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
5 <li><a href="#installing">Installing git</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
6 <li><a href="#downloading">Downloading the kernel with git</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
7 <li><a href="#updating">Updating your local copy</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
8 <li><a href="#looking">Looking at historical versions</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
9 <li><a href="#versions">Working with historical versions<a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
10 <li><a href="#diff">Using git diff</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
11 <li><a href="#tarballs">Creating tarballs</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
12 <li><a href="#bisect">Bisect</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
13 <li><a href="#example">Example git bisect run</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
14 <li><a href="#commands">Command summary</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
15 <li><a href="#linus">Linus Tovalds talks about git</a></li> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
16 </ul> |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
17 |
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
18 <a name="what><h2>A "git bisect HOWTO" with a few extras.</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 <p>This document tells you how to follow Linux kernel development (and |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 examine its history) with git. It does not assume you've ever used a source |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 control system before, nor does it assume that you're familiar with |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 "distributed" vs "centralized" source control systems.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 <p>This document describes a read-only approach, suitable for trying out |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 recent versions quickly, using "git bisect" to track down bugs, and |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 applying patches temporarily to see if they work for you. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 If you want to learn how to save changes into your copy of the git history and |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 submit them back to the kernel developers through git, you'll need |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 <a href=http://www.kernel.org/pub/software/scm/git/docs/tutorial.html>a much |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 larger tutorial</a> that explains concepts like "branches". This one |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 shouldn't get in the way of doing that sort of thing, but it doesn't go there.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
34 <a name="installing"><h2>Installing git</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 <p>First, install a recent version of git. (Note that the user interface |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 changed drastically in git-1.5.0, and this page only describes the new |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 interface.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 <p>If your distro doesn't have a recent enough version, you can grab a |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 <a href=http://www.kernel.org/pub/software/scm/git/>source tarball</a> and |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 build it yourself. (There's no ./configure, as root go |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 "make install prefix=/usr". It needs zlib, libssl, libcurl, and libexpat.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
44 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
45 <p>When building from source, the easy way to get the man pages is to download |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 the appropriate git-manpages tarball (at the same URL as the source code) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
47 and extract it into /usr/share/man. You want the man pages because "git help" |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 displays them.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
49 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
50 <a name="downloading"><h2>Downloading the kernel with git</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 <p>The following command will download the current linux-kernel repository into |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
53 a local directory called "linux-git":</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
54 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
55 <blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-git |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
57 </blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
58 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
59 <p>This downloads a local copy of the entire revision history (back to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
60 2.6.12-rc2), which takes a couple hundred megabytes. It extracts the most |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
61 recent version of all the files into your linux-git directory, but that's just |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
62 a snapshot (generally referred to by git people as your |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
63 "<a href=http://www.kernel.org/pub/software/scm/git/docs/glossary.html#def_working_tree>working copy</a>"). |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
64 The history is actually stored in the subdirectory "linux-git/.git", and the |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
65 snapshot can be recreated from that (or changed to match any historical |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
66 version) via various git commands explained below.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
67 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
68 <p>You start with an up-to-the-minute copy of the linux kernel source, which |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
69 you can use just like an extracted tarball (ignoring the extra files in the |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
70 ".git" directory). If you're interested in history from the bitkeeper days |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
71 (before 2.6.12-rc2), that's stored in a seperate repository, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
72 "<b>git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git</b>". |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
73 (<a href=http://git.kernel.org>Here is a list of all git repositories hosted |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
74 on kernel.org</a>.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
75 |
94
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
76 <p>If you forget the URL a git repository came from, it's in the file |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
77 ".git/FETCH_HEAD". Normally you shouldn't need to care, since git remembers |
94
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
78 it.</p> |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
79 |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
80 <p>Note that unlike Mercurial, the URLs git uses aren't the same ones you |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
81 find repositories at on the web. You have to translate them. For example, |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
82 the "stable-queue" repository at which bugfix-only patches for fourth level |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
83 dot release of the linux kernel queue up before going in is on the web at |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
84 <a href="http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git">http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git</a>. |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
85 In this case, the corresponding git repository would be cloned with:</p> |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
86 |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
87 <blockquote> |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
88 <pre>git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
89 </pre> |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
90 </blockquote> |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
91 |
d3a9753eea24
A note about web URLs vs git URLs, and note the "stable-queue" repository
Rob Landley <rob@landley.net>
parents:
93
diff
changeset
|
92 <p>I.E. replace "http://git.kernel.org/?p=" with "git://git.kernel.org/pub/scm/".</p> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
93 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
94 <a name="updating"><h2>Updating your local copy</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
95 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
96 <p>The command "<b>git pull</b>" downloads all the changes committed to Linus's |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
97 git repository since the last time you updated your copy, and appends those |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
98 commits to your copy of the repository (in the .git subdirectory). In addition, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
99 this will automatically update the files in your working copy as appropriate. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
100 (If your working copy was set to a historical version, it won't be changed, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
101 but returning your working copy to the present after a pull will get you the |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
102 newest version.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
103 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
104 <p>Note that this copies the revision history into your local .git directory. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
105 Other git commands (log, checkout, tag, blame, etc.) don't need to talk to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
106 the server, you can work on your laptop without an internet connection (or |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
107 with a very slow one) and still have access to the complete revision history |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
108 you've already downloaded.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
109 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
110 <a name="looking"><h2>Looking at historical versions</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
111 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
112 <p>The <b>git log</b> command lists the changes recorded in your repository, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
113 starting with the most recent and working back. The big hexadecimal numbers |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
114 are unique identifiers (sha1sum) for each commit. If you want to specify a |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
115 commit, you only need the first few digits, enough to form a unique prefix. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
116 (Six digits should be plenty.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
117 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
118 <p>You can limit the log to a specific file or directory, which lists |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
119 only the commits changing that file/directory. Just add the file(s) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
120 you're interested in to the end of the <b>git log</b> command line.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
121 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
122 <p>The <b>git tag -l</b> command shows all the tagged releases. These |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
123 human-readable names can be used as synonyms for the appropriate commit |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
124 identifier, which is useful when doing things like checkout and diff. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
125 The special tag "<b>master</b>" points to the most recent commit.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
126 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
127 <p>The <b>git blame $FILE</b> command displays all the changes that resulted in |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
128 the current state of a file. It shows each line, prefixed with the commit |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
129 identifier which last changed that line. (If the default version of <b>git |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
130 blame</b> is difficult to read on an 80 charater terminal, try <b>git blame |
93 | 131 $FILE | sed 's/([^)]*)//'</b> to see more of the file itself.)</p> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
132 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
133 <a name="versions"><h2>Working with historical versions</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
134 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
135 <p>The <b>git checkout</b> command changes your working copy of the source to a |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
136 specific version. The -f option to checkout backs out any local changes |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
137 you've made to the files. The <b>git clean</b> command deletes any extra files |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
138 in your working directory (ones which aren't checked into the repository). |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
139 The -d option to clean deletes untracked directories as well as files.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
140 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
141 <p>So to reset your working copy of the source to a historical version, go |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
142 <b>git checkout -f $VERSION; git clean -d</b> where $VERSION is the tag or |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
143 sha1sum identifier of the version you want. If you don't specify a $VERSION, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
144 git will default to "master" which is the most recent checkout in Linus's |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
145 tree (what mercurial calls "tip" and Subversion calls HEAD), returning you |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
146 to the present and removing any uncommitted local changes.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
147 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
148 <p>Another way to undo all changes to your copy is to do "rm -rf *" in |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
149 the linux-git directory (which doesn't delete hidden files like ".git"), |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
150 followed by "git checkout -f" to grab fresh copies from the repository in |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
151 the .git subdirectory. This generally isn't necessary. Most of the time, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
152 <b>git checkout -f</b> is sufficient to reset your working copy to the most |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
153 recent version in the repository.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
154 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
155 <p>If you lose track of which version is currently checked out as your working |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
156 copy, use <b>git log</b> to see the most recent commits to the version you're |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
157 looking at, and <b>git log master</b> to compare against the most recent |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
158 commits in the repository.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
159 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
160 <a name="diff"><h2>Using git diff</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
161 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
162 <p>The command "git diff" shows differences between git versions. You can |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
163 ask it to show differences between:</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
164 <ul> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
165 <li><b>git diff</b> - the current version checked out from the respository and all files in the working directory</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
166 <li><b>git diff v2.6.21</b> - a specific historical version and all files in the working directory</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
167 <li><b>git diff v2.6.20 v2.6.21</b> - all files in two different historial |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
168 versions</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
169 <li><b>git diff init/main.c</b> - specific locally modified files in the |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
170 working directory that don't match what was checked out from the repository</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
171 <li><b>git diff v2.6.21 init/main.c</b> - specific file(s) in a specific historical version of the repository vs those same files in the working directory.</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
172 <li><b>git diff v2.6.20 v2.6.21 init/main.c</b> - specific files in two |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
173 different historical version of the repository</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
174 </ul> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
175 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
176 <p>What git is doing is checking each argument to see if it recognizes it |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
177 as a historical version sha1sum or tag, and if it isn't it checks to see if |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
178 it's a file. If this is likely to cause confusion, you can use the magic |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
179 argument "--" to indicate that all the arguments before that are versions |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
180 and all the arguments after that are filenames.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
181 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
182 <p>The argument <b>--find-copies-harder</b> tells git diff to detect renamed or |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
183 copied files. Notice that git diff has a special syntax to indicate renamed |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
184 or copied files, which is much more concise and portable than the traditional |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
185 behavior of removing all lines from one file and adding them to another. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
186 (This behavior may become the default in a future version.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
187 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
188 <a name="tarballs"><h2>Creating tarballs</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
189 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
190 <p>The <b>git archive $VERSION</b> command creates a tarball (written to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
191 stdout) of the given version. Note that "master" isn't the default here, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
192 you have to specify that if you want the most up-to-date version. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
193 You can pipe it through bzip and write it to a file (<b>git archive master | |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
194 bzip2 > master.tar.bz2</b>) or you can use git archive to grab a clean copy |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
195 out of your local git repository and extract it into another directory, ala:</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
196 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
197 <blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
198 <pre> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
199 mkdir $COPY |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
200 git archive master | tar xCv $COPY |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
201 </pre> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
202 </blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
203 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
204 <p>You can also use the standard Linux kernel out-of-tree building |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
205 infrastructure on the git working directory, ala:</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
206 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
207 <blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
208 <pre> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
209 cd $GITDIR |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
210 make allnoconfig O=$OTHERDIR |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
211 cd $OTHERDIR |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
212 make menuconfig |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
213 make |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
214 </pre> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
215 </blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
216 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
217 <p>Finally, you can build in your git directory, and then clean it up |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
218 afterwards with <b>git checkout -f; git clean -d</b>. (Better than |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
219 "make distclean".)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
220 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
221 <a name="bisect"><h2>Bisect</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
222 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
223 <p>Possibly the most useful thing git does for non-kernel developers is |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
224 <b>git bisect</b>, which can track down a bug to a specific revision. This |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
225 is a multi-step process which binary searches through the revision history |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
226 to find a specific commit responsible for a testable change in behavior.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
227 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
228 <p>(You don't need to know this, but bisect turns out to be nontrivial to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
229 implement in a distributed source control system, because the revision history |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
230 isn't linear. When the history branches and comes back together again, binary |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
231 searching through it requires remembering more than just a single starting and |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
232 ending point. That's why bisect works the way it does.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
233 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
234 <p>The git bisect commands are:</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
235 <ul> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
236 <li><b>git bisect start</b> - start a new bisect. This opens a new (empty) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
237 log file tracking all the known good and bad versions.</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
238 <li><b>git bisect bad $VERSION</b> - Identify a known broken version. (Leaving |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
239 $VERSION blank indicates the current version, "master".)</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
240 <li><b>git bisect good $VERSION</b> - Identify a version that was known to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
241 work.</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
242 <li><b>git bisect log</b> - Show bisection history so far this run.</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
243 <li><b>git bisect replay $LOGFILE</b> - Reset to an earlier state using the output of git bsect log.</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
244 <li><b>git bisect reset</b> - Finished bisecting, clean up and return to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
245 head. (If git bisect start says "won't bisect on seeked tree", you forgot |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
246 to do this last time and should do it now.)</li> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
247 </ul> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
248 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
249 <p>To track down the commit that introduced a bug via git bisect, start with |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
250 <b>git bisect reset master</b> (just to be safe), then <b>git bisect start</b>. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
251 Next identify the last version known to work (ala <b>git bisect good |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
252 v2.6.20</b>), and identify the first bad version you're aware of (if it's |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
253 still broken, use "master".)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
254 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
255 <p>After you identify one good and one bad version, git will grind for a bit |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
256 and reset the working directory state to some version in between, displaying |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
257 the version identifier it selected. Test this version (build and run your |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
258 test), then identify it as good or bad with the appropriate git bisect |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
259 command. (Just "git bisect good" or "get bisect bad", there's no need to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
260 identify version here because it's the current version.) After each such |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
261 identification, git will grind for a bit and find another version to test, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
262 resetting the working directory state to the new version until it narrows |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
263 it down to one specific commit.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
264 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
265 <p>The biggest problem with <b>git bisect</b> is hitting a revision that |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
266 doesn't compile properly. When the build breaks, you can't determine |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
267 whether or not the current version is good or bad. This is where |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
268 <b>git bisect log</b> comes into play.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
269 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
270 <p>When in doubt, save the git bisect log output to a file |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
271 (<b>git bisect log > ../bisect.log</b>). Then make a guess |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
272 whether the commit you can't build would have shown the problem if you |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
273 could build it. If you guess wrong (hint: every revision bisect wants |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
274 to test after that comes out the opposite of your guess, all the way to the |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
275 end) do a <b>git bisect replay ../bisect.log</b> to restart from your |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
276 saved position, and guess the other way. If you realize after the fact you |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
277 need to back up, the bisect log is an easily editable text file you can |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
278 always chop a few lines off the end of.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
279 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
280 <a name="example"><h2>Example git bisect run</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
281 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
282 <p>Here is a real git bisect run I did on the <a href=http://qemu.org>qemu</a> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
283 git repository (git://git.kernel.dk/data/git/qemu) to figure out why |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
284 the PowerPC Linux kernel I'd built was hanging during IDE controller |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
285 intiialization under the current development version of qemu-system-ppc |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
286 (but not under older versions).</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
287 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
288 <blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
289 <pre><b>$ git bisect reset master</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
290 Already on branch "master" |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
291 <b>$ git bisect good release_0_8_1</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
292 You need to start by "git bisect start" |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
293 Do you want me to do it for you [Y/n]? y |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
294 <b>$ git bisect bad master</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
295 Bisecting: 753 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
296 [7c8ad370662b706b4f46497f532016cc7a49b83e] Embedded PowerPC Device Control Registers infrastructure. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
297 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
298 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
299 Unhappy :( |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
300 <b>$ git bisect bad # The test failed</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
301 Bisecting: 376 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
302 [255d4f6dd496d2d529bce38a85cc02199833f080] Simplify error handling again. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
303 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
304 WARNING: "gcc" looks like gcc 4.x |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
305 Looking for gcc 3.x |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
306 ./configure: 357: Syntax error: Bad fd number |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
307 <b>$ git bisect log > ../bisect.log # Darn it, build break. Save state and...</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
308 <b>$ git bisect good # Wild guess because I couldn't run the test.</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
309 Bisecting: 188 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
310 [16bcc6b31799ca01cd389db7cb90a345e9b68dd9] Fix wrong interrupt number for the second serial interface. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
311 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
312 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
313 Happy :) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
314 <b>$ git bisect good # Hey, maybe my guess was right</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
315 Bisecting: 94 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
316 [37781cc88f69e45624c1cb15321ddd2055cf74b6] Fix usb hid and mass-storage protocol revision, by Juergen Keil. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
317 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
318 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
319 Happy :) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
320 <b>$ git bisect good</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
321 Bisecting: 47 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
322 [30347b54b7212eba09db05317217dbc65a149e25] Documentation update |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
323 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
324 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
325 Happy :) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
326 <b>$ git bisect good</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
327 Bisecting: 23 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
328 [06a21b23c22ac18d04c9f676b9b70bb6ef72d7f1] Set proper BadVAddress value for unaligned instruction fetch. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
329 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
330 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
331 Happy :) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
332 <b>$ git bisect good</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
333 Bisecting: 11 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
334 [da77e9d7918cabed5b0725f87496a1dc28da8b8c] Fix exception handling cornercase for rdhwr. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
335 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
336 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
337 Happy :) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
338 <b>$ git bisect good</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
339 Bisecting: 5 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
340 [36f447f730f61ac413c5b1c4a512781f5dea0c94] Implement embedded IRQ controller for PowerPC 6xx/740 & 750. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
341 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
342 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
343 Unhappy :( |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
344 <b>$ git bisect bad # Oh good, I was getting worried I'd guessed wrong above...</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
345 Bisecting: 2 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
346 [d4838c6aa7442fae62b08afbf4c358200f10ec74] Proper handling of reserved bits in the context register. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
347 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
348 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
349 Happy :) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
350 Bisecting: 1 revisions left to test after this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
351 [a8b64e6f4c7f3c4850be5fd303bf590564264294] Fix monitor disasm output for Sparc64 target |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
352 <b>$ ./configure && make -j 2 && ~/mytest</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
353 ... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
354 Happy :) |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
355 <b>$ git bisect good</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
356 36f447f730f61ac413c5b1c4a512781f5dea0c94 is first bad commit |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
357 commit 36f447f730f61ac413c5b1c4a512781f5dea0c94 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
358 Author: j_mayer <j_mayer> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
359 Date: Mon Apr 9 22:45:36 2007 +0000 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
360 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
361 Implement embedded IRQ controller for PowerPC 6xx/740 & 750. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
362 Fix PowerPC external interrupt input handling and lowering. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
363 Fix OpenPIC output pins management. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
364 Fix multiples bugs in OpenPIC IRQ management. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
365 Fix OpenPIC CPU(s) reset function. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
366 Fix Mac99 machine to properly route OpenPIC outputs to the PowerPC input pins. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
367 Fix PREP machine to properly route i8259 output to the PowerPC external |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
368 interrupt pin. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
369 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
370 :100644 100644 0eabacd6434b8e40876581605c619513bf9ac512 284cb92ae83a2a36e05137d3532106ff85167364 M cpu-exec.c |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
371 :040000 040000 68740f5b1330c7859abfea3ce31062cb92adaa7f 5c48b0d20f1c4d3115881b5e9e5b6c1d681f4880 M hw |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
372 :040000 040000 3ad1f0d09c60d8190d98b28318519ebaaccbb569 69efc274cec1801848de9238ae71e97681978433 M target-ppc |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
373 :100644 100644 2f87946e874e8f6cbf9afd47c65e0baff236dc45 b40ff3747530d275181ff071c9cc9cff1d5ba02d M vl.h |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
374 <b>$ git bisect reset</b> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
375 </pre> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
376 </blockquote> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
377 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
378 <p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
379 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
380 <a name="commands"><h2>Command summary</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
381 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
382 <p><b>git help</b></p> - List available commands. You can also go |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
383 <b>git help COMMANDNAME</b> to see help on a specific command. Note, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
384 this displays the man page for the appropriate command, so you need to have |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
385 the git man pages installed for it to work.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
386 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
387 <p><b>git clone git://blah/blah/blah localdir</b> - Download a repository |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
388 from the web into "localdir". Linus's current repository is at |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
389 "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git", |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
390 the old history from the bitkeeper days (before 2.6.12-rc2) is at |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
391 "git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git", and |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
392 there are lots of <a href=http;//git.kernel.org>other trees hosted on |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
393 kernel.org</a> and elsewhere.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
394 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
395 <p><b>git pull</b> - Freshen up your local copy of the repository, downloading |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
396 and merging all of Linus's changes since last time you did this. In addition |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
397 to appending lots of commits to your repository in the .git directory, this |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
398 also updates the snapshot of the files (if it isn't already pointing into |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
399 the past).</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
400 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
401 <p><b>git log</b> - List the changes recorded in your repository, starting with |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
402 the most recent and working back. Note: the big hex numbers are unique |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
403 identifiers (sha1sum) for each commit. If you want to specify a commit, you |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
404 only need a unique prefix (generally the first four digits is enough).</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
405 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
406 <p><b>git tag -l</b> - Show all the tagged releases. These human-readable |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
407 names can be used as synonyms for the appropriate commit identifier when |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
408 doing things like checkout and diff. (Note, the special tag "master" |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
409 points to the most recent commit.)</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
410 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
411 <p><b>git checkout -f; git clean -d</b> - reset your snapshot to the most recent |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
412 commit. The "checkout" command updates your snapshot to a specific version |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
413 (defaulting to the tip of the current branch). The -f argument says to back |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
414 out any local changes you've made to the files, and "clean -d" says to |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
415 delete any extra files in the snapshot that aren't checked into the |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
416 repository.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
417 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
418 <p><b>git diff</b> - Show differences between two commits, such as |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
419 "git diff v2.6.20 v2.6.21". You can also specify specific files you're |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
420 interested in, ala "git diff v2.6.20 v2.6.21 README init/main.c". If you |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
421 specify one version it'll compare your working directory against that version, |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
422 and if you specify no versions it'll compare the version you checked out |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
423 against your working directory. Anything that isn't recognized as the start of |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
424 a commit indentifying sha1sum, or a tagged release, is assumed to be a filename. |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
425 If this causes problems, you can add "--" to the command line to explicitly |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
426 specify that arguments before that (if any) are version identifiers and all the |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
427 arguments after that are filenames. Add "--find-copies-harder" to detect |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
428 renames.</p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
429 |
90
1d853842db62
Add an index with anchor tags to jump to sections.
Rob Landley <rob@landley.net>
parents:
78
diff
changeset
|
430 <a name="linus"><h2>Linus Tovalds talks about git</h2> |
77
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
431 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
432 <p>In <a href=http://youtube.com/watch?v=4XpnKHJAok8>this Google Tech Talk</a></p> |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
433 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
434 <!-- |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
435 "git show @{163}"... one character less... |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
436 |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
437 http://www.kernel.org/pub/software/scm/git/docs/glossary.html#def_working_tree |
27dcbe1b4669
The git quickstart guide I've been working on for ages.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
438 --> |