Skip to content

Commit

Permalink
subtree: force merge commit
Browse files Browse the repository at this point in the history
When `merge.ff` is set to `only` in .gitconfig, `git subtree pull` will
fail with error `fatal: Not possible to fast-forward, aborting.`, but
the command does want to make merges in these places. Add `--no-ff`
argument to `git merge` to enforce this behaviour.

Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Koutcher <thomas.koutcher@online.fr>
  • Loading branch information
koutcher committed Nov 14, 2021
1 parent 5fbd2fc commit 765fea3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/subtree/git-subtree.sh
Expand Up @@ -976,10 +976,10 @@ cmd_merge () {

if test -n "$arg_addmerge_message"
then
git merge -Xsubtree="$arg_prefix" \
git merge --no-ff -Xsubtree="$arg_prefix" \
--message="$arg_addmerge_message" "$rev"
else
git merge -Xsubtree="$arg_prefix" $rev
git merge --no-ff -Xsubtree="$arg_prefix" $rev
fi
}

Expand Down

0 comments on commit 765fea3

Please sign in to comment.