I have a repository for a_project
with git repository set up, but I just realized that in a sub-directory of a_project/src
, I have another git repository. I'd like to merge a_project/src
's .git
data (history, branches, etc.) into that of a_project
.
My purpose to merge them together is that I noticed that I cannot commit changes to files in src
. The changes cannot be staged:
Unstaged changes (1)
modified src/snmp_trap_processing
@@ -1 +1 @@
-Subproject commit 99ef96f28d4f74bc671ca6b2da97ecf50b84f833
+Subproject commit 581414eecb3db4bc1e572d57d1d1f8788675c372
I've studied in StackOverflow. The closest case is to move a repository from a subdirectory to the parent. But where the parent has no existing git repository tracking, for example, https://stackoverflow.com/a/3247756/126164
The instruction there, in my case, a_project/src
's .git
will destroy the .git
tracking at the parent directory, a_project
.
So I wonder if there is a way to merge between the two .git
instead of overriding one .git
over the other?
EDIT:
I realize that in a_project/src
the .git
is just a file with the content below:
cat .git
gitdir: ../../.git/modules/src
So it might not be as complicated as I thought. Maybe, I can just remove the a_project/src/.git
then it will be fine?
Maybe, also remove the submodule setup for a_project/src
in a_project/.git
?