@@ -57,7 +57,7 @@ Managing branches
5757-----------------
5858
5959-----------------------------------------------
60- $ git branch # list all branches in this repo
60+ $ git branch # list all local branches in this repo
6161$ git checkout test # switch working directory to branch "test"
6262$ git branch new # create branch "new" starting at current HEAD
6363$ git branch -d new # delete branch "new"
@@ -496,8 +496,8 @@ git branch <branch> <start-point>::
496496 including using a branch name or a tag name
497497git branch -d <branch>::
498498 delete the branch <branch>; if the branch you are deleting
499- points to a commit which is not reachable from this branch,
500- this command will fail with a warning.
499+ points to a commit which is not reachable from the current
500+ branch, this command will fail with a warning.
501501git branch -D <branch>::
502502 even if the branch points to a commit not reachable
503503 from the current branch, you may know that that commit
@@ -602,13 +602,9 @@ shorthand:
602602The full name is occasionally useful if, for example, there ever
603603exists a tag and a branch with the same name.
604604
605- As another useful shortcut, if the repository "origin" posesses only
606- a single branch, you can refer to that branch as just "origin".
607-
608- More generally, if you have defined a remote repository named
609- "example", you can refer to the branch in that repository as
610- "example". And for a repository with multiple branches, this will
611- refer to the branch designated as the "HEAD" branch.
605+ As another useful shortcut, the "HEAD" of a repository can be referred
606+ to just using the name of that repository. So, for example, "origin"
607+ is usually a shortcut for the HEAD branch in the repository "origin".
612608
613609For the complete list of paths which git checks for references, and
614610the order it uses to decide which to choose when there are multiple
@@ -832,10 +828,10 @@ $ git tag stable-1 1b2e1d63ff
832828
833829You can use stable-1 to refer to the commit 1b2e1d63ff.
834830
835- This creates a "lightweight" tag. If the tag is a tag you wish to
836- share with others , and possibly sign cryptographically, then you
837- should create a tag object instead; see the gitlink:git-tag[1] man
838- page for details.
831+ This creates a "lightweight" tag. If you would also like to include a
832+ comment with the tag , and possibly sign it cryptographically, then you
833+ should create a tag object instead; see the gitlink:git-tag[1] man page
834+ for details.
839835
840836[[browsing-revisions]]
841837Browsing revisions
@@ -1176,6 +1172,8 @@ $ git diff --cached # difference between HEAD and the index; what
11761172$ git diff # difference between the index file and your
11771173 # working directory; changes that would not
11781174 # be included if you ran "commit" now.
1175+ $ git diff HEAD # difference between HEAD and working tree; what
1176+ # would be committed if you ran "commit -a" now.
11791177$ git status # a brief per-file summary of the above.
11801178-------------------------------------------------
11811179
@@ -1223,8 +1221,6 @@ If you examine the resulting commit using gitk, you will see that it
12231221has two parents, one pointing to the top of the current branch, and
12241222one to the top of the other branch.
12251223
1226- In more detail:
1227-
12281224[[resolving-a-merge]]
12291225Resolving a merge
12301226-----------------
@@ -1361,6 +1357,9 @@ $ gitk --merge
13611357These will display all commits which exist only on HEAD or on
13621358MERGE_HEAD, and which touch an unmerged file.
13631359
1360+ You may also use gitlink:git-mergetool, which lets you merge the
1361+ unmerged files using external tools such as emacs or kdiff3.
1362+
13641363Each time you resolve the conflicts in a file and update the index:
13651364
13661365-------------------------------------------------
@@ -1705,9 +1704,16 @@ so often you can accomplish the above with just
17051704$ git pull
17061705-------------------------------------------------
17071706
1708- See the descriptions of the branch.<name>.remote and
1709- branch.<name>.merge options in gitlink:git-config[1] to learn
1710- how to control these defaults depending on the current branch.
1707+ See the descriptions of the branch.<name>.remote and branch.<name>.merge
1708+ options in gitlink:git-config[1] to learn how to control these defaults
1709+ depending on the current branch. Also note that the --track option to
1710+ gitlink:git-branch[1] and gitlink:git-checkout[1] can be used to
1711+ automatically set the default remote branch to pull from at the time
1712+ that a branch is created:
1713+
1714+ -------------------------------------------------
1715+ $ git checkout --track -b origin/maint maint
1716+ -------------------------------------------------
17111717
17121718In addition to saving you keystrokes, "git pull" also helps you by
17131719producing a default commit message documenting the branch and
@@ -1830,14 +1836,14 @@ Now, assume your personal repository is in the directory ~/proj. We
18301836first create a new clone of the repository:
18311837
18321838-------------------------------------------------
1833- $ git clone --bare proj-clone .git
1839+ $ git clone --bare proj.git
18341840-------------------------------------------------
18351841
1836- The resulting directory proj-clone .git will contains a "bare" git
1842+ The resulting directory proj.git will contains a "bare" git
18371843repository--it is just the contents of the ".git" directory, without
18381844a checked-out copy of a working directory.
18391845
1840- Next, copy proj-clone .git to the server where you plan to host the
1846+ Next, copy proj.git to the server where you plan to host the
18411847public repository. You can use scp, rsync, or whatever is most
18421848convenient.
18431849
@@ -1863,7 +1869,7 @@ adjustments to give web clients some extra information they need:
18631869-------------------------------------------------
18641870$ mv proj.git /home/you/public_html/proj.git
18651871$ cd proj.git
1866- $ git update-server-info
1872+ $ git --bare update-server-info
18671873$ chmod a+x hooks/post-update
18681874-------------------------------------------------
18691875
@@ -1930,7 +1936,7 @@ As with git-fetch, you may also set up configuration options to
19301936save typing; so, for example, after
19311937
19321938-------------------------------------------------
1933- $ cat >.git/config <<EOF
1939+ $ cat >> .git/config <<EOF
19341940[remote "public-repo"]
19351941 url = ssh://yourserver.com/~you/proj.git
19361942EOF
@@ -2312,9 +2318,15 @@ descendant of the old head, you may force the update with:
23122318$ git fetch git://example.com/proj.git +master:refs/remotes/example/master
23132319-------------------------------------------------
23142320
2315- Note the addition of the "+" sign. Be aware that commits that the
2316- old version of example/master pointed at may be lost, as we saw in
2317- the previous section.
2321+ Note the addition of the "+" sign. Alternatively, you can use the "-f"
2322+ flag to force updates of all the fetched branches, as in:
2323+
2324+ -------------------------------------------------
2325+ $ git fetch -f origin
2326+ -------------------------------------------------
2327+
2328+ Be aware that commits that the old version of example/master pointed at
2329+ may be lost, as we saw in the previous section.
23182330
23192331[[remote-branch-configuration]]
23202332Configuring remote branches
@@ -2400,7 +2412,7 @@ approximated by the SHA1 hash of the object itself. Objects may refer
24002412to other objects (by referencing their SHA1 hash), and so you can
24012413build up a hierarchy of objects.
24022414
2403- All objects have a statically determined "type" aka "tag", which is
2415+ All objects have a statically determined "type" which is
24042416determined at object creation time, and which identifies the format of
24052417the object (i.e. how it is used, and how it can refer to other
24062418objects). There are currently four different object types: "blob",
@@ -2423,7 +2435,7 @@ the time of the commit). In addition, a "commit" refers to one or more
24232435that directory hierarchy.
24242436
24252437As a special case, a commit object with no parents is called the "root"
2426- object , and is the point of an initial project commit. Each project
2438+ commit , and is the point of an initial project commit. Each project
24272439must have at least one root, and while you can tie several different
24282440root objects together into one project by creating a commit object which
24292441has two or more separate roots as its ultimate parents, that's probably
@@ -2542,7 +2554,7 @@ that the tree is "good" or that the merge information makes sense.
25422554The parents do not have to actually have any relationship with the
25432555result, for example.
25442556
2545- Note on commits: unlike real SCM's, commits do not contain
2557+ Note on commits: unlike some SCM's, commits do not contain
25462558rename information or file mode change information. All of that is
25472559implicit in the trees involved (the result tree, and the result trees
25482560of the parents), and describing that makes no sense in this idiotic
@@ -2609,7 +2621,7 @@ The "index" aka "Current Directory Cache"
26092621-----------------------------------------
26102622
26112623The index is a simple binary file, which contains an efficient
2612- representation of a virtual directory content at some random time . It
2624+ representation of the contents of a virtual directory . It
26132625does so by a simple array that associates a set of names, dates,
26142626permissions and content (aka "blob") objects together. The cache is
26152627always kept ordered by name, and names are unique (with a few very
@@ -2912,7 +2924,7 @@ since the tree object information is always the first line in a commit
29122924object.
29132925
29142926Once you know the three trees you are going to merge (the one "original"
2915- tree, aka the common case , and the two "result" trees, aka the branches
2927+ tree, aka the common tree , and the two "result" trees, aka the branches
29162928you want to merge), you do a "merge" read into the index. This will
29172929complain if it has to throw away your old index contents, so you should
29182930make sure that you've committed those - in fact you would normally
@@ -2966,14 +2978,14 @@ obviously the final outcome is what is in `HEAD`. What the
29662978above example shows is that file `hello.c` was changed from
29672979`$orig` to `HEAD` and `$orig` to `$target` in a different way.
29682980You could resolve this by running your favorite 3-way merge
2969- program, e.g. `diff3` or `merge`, on the blob objects from
2970- these three stages yourself, like this:
2981+ program, e.g. `diff3`, `merge`, or git's own merge-file, on
2982+ the blob objects from these three stages yourself, like this:
29712983
29722984------------------------------------------------
29732985$ git-cat-file blob 263414f... >hello.c~1
29742986$ git-cat-file blob 06fa6a2... >hello.c~2
29752987$ git-cat-file blob cc44c73... >hello.c~3
2976- $ merge hello.c~2 hello.c~1 hello.c~3
2988+ $ git merge-file hello.c~2 hello.c~1 hello.c~3
29772989------------------------------------------------
29782990
29792991This would leave the merge result in `hello.c~2` file, along
0 commit comments