git-merge-repo
Merge repository into subdirectory
TLDR
SYNOPSIS
git merge-repo url branch directory
DESCRIPTION
git merge-repo merges another repository into a subdirectory while preserving its full commit history. It is a thin wrapper around `git subtree add -P <directory> <repo> <branch>`, so the incoming history is grafted in rather than squashed away.Passing `.` as the directory is a special case: the repo is first added into a temporary subdirectory, then its files are moved up into the repository root (flattening it) instead of staying nested.The command is useful for incorporating external libraries, consolidating multiple repositories into a monorepo, or absorbing a project that was previously maintained separately.
PARAMETERS
URL
Repository URL to merge.BRANCH
Branch to merge from.DIRECTORY
Target subdirectory.--help
Display help information.
INSTALL
CAVEATS
Part of git-extras package. Requires `git subtree` to be available. May need conflict resolution if paths collide.
HISTORY
git merge-repo is part of git-extras, providing repository consolidation functionality for monorepo creation and library incorporation.
SEE ALSO
git-merge(1), git-subtree(1), git-extras(1)