You can do what you are describing like this:
-
Move the content of
ABC
to anABC/
subdirectory, and fix the history so that it looks like it has always been there:$ cd /path/to/ABC $ git filter-branch --index-filter \ 'git ls-files -s | sed "s-\t-&ABC/-" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new \ git update-index --index-info && mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Now your directory structure is
ABC/ABC/your_code
-
Same for the content of
DEF
:$ cd /path/to/DEF $ git filter-branch --index-filter \ 'git ls-files -s | sed "s-\t-&DEF/-" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new \ git update-index --index-info && mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Now your directory structure is
DEF/DEF/your_code
-
Finally, create the
PPP
repository and pull bothABC
andDEF
into it:$ mkdir /path/to/PPP $ cd /path/to/PPP $ git init $ git pull /path/to/ABC $ git pull /path/to/DEF
Now you have
PPP/ABC/your_code
andPPP/DEF/your_code
, along with all the history.
You should probably ask you collegues to run the previous commands on their system, in order for everyone to be synchronized.
Note: the funky
filter-branch
commands come from the man page. 🙂