fetch doc: move FETCH_HEAD material lower and add an example
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Marc Branchaud committed
Jun 2, 2014 at 11:21 UTC
366a0184e550200bf80fb76217b8655b54b1fd6c
1 file changed
+21
-8
Documentation/git-fetch.txt
+21
-8
@@ -18,13 +18,9 @@ SYNOPSIS
18
DESCRIPTION
19
-----------
20
Fetch branches and/or tags (collectively, "refs") from one or more
21
-other repositories, along with the objects necessary to complete
22
-their histories.
23
-
24
-The names of refs that are fetched, together with the object names
25
-they point at, are written to `.git/FETCH_HEAD`. This information
26
-can be used to learn what was fetched. In addition, the remote-tracking
27
-branches are updated (see description on <refspec> below for details).
21
+other repositories, along with the objects necessary to complete their
22
+histories. Remote-tracking branches are updated (see the description
23
+of <refspec> below for ways to control this behavior).
24
25
By default, any tag that points into the histories being fetched is
26
also fetched; the effect is to fetch tags that
@@ -34,7 +30,7 @@ configuring remote.<name>.tagopt. By using a refspec that fetches tags
30
explicitly, you can fetch tags that do not point into branches you
31
are interested in as well.
32
37
-'git fetch' can fetch from either a single named repository,
33
+'git fetch' can fetch from either a single named repository or URL,
34
or from several repositories at once if <group> is given and
35
there is a remotes.<group> entry in the configuration file.
36
(See linkgit:git-config[1]).
@@ -42,6 +38,10 @@ there is a remotes.<group> entry in the configuration file.
38
When no remote is specified, by default the `origin` remote will be used,
39
unless there's an upstream branch configured for the current branch.
40
41
+The names of refs that are fetched, together with the object names
42
+they point at, are written to `.git/FETCH_HEAD`. This information
43
+may be used by scripts or other git commands, such as linkgit:git-pull[1].
44
+
45
OPTIONS
46
-------
47
include::fetch-options.txt[]
@@ -78,6 +78,19 @@ the local repository by fetching from the branches (respectively)
78
The `pu` branch will be updated even if it is does not fast-forward,
79
because it is prefixed with a plus sign; `tmp` will not be.
80
81
+* Peek at a remote's branch, without configuring the remote in your local
82
+repository:
83
++
84
+------------------------------------------------
85
+$ git fetch git://git.kernel.org/pub/scm/git/git.git maint
86
+$ git log FETCH_HEAD
87
+------------------------------------------------
88
++
89
+The first command fetches the `maint` branch from the repository at
90
+`git://git.kernel.org/pub/scm/git/git.git` and the second command uses
91
+`FETCH_HEAD` to examine the branch with linkgit:git-log[1]. The fetched
92
+objects will eventually be removed by git's built-in housekeeping (see
93
+linkgit:git-gc[1]).
94
95
BUGS
96
----