Перейти к содержанию

Git subtree

Git subtree announcement by its author Avery Pennarun

Quote

My earlier tool, git-subtree takes a different approach, avoiding submodule links entirely and merging submodule content directly into the parent repo.

This solves all three of the problems above, but it makes submitting your changes back upstream more complex, because you have to split them out again and regenerate the original submodule history. It also gets confused when you move the linked subtrees around in your repository, because they just look like files being moved around, not the history of those files. Still, you might like git-subtree too.

There are some discussions around about the pros and cons of submodules vs subtrees, such as this pretty good one from Atlassian.

Git subtree tutorial by Atlassian

“Vendor branch” in a git monorepo

How to use the subtree merge strategy