Skip to content

Instantly share code, notes, and snippets.

@vovateleport
Created September 4, 2019 07:31
Show Gist options
  • Save vovateleport/252337d9b9627a9838f821ca3b7b8567 to your computer and use it in GitHub Desktop.
Save vovateleport/252337d9b9627a9838f821ca3b7b8567 to your computer and use it in GitHub Desktop.
How to merge git repos into one
mkdir projTotal
cd projTotal
git init
git commit --allow-empty -m "Initial commit"
#add any number of projects
git remote add -f proj [email protected]
git merge --allow-unrelated-histories proj/master
mkdir subProj
ls -a -1 > proj.files
vim proj.files
#remove manually subProj, proj.files, .git, ., ..
for f in $(cat proj.files); do git mv $f subProj; done
rm proj.files
git commit -a -m "Move proj files to subdir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment