My suggestion was to keep one repo with the docs and a separate repo with the code, and zero intersection.
I teletransported commits from one repo to another with "git format-patch" and "git am" or something like that. I never remember the magic spell. If you do that too often, you may automate it in a script.