Skip to content

Commit ab9b313

Browse files
author
Junio C Hamano
committed
Documentation: multi-head fetch.
Add documentation related to multi-head work, including $GIT_DIR/remotes/ changes. Signed-off-by: Junio C Hamano <[email protected]>
1 parent ff27adf commit ab9b313

File tree

8 files changed

+170
-63
lines changed

8 files changed

+170
-63
lines changed

Documentation/git-fetch-script.txt

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
git-fetch-script(1)
22
===================
3-
v0.99.4, Aug 2005
3+
v0.99.5, Aug 2005
44

55
NAME
66
----
@@ -9,24 +9,17 @@ git-fetch-script - Download objects and a head from another repository.
99

1010
SYNOPSIS
1111
--------
12-
'git-fetch-script' <repository> [ <head> | tag <tag> ]
12+
'git-fetch-script' <repository> <refspec>...
1313

1414

1515
DESCRIPTION
1616
-----------
17-
Fetches a named head or a tag from another repository, along
18-
with the objects necessary to complete that head or tag. The
19-
head to pull defaults to HEAD if unspecified. The head or tag
20-
fetched from the remote repository is stored in
21-
$GIT_DIR/FETCH_HEAD.
22-
23-
When a <tag> is specified, the <tag> fetched from the remote is
24-
also copied to the local $GIT_DIR/tags/<tag> file. When no
25-
<head> nor <tag> is specified, and <repository> was specified
26-
with the short-hand notation (i.e. naming a file under the
27-
$GIT_DIR/branches directory), the head fetched from the remote
28-
repository is also copied to the local $GIT_DIR/heads/<repository>
29-
file.
17+
Fetches named heads or tags from another repository, along with
18+
the objects necessary to complete them.
19+
20+
The ref names and their object names of fetched refs are stored
21+
in $GIT_DIR/FETCH_HEAD. This information is left for a later merge
22+
operation done by "git resolve" or "git octopus".
3023

3124

3225
OPTIONS

Documentation/git-octopus-script.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
git-octopus-script(1)
2+
=====================
3+
v0.99.5, Aug 2005
4+
5+
NAME
6+
----
7+
git-octopus-script - Merge more than two commits.
8+
9+
10+
SYNOPSIS
11+
--------
12+
'git-octopus'
13+
14+
DESCRIPTION
15+
-----------
16+
After running 'git fetch', $GIT_DIR/FETCH_HEAD contains the
17+
following information, one line per remote ref:
18+
19+
------------------------------------------------
20+
<object name> <ref name> from <repository>
21+
------------------------------------------------
22+
23+
Using this information, create and commit an Octopus merge on
24+
top of the current HEAD.
25+
26+
27+
Author
28+
------
29+
Written by Junio C Hamano <[email protected]>
30+
31+
32+
Documentation
33+
--------------
34+
Documentation by Junio C Hamano and the git-list <[email protected]>.
35+
36+
GIT
37+
---
38+
Part of the link:git.html[git] suite
39+

Documentation/git-pull-script.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ git-pull-script - Pull and merge from another repository.
99

1010
SYNOPSIS
1111
--------
12-
'git-pull-script' <repository> [ <head> | tag <tag> ]
12+
'git-pull-script' <repository> <refspec>...
1313

1414

1515
DESCRIPTION
1616
-----------
17-
Runs 'git-fetch-script' with the given parameters, then
18-
'git-resolve-script' to merge the local HEAD and FETCH_HEAD.
17+
Runs 'git-fetch-script' with the given parameters.
18+
19+
When only one ref is downloaded, runs 'git resolve' to merge it
20+
into the local HEAD. Otherwise uses 'git octopus' to merge them
21+
into the local HEAD.
1922

2023

2124
OPTIONS

Documentation/git-push-script.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,23 @@ git-push-script(1)
33

44
NAME
55
----
6-
git-push-script - Some git command not yet documented.
6+
git-push-script - Update remote refs along with associated objects.
77

88

99
SYNOPSIS
1010
--------
11-
'git-push-script' [ --option ] <args>...
11+
'git-push-script' [--all] [--force] <repository> <refspec>...
1212

1313
DESCRIPTION
1414
-----------
15-
Does something not yet documented.
15+
16+
Updates remote refs using local refs, while sending objects
17+
necessary to complete the given refs.
1618

1719

1820
OPTIONS
1921
-------
20-
--option::
21-
Some option not yet documented.
22-
23-
<args>...::
24-
Some argument not yet documented.
22+
include::pull-fetch-param.txt[]
2523

2624

2725
Author

Documentation/git-resolve-script.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
git-resolve-script(1)
22
=====================
3-
v0.99.4, Aug 2005
3+
v0.99.5, Aug 2005
44

55
NAME
66
----
7-
git-resolve-script - Script used to merge two trees
7+
git-resolve-script - Merge two commits
88

99

1010
SYNOPSIS
1111
--------
12-
'git-resolve-script'
12+
'git resolve' <current> <merged> <message>
1313

1414
DESCRIPTION
1515
-----------
16-
This script is used by Linus to merge two trees.
16+
Given two commits and a merge message, merge the <merged> commit
17+
into <current> commit, with the commit log message <message>.
18+
19+
When <current> is a descendant of <merged>, or <current> is an
20+
ancestor of <merged>, no new commit is created and the <message>
21+
is ignored. The former is informally called "already up to
22+
date", and the latter is often called "fast forward".
1723

1824

1925
Author

Documentation/git-send-pack.txt

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ git-send-pack - Push missing objects packed.
99

1010
SYNOPSIS
1111
--------
12-
'git-send-pack' [--all] [--exec=<git-receive-pack>] [<host>:]<directory> [<head>...]
12+
'git-send-pack' [--all] [--force] [--exec=<git-receive-pack>] [<host>:]<directory> [<ref>...]
1313

1414
DESCRIPTION
1515
-----------
1616
Invokes 'git-receive-pack' on a possibly remote repository, and
17-
updates it from the current repository, sending named heads.
17+
updates it from the current repository, sending named refs.
1818

1919

2020
OPTIONS
@@ -29,6 +29,13 @@ OPTIONS
2929
Instead of explicitly specifying which refs to update,
3030
update all refs that locally exist.
3131

32+
--force::
33+
Usually, the command refuses to update a remote ref that
34+
is not an ancestor of the local ref used to overwrite it.
35+
This flag disables the check. What this means is that
36+
the remote repository can lose commits; use it with
37+
care.
38+
3239
<host>::
3340
A remote host to house the repository. When this
3441
part is specified, 'git-receive-pack' is invoked via
@@ -37,7 +44,7 @@ OPTIONS
3744
<directory>::
3845
The repository to update.
3946

40-
<head>...:
47+
<ref>...:
4148
The remote refs to update.
4249

4350

@@ -48,24 +55,25 @@ There are three ways to specify which refs to update on the
4855
remote end.
4956

5057
With '--all' flag, all refs that exist locally are transfered to
51-
the remote side. You cannot specify any '<head>' if you use
58+
the remote side. You cannot specify any '<ref>' if you use
5259
this flag.
5360

54-
Without '--all' and without any '<head>', the refs that exist
61+
Without '--all' and without any '<ref>', the refs that exist
5562
both on the local side and on the remote side are updated.
5663

57-
When '<head>'s are specified explicitly, it can be either a
64+
When '<ref>'s are specified explicitly, it can be either a
5865
single pattern, or a pair of such pattern separated by a colon
5966
':' (this means that a ref name cannot have a colon in it). A
6067
single pattern '<name>' is just a shorthand for '<name>:<name>'.
68+
6169
Each pattern pair consists of the source side (before the colon)
62-
and the destination side (after the colon). The ref that is
70+
and the destination side (after the colon). The ref to be
6371
pushed is determined by finding a match that matches the source
6472
side, and where it is pushed is determined by using the
6573
destination side.
6674

67-
- It is an error if <src> does not match exactly one of local
68-
refs.
75+
- It is an error if <src> does not match exactly one of the
76+
local refs.
6977

7078
- It is an error if <dst> matches more than one remote refs.
7179

@@ -78,6 +86,17 @@ destination side.
7886
exist in the set of remote refs; the ref matched <src>
7987
locally is used as the name of the destination.
8088

89+
Without '--force', the <src> ref is stored at the remote only if
90+
<dst> does not exist, or <dst> is a proper subset (i.e. an
91+
ancestor) of <src>. This check, known as "fast forward check",
92+
is performed in order to avoid accidentally overwriting the
93+
remote ref and lose other peoples' commits from there.
94+
95+
With '--force', the fast forward check is disabled for all refs.
96+
97+
Optionally, a <ref> parameter can be prefixed with a plus '+' sign
98+
to disable the fast-forward check only on that ref.
99+
81100

82101
Author
83102
------

Documentation/git.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,16 @@ link:git-fetch-script.html[git-fetch-script]::
208208
link:git-pull-script.html[git-pull-script]::
209209
Fetch from and merge with a remote repository.
210210

211-
ulink:git-commit-script.html[git-commit-script]::
211+
link:git-resolve-script.html[git-resolve-script]::
212+
Merge two commits.
213+
214+
link:git-octopus-script.html[git-octopus-script]::
215+
Merge more than two commits.
216+
217+
link:git-push-script.html[git-push-script]::
218+
Update remote refs along with associated objects.
219+
220+
link:git-commit-script.html[git-commit-script]::
212221
Record changes to the repository.
213222

214223
link:git-show-branch.html[git-show-branch]::
@@ -240,9 +249,6 @@ link:git-merge-one-file-script.html[git-merge-one-file-script]::
240249
link:git-prune-script.html[git-prune-script]::
241250
Prunes all unreachable objects from the object database
242251

243-
link:git-resolve-script.html[git-resolve-script]::
244-
Script used to merge two trees
245-
246252
link:git-tag-script.html[git-tag-script]::
247253
An example script to create a tag object signed with GPG
248254

@@ -316,9 +322,6 @@ link:git-get-tar-commit-id.html[git-get-tar-commit-id]::
316322
link:git-patch-id.html[git-patch-id]::
317323
git-patch-id.
318324

319-
link:git-push-script.html[git-push-script]::
320-
git-push-script.
321-
322325
link:git-rebase-script.html[git-rebase-script]::
323326
git-rebase-script.
324327

Documentation/pull-fetch-param.txt

Lines changed: 63 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,67 @@
1616
Local directory
1717
/path/to/repo.git/
1818

19-
In addition to that, as a short-hand, the name of a file
20-
in $GIT_DIR/branches directory can be specified; the
21-
named file should contain a single line, a URL in one of
22-
the above formats, optionally followed by a hash '#' and
23-
the name of remote head.
24-
25-
<head>::
26-
The remote head name to fetch from. That is, make the
27-
objects reachable from the commit recorded in
28-
$GIT_DIR/refs/heads/<head> in the remote repository
29-
available locally.
30-
31-
tag <tag>::
32-
The remote head tag to fetch from. That is, make the
33-
objects reachable from the commit recorded in
34-
$GIT_DIR/refs/tags/<tag> in the remote repository
35-
available locally.
19+
In addition to the above, as a short-hand, the name of a
20+
file in $GIT_DIR/remotes directory can be given; the
21+
named file should be in the following format:
3622

23+
URL: one of the above URL format
24+
Push: <refspec>...
25+
Pull: <refspec>...
26+
27+
When such a short-hand is specified in place of
28+
<repository> without <refspec> parameters on the command
29+
line, <refspec>... specified on Push lines or Pull lines
30+
are used for "git push" and "git fetch/pull",
31+
respectively.
32+
33+
The name of a file in $GIT_DIR/branches directory can be
34+
specified as an older notation short-hand; the named
35+
file should contain a single line, a URL in one of the
36+
above formats, optionally followed by a hash '#' and the
37+
name of remote head (URL fragment notation).
38+
$GIT_DIR/branches/<remote> file that stores a <url>
39+
without the fragment is equivalent to have this in the
40+
corresponding file in the $GIT_DIR/remotes/ directory
41+
42+
URL: <url>
43+
Pull: refs/heads/master:<remote>
44+
45+
while having <url>#<head> is equivalent to
46+
47+
URL: <url>
48+
Pull: refs/heads/<head>:<remote>
49+
50+
<refspec>::
51+
The canonical format of a <refspec> parameter is
52+
+?<src>:<dst>; that is, an optional plus '+', followed
53+
by the source ref, followed by a colon ':', followed by
54+
the destination ref.
55+
56+
When used in "git push", the <src> side can be an
57+
arbitrary "SHA1 expression" that can be used as an
58+
argument to "git-cat-file -t". E.g. "master~4" (push
59+
four parents before the current master head).
60+
61+
For "git push", the local ref that matches <src> is used
62+
to fast forward the remote ref that matches <dst>. If
63+
the optional plus '+' is used, the remote ref is updated
64+
even if it does not result in a fast forward update.
65+
66+
For "git fetch/pull", the remote ref that matches <src>
67+
is fetched, and if <dst> is not empty string, the local
68+
ref that matches it is fast forwarded using <src>.
69+
Again, if the optional plus '+' is used, the local ref
70+
is updated even if it does not result in a fast forward
71+
update.
72+
73+
Some short-cut notations are also supported.
74+
75+
* For backward compatibility, "tag" is almost ignored;
76+
it just makes the following parameter <tag> to mean a
77+
refspec "refs/tags/<tag>:refs/tags/<tag>".
78+
79+
* A parameter <ref> without a colon is equivalent to
80+
<ref>: when pulling/fetching, and <ref>:<ref> when
81+
pushing. That is, do not store it locally if
82+
fetching, and update the same name if pushing.

0 commit comments

Comments
 (0)