'Convert a git submodule into a normal folder with the same name causes trouble
We have a repo with a setup like this:
Main/
|--utilities/
Main and utilities are both git repos (not their actual names). Utilities was added to main as a submodule. We decided that utilities should not be a submodule, but instead should just be a normal subfolder within Main. The reason to use the same name is that users of Main don't have to change (include paths etc...).
So on a new branch we removed utilities like:
git submodule deinit -f utilities/
rm -rf .git/modules/utilities/
git rm -f utilities/
Committed this and then copied in utils as a folder (minus its .git files) and added this to the repo and committed that. All good so far
But now we want to merge in changes that other people have made in the meantime (they still have utils as a sub-repo and have even moved utils on). So basically git pull origin master.
Now we get errors like:
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
deleted by us: utilities
$ git add utilities/
error: unable to index file utilities
fatal: updating files failed
The only way I can think of to proceed would be to abandon my changes on this branch and start again - and suspend all other work on this repo until the changes are done.
My question is - what is the best way to go about converting a submodule into a folder of the same name (which I think really confuses git). I also feel that switching between versions before the change and after the change will be horrible (as the submodule folder won't always get removed etc...). Any tips/tricks here? - never had to do this before and I can't see examples of others doing it (yet).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
