git-subtree
Merge and split repositories using subdirectories
TLDR
Add subtree
$ git subtree add --prefix=[dir] [repo] [branch]
Pull subtree changes$ git subtree pull --prefix=[dir] [repo] [branch]
Push subtree changes$ git subtree push --prefix=[dir] [repo] [branch]
Split subtree$ git subtree split --prefix=[dir] -b [new_branch]
Merge subtree$ git subtree merge --prefix=[dir] [commit]
SYNOPSIS
git subtree command [options]
DESCRIPTION
git subtree merges and splits repositories into subdirectories, providing an alternative to submodules. Unlike submodules, subtrees keep everything in a single repository with a unified history.
The `split` command extracts the history of a subdirectory into a separate branch, while `add`, `pull`, and `push` manage the ongoing synchronization with the upstream repository.
PARAMETERS
--prefix dir
Subdirectory for subtree.--squash
Squash history.-b branch
Branch name for split.
SUBCOMMANDS
add
Add repository as subtree.pull
Pull subtree changes.push
Push subtree changes.merge
Merge subtree changes.split
Extract subtree history.
SEE ALSO
git-submodule(1), git-merge(1)

