Git merge several repos

There are many ways to do it.

One way is:

– Clone old-repo1 to local machine

– Move everything to old-repo1/old-repo1

– Go to new directory

– Git remote add old-repo1 ../old-repo1

– Git pull old-repo1 master

 

There is always a hard step. I use the following script to move old files to its sub directory


for file in $(find . -maxdepth 1 -type d -not -name '.*'); do git mv $file $(echo $file | sed -e 's/^/sub_dir\//'); done

for file in $(find . -maxdepth 1 -type f); do git mv $file $(echo $file | sed -e 's/^/sub_dir\//'); done

Advertisements
Standard