Answer the question
In order to leave comments, you need to log in
How to submodule an existing part of a GIT repository?
How to connect an external repo as a submodule to an existing repository is more or less clear:
$ git submodule add [email protected]:schacon/rack.git rack
Answer the question
In order to leave comments, you need to log in
I don't want to delete the partition, commit without it and connect the external repo in order to restore the partition.
As @DmitriyEntelis wrote "delete the partition, commit without it, and link the external repo in order to restore the partition." this is the only way, but if we want to save the history of the selected part of the project, we can do the following:
git clone <git repository A url>
cd <git repository A directory>
git remote rm origin
git filter-branch --subdirectory-filter <directory 1> -- --all
mkdir <directory 1>
mv * <directory 1>
git add .
git commit
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question