Skip to content

Commit 9de14c7

Browse files
committed
Merge branch 'fc/advice-diverged-history'
After "git pull" that is configured with pull.rebase=false merge.ff=only fails due to our end having our own development, give advice messages to get out of the "Not possible to fast-forward" state. * fc/advice-diverged-history: advice: add diverging advice for novices
2 parents fc1a4ce + 765071a commit 9de14c7

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Documentation/config/advice.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,6 @@ advice.*::
136136
Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1]
137137
is asked to update index entries outside the current sparse
138138
checkout.
139+
diverging::
140+
Advice shown when a fast-forward is not possible.
139141
--

advice.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static struct {
4646
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge", 1 },
4747
[ADVICE_DETACHED_HEAD] = { "detachedHead", 1 },
4848
[ADVICE_SUGGEST_DETACHING_HEAD] = { "suggestDetachingHead", 1 },
49+
[ADVICE_DIVERGING] = { "diverging", 1 },
4950
[ADVICE_FETCH_SHOW_FORCED_UPDATES] = { "fetchShowForcedUpdates", 1 },
5051
[ADVICE_GRAFT_FILE_DEPRECATED] = { "graftFileDeprecated", 1 },
5152
[ADVICE_IGNORED_HOOK] = { "ignoredHook", 1 },
@@ -219,6 +220,14 @@ void NORETURN die_conclude_merge(void)
219220

220221
void NORETURN die_ff_impossible(void)
221222
{
223+
advise_if_enabled(ADVICE_DIVERGING,
224+
_("Diverging branches can't be fast-forwarded, you need to either:\n"
225+
"\n"
226+
"\tgit merge --no-ff\n"
227+
"\n"
228+
"or:\n"
229+
"\n"
230+
"\tgit rebase\n"));
222231
die(_("Not possible to fast-forward, aborting."));
223232
}
224233

advice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct string_list;
1919
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
2020
ADVICE_COMMIT_BEFORE_MERGE,
2121
ADVICE_DETACHED_HEAD,
22+
ADVICE_DIVERGING,
2223
ADVICE_SUGGEST_DETACHING_HEAD,
2324
ADVICE_FETCH_SHOW_FORCED_UPDATES,
2425
ADVICE_GRAFT_FILE_DEPRECATED,

0 commit comments

Comments
 (0)