1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 16:22:08 +02:00
tldr/pages/common/git-subtree.md
Vitor Henrique c8f956319f
pages*: simplify page description (#12149)
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2024-02-14 21:25:13 +01:00

871 B

git subtree

Manage project dependencies as subprojects. More information: https://manpages.debian.org/latest/git-man/git-subtree.1.html.

  • Add a Git repository as a subtree:

git subtree add --prefix={{path/to/directory/}} --squash {{repository_url}} {{branch_name}}

  • Update subtree repository to its latest commit:

git subtree pull --prefix={{path/to/directory/}} {{repository_url}} {{branch_name}}

  • Merge recent changes up to the latest subtree commit into the subtree:

git subtree merge --prefix={{path/to/directory/}} --squash {{repository_url}} {{branch_name}}

  • Push commits to a subtree repository:

git subtree push --prefix={{path/to/directory/}} {{repository_url}} {{branch_name}}

  • Extract a new project history from the history of a subtree:

git subtree split --prefix={{path/to/directory/}} {{repository_url}} -b {{branch_name}}