Your files
Git and your Magic Boxes
Mac
Keep Magic Boxes outside your code repositories, back a box up with git, and the git commands that fight the app.
Checked against the app on 25 October 2026
A Magic Box belongs outside your code, the way a git worktree lives outside your main checkout: in its own folder beside the repository, kept for good. A box can still be backed up with git — as a repository of its own.
Keep boxes outside your code repositories
Inside a code repository, git sees the box’s files as untracked changes, and a checkout, reset, stash or clean can rewrite or delete them while the app is using them. Ignoring the folder doesn’t make it safe: git clean -x deletes ignored files, git stash --all sweeps them away, and switching branches overwrites them. A git worktree is safe in an ignored folder because it has its own .git, and git clean leaves those alone — a Magic Box has none.
So imb boxes create refuses a place inside a git repository and suggests the folder beside it. New Magic Box in the app still lets you choose one, and shows a warning.
The setup that works:
- One box per repository, beside it. For a repository at
~/code/myapp, the box goes in~/code/— outside the repository and every worktree of it. - The repository points at its box.
imb boxes create --repowrites one line into the repository’s own git settings (imb.box). Every worktree reads it, nothing commits it, and a teammate’s copy of the repository never gets it. - Or a box you already have. The same line can name a box you keep elsewhere, outside every code repository —
git config imb.box <id>, with the id fromimb boxes --json. - Agents reach it from anywhere in the repository with
imb --repo. See Install Idea Magic Box with an agent. - Nothing to add to
.gitignore— nothing of the box is inside the repository. If a box ever does end up inside one, ignore.ideamagicbox/(below).
What git can’t guard
Git has no setting that stops a checkout, reset, stash or clean from rewriting files. Its hooks run after a checkout, or not at all for the others, and a locked worktree is only protected from being removed or moved. So the guard is where a box lives, not a git setting.
Git as a backup of a box
A box that is its own git repository — git init in the box’s folder — is a backup of the box. The app’s stance fits in one line:
Git as a backup: fine. Git as a sync channel or with branch switching: not supported.
Leave .ideamagicbox/ out of git
Every box has a hidden .ideamagicbox/ folder. It holds the box’s database and this device’s sync state. Never commit it: a checkout would swap the database under the running app.
When a box sits inside a repository — its own or a code repository — the app says so: on New Magic Box when you pick the location, and in the box’s settings under Magic Box. While the folder isn’t ignored yet, it offers one button: Add .ideamagicbox/ to .gitignore. The button adds that line to the repository’s .gitignore and changes nothing else. You can also add it yourself:
.ideamagicbox/
What’s fine
- Committing your ideas. A commit reads your files; it doesn’t change them.
- Pushing to a remote as a backup.
- A history-only setup, such as a script that runs
git addandgit commiton a timer.
What fights the app
Some git commands rewrite the files in your box: switching branches (git checkout, git switch), git reset, git stash, git rebase and git clean. The app can’t tell these apart from you deleting notes, so every file that disappears reads as deleted:
- Any number of files: their ideas are deleted in the app too. On your other devices they move to the Trash; on this Mac they leave the list, and the files are never downloaded back here by themselves.
- Switching back: when the files come back, their ideas come back too, as with Finder’s Put Back, if nothing is syncing at that moment. Otherwise they stay in the Trash with their files until you restore them.
A git pull that only brings in edits behaves like any other outside editor: the app picks up the changes. Two things to know. A note the pull deletes goes to the Trash on every device. And older text arriving through git syncs out to your other devices as the newest edit.
Git and Magic Sync together
Magic Sync and git would both own the same files, so a checkout’s deletions travel to every device. If you set up Magic Sync for a box inside a repository, Choose What Syncs shows a warning above the file types — it never stops you. Pick one way to move a box between machines: Magic Sync, or git as a backup only.
On iPhone
Boxes on iPhone live inside the app, out of reach of git, so none of this applies there.
See also: Editing your box with other apps · Magic Sync
On the Mac, the app's command line prints this page in Terminal, offline:
imb docs git More in Your files
-
Magic Boxes and your files Mac · iPhone
A box is a folder you own — what's inside it, how new files are named and placed, and the header lines the app writes.
-
Editing your box with other apps Mac · iPhone
Use Obsidian, VS Code, Cursor or vim on your box — what the app does with your edits, new files, renames and deletions.