I have a program divided into 3 packages. I have set up a local repo in one of the packages and set it up to push to a repo on gitHub. I have started work on the second package and I realized I haven't initialized it with git. I wanted to use the same gitHub repo to push the second package to but I'm not sure it will work since I have already set up my first package to push to it. I think I should have done git init on the parent folder of the three packages and then the folder/package structure would have shown up on my gitHub repo. Is there a simple way to fix this? Thanks!
I need git to include the parent directory
1.5k Views Asked by ponder275 At
2
Let's say your parent directory is named
parent
, and your child directories are namedpackage1
,package2
, andpackage3
. Let's also assume thatpackage1
is the directory where you have your git repository. I would just make anotherpackage1
directory as a child of the originalpackage1
directory, and move the contents of the originalpackage1
directory into it. Then movepackage2
andpackage3
to be children of the originalpackage1
. You can the rename the originalpackage1
to parent.git add --all .
the whole thing, and you now have a repo with all three directories. The cool thing is that you will not lose the history of all the files you moved; git is smart enough to detect renames/moves.