How to get rid of gitdir reference in submodule?
Lets say I have this workflow:
- Has a git repo without submodules
- Just using
git clone
to clone another git repo inside - Afterwards adding the repo as submodule by doing
git add
on existing repo
In that case the tree structure is the following (lets call it Structure-no-gitdir-pointer)
- main_repo
- **.git/**
- some_files
- submodule
- **.git/** (note that this is a directory, containing all the info like branches, config, description, HEAD, hooks, index, ...)
- some_files
If I push the project and clone again with all the submodule, what I get is following (Lets say its Structure-with-gitdir-pointer):
- main_repo
- **.git/**
- some_files
- submodule
- *.git* (points to `gitdir: ../.git/modules/submodule/`)
- some_files
I would rather like to maintain Structure-no-gitdir-pointer in the cloned repo since I am doing some volume mapping with submodules and I lose all git references. (I don’t want to map the parent module itself).
Any way to do it more or less automatic?
I have found this thread (Migrating a submodule’s gitdir to ‘in-tree’) which concluded to do things manually, not a fan of that approach.