I have a repo with a few branches. On one of them I deleted a directory, which does not really belong to the repo and added it back as a git submodule.
That's what I do:
- Clone the repo
- Switch to the branch with the submodule in GitHub Desktop
git submodule init
- Until now I can switch the branches (between the ones with the submodule and no submodule without any issues).
git submodule update
to finally get the "content" of the submodule
So everything is right until I try to switch the branch in GitHub Desktop (to another branch without any git submodules). If I do so I get a checkout error claiming I have uncommitted changes:
Failed to checkout the branch
The following files in your working directory would be overwritten by a checkout: [...] Please commit your changes before you can switch branches.
However as I said I did not changed anything - the only thing I did was updating my submodules.
git status
shows everything is all right:
$ git status
On branch patch-submodule
Your branch is up-to-date with 'origin/patch-submodule'.
nothing to commit, working directory clean
When I deinit
my submodules I can also switch the branches again.
So what's wrong here? And how can I prevent this error or get around it?