What is the difference between git subtree merge and git-subtree

Viewed 5466

I've just found git-subtree tool that some time ago became a part of main git repo https://github.com/apenwarr/git-subtree/

However I don't fully understand what functionality does this tool provide over the already existing "git read-tree" + "git merge -s subtree". Is the only purpouse of git-subtree - making the resultant commit history look better or does it have more functionality that I've overlooked?

3 Answers

In addition to have more options, git subtree also takes into account Git configuration.

But regarding git subtree pull, make sure to use Git 2.36+

When git subtree wants to create a merge, it used "git merge"(man) and let it be affected by end-users "merge.ff" configuration, which has been corrected with Git 2.36 (Q2 2022).

See commit 9158a35 (01 Feb 2022) by Thomas Koutcher (koutcher).
(Merged by Junio C Hamano -- gitster -- in commit 0ac270c, 17 Feb 2022)

subtree: force merge commit

Signed-off-by: Thomas Koutcher
Reviewed-by: Johannes Altmanninger

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(man) to enforce this behaviour.

Related