5

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?

2 Answers 2

5

Do it in separate steps:

  1. Create two new folders: C and Matlab.
  2. Move existing files from the current location into the C folder.
  3. Start adding new files in the Matlab folder.
2
  • Thank you, I didn't thought of doing it this way!
    – user36354
    May 6, 2010 at 20:08
  • @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).
    – maaartinus
    Jun 10, 2012 at 10:50
1

https://stackoverflow.com/questions/614229/can-i-move-the-git-directory-for-a-repo-to-its-parent-directory/614254

1
  • 2
    That question is different - they are discussing how to combine two git repos into one. Jul 27, 2010 at 15:03

You must log in to answer this question.