Add a parent directory to a git repositoy
6,324
Solution 1
Do it in separate steps:
- Create two new folders: C and Matlab.
- Move existing files from the current location into the C folder.
- Start adding new files in the Matlab folder.
Solution 2
Related videos on Youtube
Author by
fixer1234
Updated on September 17, 2022Comments
-
fixer1234 over 1 year
I have created a git repository for the C implementation of a program.
I am about to add a Matlab implementation and I would like to have a single repository with two subdirectories: one for the C and one for matlab.
Of course, I would like to keep the full history too!
What should I do?
-
AO_ almost 14 yearsThank you, I didn't thought of doing it this way!
-
DrColossos almost 14 yearsThat question is different - they are discussing how to combine two git repos into one.
-
maaartinus almost 12 years@user36354 You may want to consider "4. Run
git filter-branch
in order to pretend the files have always been in folder C." But this is a bit advanced and not really necessary (e.g.git blame
can follow the history to the original location).