I have the following folder structure:
foo/
foo/bar
foo/baz
foo/bee
I created a git repository on foo/bar/.git.
I realized later on that I needed to include all the other directories in foo in a git repository, so I created a git repository on foo/.git.
foo/.git
foo/bar/.git
foo/baz
foo/bee
I could just delete foo/bar/.git but I want to be able to keep the history of that git repository but within foo/.git instead of foo/bar/.git.
I was trying to read on submodules but if I understand correctly it is a way to integrate a version of an existing repository as a subtree of your own repository.
I'm not entirely sure this is what I need. I don't need to keep foo/bar/.git. I want the foo/.git to be my main repository. I just wanted to know if there was a way to keep or integrate the history of the foo/bar/.git within foo/.git so I could remove foo/bar/.git.
Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.
You are looking for subtree merging
Github's help has a good guide on this, and there's a chapter in Pro Git on this, same with the Git Community book
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With