GIT-SUBTREE(1) Git Manual GIT-SUBTREE(1) (NAME) git-subtree - (SYNOPSIS) git subtree [] -P [-S[]] add git subtree [] -P [-S[]] add git subtree [] -P [-S[]] merge [] git subtree [] -P [-S[]] split [] git subtree [] -P [-S[]] pull git subtree [] -P [-S[]] push (DESCRIPTION) (subtrees) . . (submodules) . ( .gitmodules gitlinks) . . (subtree merge strategy) . . . (split) . . . . . . git subtree . (COMMANDS) add , add . . --squash, . merge [] . git merge . --squash, . --squash v2.5 v2.4 . . --squash, --squash (annotated tag) . . split [] [] HEAD . ( ) . . . HEAD . ( ) split ( --annotate) . git merge . --squash . . pull merge git pull . push [+][:] split git push . . split, HEAD . + . (OPTIONS FOR ALL COMMANDS) -q, --quiet stderr . -d, --debug stderr . -P , --prefix= . . -S[], --gpg-sign[=], --no-gpg-sign GPG . keyid --no-gpg-sign --gpg-sign . ADD MERGE (: PULL SPLIT --REJOIN PUSH --REJOIN) add merge pull ( merge ) split --rejoin ( add merge ) push --rejoin ( split --rejoin ) . --squash . (log) . v1.0 v1.1 . --squash . . --squash, . git subtree merge --squash . --squash . -m , --message= . SPLIT (: PUSH) split push ( split ) . --annotate= . . . . git subtree --rejoin . -b , --branch= . . . --ignore-joins --rejoin git subtree --rejoin . --ignore-joins . . --onto= git subtree git subtree . git subtree . git subtree add . --rejoin . --rejoin . ( ). git log ( ) . --squash split --rejoin --squash . . ADD . git-subtree git-extensions ~/git-extensions/ : $ git subtree add --prefix=git-subtree --squash \ git://github.com/apenwarr/git-subtree.git master master . --squash . git-extensions ~/git-extensions/git-subtree master git://github.com/apenwarr/git-subtree.git . . COMMIT MERGE PULL git . git.git : $ git clone git://git.kernel.org/pub/scm/git/git.git test-git $ cd test-git gitweb ( 1130ef3) 0a8f4f0 git . gitweb . : $ git subtree split --prefix=gitweb --annotate='(split) ' \ 0a8f4f0^.. --onto=1130ef3 --rejoin \ --branch gitweb-latest $ gitk gitweb-latest $ git push git@github.com:whatever/gitweb.git gitweb-latest:master ( 0a8f4f0^.. << 0a8f4f0 0a8f4f0>> .) gitweb git subtree add ( --rejoin ) : $ git subtree split --prefix=gitweb --annotate='(split) ' --rejoin \ --branch gitweb-latest2 : $ git subtree pull --prefix=gitweb \ git@github.com:whatever/gitweb.git master --squash gitweb : $ git subtree merge --prefix=gitweb --squash gitweb-latest~10 : $ date >gitweb/myfile $ git add gitweb/myfile $ git commit -m 'created myfile' (fast-forward) : $ git subtree merge --prefix=gitweb --squash gitweb-latest : $ ls -l gitweb/myfile gitweb : git log gitweb-latest..$(git subtree split --prefix=gitweb) . lib . : : $ $ git init --bare : $ git subtree split --prefix=lib --annotate="(split)" -b split : $ git push split:master (AUTHOR) Avery Pennarun GIT git(1) (NOTES) 1. apenwarr@gmail.com mailto:apenwarr@gmail.com Git 2.55.0 2026-06-29 GIT-SUBTREE(1)