Assuming you have two git repositories monorepo
, and my-project
and want to add my-project
to monorepo/projects/my-project
:
cd my-project
git filter-branch --index-filter '
git ls-files -s |
sed "s, ,&'"projects/my-project/"'," |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&