๐ ๐๐ฟ๐ผ๐๐ฒ ๐๐ต๐ฒ ๐๐ฐ๐ฟ๐ถ๐ฝ๐ ๐๐ต๐ฎ๐ ๐๐ฎ๐ ๐๐๐ฝ๐ฝ๐ผ๐๐ฒ๐ฑ ๐๐ผ ๐ฝ๐ฟ๐ฒ๐๐ฒ๐ป๐ ๐๐ต๐ถ๐. ๐๐ ๐ฑ๐ฒ๐น๐ฒ๐๐ฒ๐ฑ ๐ฎ๐ต ๐ฟ๐ฒ๐ฎ๐น ๐ณ๐ถ๐น๐ฒ๐ ๐ฎ๐ป๐ฑ ๐ฐ๐ผ๐๐ ๐บ๐ฒ ๐๐ต๐ฒ ๐ฟ๐ฒ๐ฝ๐ผ.
The setup is the one most of us land on, because every step of it is sensible. Your Company Brain lives in Google Drive so it syncs everywhere. The desktop app makes it a normal folder. Your code ends up in there too, so the brain and the work sit together. Then you work from two machines and point AI agents at all of it.
Every choice is fine. Together they put ๐ฎ ๐ฑ๐ฎ๐๐ฎ๐ฏ๐ฎ๐๐ฒ ๐ถ๐ป๐๐ถ๐ฑ๐ฒ ๐ฎ ๐ณ๐ถ๐น๐ฒ ๐๐๐ป๐ฐ๐ฒ๐ฟ.
Here is the collision. Your git folder is a database. Google Drive does not merge conflicts, it renames them, adding a " 2" or a " (1)". It does that everywhere, including inside the git folder. Git never puts a space in its own internal filenames, so the moment Drive renames one, git cannot read its own history.
It never announces itself as a sync problem. It shows up as git having amnesia: "bad sha1 file", "badRefName", a missing object, or a push that just gets refused. Nothing hints that sync did it.
๐ก๐ผ๐ ๐๐ต๐ฒ ๐ฝ๐ฎ๐ฟ๐ ๐๐ต๐ฎ๐ ๐ฐ๐ผ๐๐ ๐บ๐ฒ ๐๐ต๐ฒ ๐ฟ๐ฒ๐ฝ๐ผ๐๐ถ๐๐ผ๐ฟ๐.
The obvious fix is a script that deletes every odd-looking file inside the git folder. I wrote that script. I was proud of it. It ran on every single commit.
What I did not know is that Drive sometimes renames the ORIGINAL rather than adding a copy beside it. So those "junk" files are sometimes your only copy of a real git object.
My clever cleanup deleted 29 of them. The repo could no longer rebuild its own history. Re-clone. The work survived only because it had been pushed.
๐ง๐ต๐ฒ ๐ฐ๐ผ๐ฟ๐ฟ๐ฒ๐ฐ๐ ๐ฟ๐๐น๐ฒ ๐ถ๐ ๐ผ๐ป๐ฒ ๐น๐ถ๐ป๐ฒ, ๐ฎ๐ป๐ฑ ๐ถ๐ ๐ถ๐ ๐๐ต๐ฒ ๐ผ๐ฝ๐ฝ๐ผ๐๐ถ๐๐ฒ ๐ผ๐ณ ๐๐ต๐ฎ๐ ๐๐๐๐ฎ๐น๐น๐ ๐ด๐ฒ๐๐ ๐๐ฟ๐ถ๐๐๐ฒ๐ป:
โข Suffixed file exists, original is MISSING, so ๐ฟ๐ฒ๐๐๐ผ๐ฟ๐ฒ ๐ถ๐. Drive renamed your original.
โข Suffixed file exists, original is there, so delete the duplicate. The original is fine.
Nothing inside the git folder gets deleted unless a correctly named file survives next to it.
And the habit that matters more than any script:
๐ง๐ต๐ฒ ๐ฟ๐ฒ๐บ๐ผ๐๐ฒ ๐ถ๐ ๐๐ต๐ฒ ๐๐ผ๐๐ฟ๐ฐ๐ฒ ๐ผ๐ณ ๐๐ฟ๐๐๐ต. ๐ง๐ต๐ฒ ๐๐๐ป๐ฐ๐ฒ๐ฑ ๐ณ๐ผ๐น๐ฑ๐ฒ๐ฟ ๐ถ๐ ๐ฎ ๐ฟ๐ฒ๐ฝ๐น๐ฎ๐ฐ๐ฒ๐ฎ๐ฏ๐น๐ฒ ๐๐ถ๐ฒ๐ ๐ผ๐ณ ๐ถ๐. ๐ก๐ผ๐๐ต๐ถ๐ป๐ด ๐ถ๐ฟ๐ฟ๐ฒ๐ฝ๐น๐ฎ๐ฐ๐ฒ๐ฎ๐ฏ๐น๐ฒ ๐ฒ๐๐ฒ๐ฟ ๐น๐ถ๐๐ฒ๐ ๐ผ๐ป๐น๐ ๐ถ๐ป ๐๐ต๐ฎ๐ ๐ณ๐ผ๐น๐ฑ๐ฒ๐ฟ.
Hold that and corruption costs you thirty seconds. Break it and corruption costs you work. Also, never run git gc, git prune or git repack on a repo you think is damaged. Those turn a recoverable repository into a lost one.
So I packaged the whole fix and wrote it up, so nobody else has to learn it the way I did.
๐ง๐ต๐ฒ ๐ด๐๐ถ๐ฑ๐ฒ ๐ต๐ฎ๐ ๐ฎ ๐ฑ๐ผ๐๐ป๐น๐ผ๐ฎ๐ฑ ๐ฏ๐๐๐๐ผ๐ป. It gives you one folder, git-in-drive, containing:
โข ๐ง๐ต๐ฒ ๐๐ธ๐ถ๐น๐น ๐ถ๐๐๐ฒ๐น๐ณ. Drop it in your agent's skills folder, say "use git-in-drive on this repo", and it runs the six-step install and reports back on each step.
โข ๐ ๐ณ๐ถ๐น๐น-๐ถ๐ป-๐๐ต๐ฒ-๐ฏ๐น๐ฎ๐ป๐ธ๐ ๐ฝ๐ฟ๐ผ๐บ๐ฝ๐, for any tool that cannot load skills. Three blanks, paste, done.
โข ๐ง๐ต๐ฒ ๐๐ฟ๐ถ๐๐๐ฒ๐ป ๐ฆ๐ข๐ฃ, ready to drop into your own Company Brain.
โข ๐ง๐ต๐ฟ๐ฒ๐ฒ ๐๐ฐ๐ฟ๐ถ๐ฝ๐๐: the cleaner that restores instead of deleting, a session check that tells you whether your folder actually matches your remote, and a safe reset for when it does not.
โข ๐๐ผ๐๐ฟ ๐ด๐ถ๐ ๐ต๐ผ๐ผ๐ธ๐. These are the ones that matter, because git runs hooks no matter which tool started the command. They cover Claude Code, Codex, Cursor, your IDE, and you.
Plain bash and git. Nothing to install, no dependencies. The same fix works on OneDrive, Dropbox and Box, because they all resolve conflicts by renaming.
๐๐ผ ๐๐ต๐ถ๐ ๐ผ๐ป๐ฒ ๐๐ต๐ถ๐ป๐ด ๐ฒ๐๐ฒ๐ป ๐ถ๐ณ ๐๐ผ๐ ๐ฟ๐ฒ๐ฎ๐ฑ ๐ป๐ผ๐๐ต๐ถ๐ป๐ด ๐ฒ๐น๐๐ฒ. The guide has a five-line test that renames a real git object and then checks that your guardrail puts it back. Run it. If your cleanup deletes that file instead of restoring it, you are running the version that loses repositories, and you would much rather learn that on a Tuesday than during an incident.
About three minutes per repo, and then it is handled on every machine.
If your repo lives in Drive, go run the test and tell me what it said. I am curious how many of you are one sync away from a bad morning.