Add a parent directory to a git repositoy

6,324

Solution 1

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.

Solution 2

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

Share:
6,324

Related videos on Youtube

fixer1234
Author by

fixer1234

Updated on September 17, 2022

Comments

  • fixer1234
    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_
    AO_ almost 14 years
    Thank you, I didn't thought of doing it this way!
  • DrColossos
    DrColossos almost 14 years
    That question is different - they are discussing how to combine two git repos into one.
  • maaartinus
    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).