Options (2)
-P, --prefixbooleanAdd a Git repository as a subtree and squash the commits together
Example:
git subtree add {{[-P|--prefix]}} {{path/to/directory}} --squash {{repository_url}} {{branch_name}}-b, --branchbooleanExtract a new project history from the history of a subtree
Example:
git subtree split {{[-P|--prefix]}} {{path/to/directory}} {{repository_url}} {{[-b|--branch]}} {{branch_name}}Examples (5)
Add a Git repository as a subtree and squash the commits together
git subtree add [-P|--prefix] path/to/directory --squash repository_url branch_nameUpdate subtree repository to its latest commit
git subtree pull [-P|--prefix] path/to/directory repository_url branch_nameMerge recent changes up to the latest subtree commit into the subtree
git subtree merge [-P|--prefix] path/to/directory --squash repository_url branch_namePush commits to a subtree repository
git subtree push [-P|--prefix] path/to/directory repository_url branch_nameExtract a new project history from the history of a subtree
git subtree split [-P|--prefix] path/to/directory repository_url [-b|--branch] branch_namemade by @shridhargupta | data from tldr-pages