Skip to content

Commit 359ff69

Browse files
newrengitster
authored andcommitted
pull: update docs & code for option compatibility with rebasing
git-pull.txt includes merge-options.txt, which is written assuming merges will happen. git-pull has allowed rebases for many years; update the documentation to reflect that. While at it, pass any `--signoff` flag through to the rebase backend too so that we don't have to document it as merge-specific. Rebase has supported the --signoff flag for years now as well. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 031e2f7 commit 359ff69

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

Documentation/git-merge.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ merge has resulted in conflicts.
6161

6262
OPTIONS
6363
-------
64+
:git-merge: 1
65+
6466
include::merge-options.txt[]
6567

6668
-m <msg>::

Documentation/git-pull.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ Incorporates changes from a remote repository into the current branch.
1919
If the current branch is behind the remote, then by default it will
2020
fast-forward the current branch to match the remote. If the current
2121
branch and the remote have diverged, the user needs to specify how to
22-
reconcile the divergent branches with `--no-ff`, `--ff`, or `--rebase`
23-
(or the corresponding configuration options in `pull.ff` or
24-
`pull.rebase`).
22+
reconcile the divergent branches with `--rebase` or `--no-rebase` (or
23+
the corresponding configuration option in `pull.rebase`).
2524

2625
More precisely, `git pull` runs `git fetch` with the given parameters
2726
and then depending on configuration options or command line flags,
28-
will call either `git merge` or `git rebase` to reconcile diverging
27+
will call either `git rebase` or `git merge` to reconcile diverging
2928
branches.
3029

3130
<repository> should be the name of a remote repository as
@@ -136,7 +135,7 @@ published that history already. Do *not* use this option
136135
unless you have read linkgit:git-rebase[1] carefully.
137136

138137
--no-rebase::
139-
Override earlier --rebase.
138+
This is shorthand for --rebase=false.
140139

141140
Options related to fetching
142141
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Documentation/merge-options.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
--no-commit::
33
Perform the merge and commit the result. This option can
44
be used to override --no-commit.
5+
ifdef::git-pull[]
6+
Only useful when merging.
7+
endif::git-pull[]
58
+
69
With --no-commit perform the merge and stop just before creating
710
a merge commit, to give the user a chance to inspect and further
@@ -39,6 +42,7 @@ set to `no` at the beginning of them.
3942
to `MERGE_MSG` before being passed on to the commit machinery in the
4043
case of a merge conflict.
4144

45+
ifdef::git-merge[]
4246
--ff::
4347
--no-ff::
4448
--ff-only::
@@ -47,6 +51,22 @@ set to `no` at the beginning of them.
4751
default unless merging an annotated (and possibly signed) tag
4852
that is not stored in its natural place in the `refs/tags/`
4953
hierarchy, in which case `--no-ff` is assumed.
54+
endif::git-merge[]
55+
ifdef::git-pull[]
56+
--ff-only::
57+
Only update to the new history if there is no divergent local
58+
history. This is the default when no method for reconciling
59+
divergent histories is provided (via the --rebase=* flags).
60+
61+
--ff::
62+
--no-ff::
63+
When merging rather than rebasing, specifies how a merge is
64+
handled when the merged-in history is already a descendant of
65+
the current history. If merging is requested, `--ff` is the
66+
default unless merging an annotated (and possibly signed) tag
67+
that is not stored in its natural place in the `refs/tags/`
68+
hierarchy, in which case `--no-ff` is assumed.
69+
endif::git-pull[]
5070
+
5171
With `--ff`, when possible resolve the merge as a fast-forward (only
5272
update the branch pointer to match the merged branch; do not create a
@@ -55,9 +75,11 @@ descendant of the current history), create a merge commit.
5575
+
5676
With `--no-ff`, create a merge commit in all cases, even when the merge
5777
could instead be resolved as a fast-forward.
78+
ifdef::git-merge[]
5879
+
5980
With `--ff-only`, resolve the merge as a fast-forward when possible.
6081
When not possible, refuse to merge and exit with a non-zero status.
82+
endif::git-merge[]
6183

6284
-S[<keyid>]::
6385
--gpg-sign[=<keyid>]::
@@ -73,6 +95,9 @@ When not possible, refuse to merge and exit with a non-zero status.
7395
In addition to branch names, populate the log message with
7496
one-line descriptions from at most <n> actual commits that are being
7597
merged. See also linkgit:git-fmt-merge-msg[1].
98+
ifdef::git-pull[]
99+
Only useful when merging.
100+
endif::git-pull[]
76101
+
77102
With --no-log do not list one-line descriptions from the
78103
actual commits being merged.
@@ -102,10 +127,17 @@ With --no-squash perform the merge and commit the result. This
102127
option can be used to override --squash.
103128
+
104129
With --squash, --commit is not allowed, and will fail.
130+
ifdef::git-pull[]
131+
+
132+
Only useful when merging.
133+
endif::git-pull[]
105134

106135
--no-verify::
107136
This option bypasses the pre-merge and commit-msg hooks.
108137
See also linkgit:githooks[5].
138+
ifdef::git-pull[]
139+
Only useful when merging.
140+
endif::git-pull[]
109141

110142
-s <strategy>::
111143
--strategy=<strategy>::
@@ -127,6 +159,10 @@ With --squash, --commit is not allowed, and will fail.
127159
default trust model, this means the signing key has been signed by
128160
a trusted key. If the tip commit of the side branch is not signed
129161
with a valid key, the merge is aborted.
162+
ifdef::git-pull[]
163+
+
164+
Only useful when merging.
165+
endif::git-pull[]
130166

131167
--summary::
132168
--no-summary::
@@ -166,3 +202,7 @@ endif::git-pull[]
166202
projects that started their lives independently. As that is
167203
a very rare occasion, no configuration variable to enable
168204
this by default exists and will not be added.
205+
ifdef::git-pull[]
206+
+
207+
Only useful when merging.
208+
endif::git-pull[]

builtin/pull.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,8 @@ static int run_rebase(const struct object_id *newbase,
893893
strvec_pushv(&args, opt_strategy_opts.v);
894894
if (opt_gpg_sign)
895895
strvec_push(&args, opt_gpg_sign);
896+
if (opt_signoff)
897+
strvec_push(&args, opt_signoff);
896898
if (opt_autostash == 0)
897899
strvec_push(&args, "--no-autostash");
898900
else if (opt_autostash == 1)

0 commit comments

Comments
 (0)