I'm working with a framework that more or less forces me to mix my own code in with framework code--that is, neither can be isolated neatly into its own subdirectory. I have thus far kept them separate by using .gitignore to ignore all framework code, but when I needed to upgrade the framework I created an upgrade branch, and did the upgrade, not initially realizing that this would mean previously untracked/ignored files would be tracked in the new branch, and therefore would no longer exist when I switched back to the master branch.
After recovering from the massive facepalm moment, I thought I'd have to switch to using Git Submodules. The problem this poses, however, is that it appears that code belonging to a submodule must be kept in a subdirectory. From Pro Git:
Submodules allow you to keep a Git repository as a subdirectory of another Git repository.
Is this truly a limitation of git submodules, or is there any way around it?