graphify-out/graph.json and let git merge it with Graphify’s union merge driver instead of as text. Every clone then starts with the same map, and two branches that both changed the graph merge without a conflict. This recipe sets that up and adds attribution for sources teammates add.
What you’ll build
- A committed
graph.jsonthat matches each commit’s code. - A
.gitattributesrule and a merge driver so merges union the graph. - A pre-commit hook that rebuilds and stages the graph.
- Tagged sources, so you know who added which document.
Setup
Step 1: Track only the graph
Other files ingraphify-out/ are rebuilt locally. Track just the graph. In .gitignore:
Step 2: Mark the graph and register the merge driver
In.gitattributes:
linguist-generated=true collapses the file in GitHub pull requests. -diff keeps it out of git diff. merge=graphify names the driver.
Register the driver in each clone. graphify hook install does this too, but graphify hook uninstall removes it again along with the .gitattributes entry, so with the pre-commit hook in Step 3 register it by hand: point it at the Python that Graphify runs in, so merges also work in GUI git clients where graphify isn’t on PATH.
Step 3: Rebuild before each commit
graphify hook install rebuilds after each commit, which leaves the rebuilt graph as an uncommitted change. If you commit the graph, use a pre-commit hook instead. Add this to .git/hooks/pre-commit (with #!/bin/sh first and chmod +x):
PYTHONHASHSEED=0 keeps clustering deterministic, so community ids don’t churn between machines.
Step 4: Merge two graphs by hand
When you need to combine graphs outside git, for example from two services:graphify global add graphify-out/graph.json --as my-service in each repository, then graphify global list.
Step 5: Tag who added a source
When teammates add docs, papers or pages to the graph, record who added them:add saves the page to ./raw and updates the graph. The saved file’s frontmatter records the contributor (falling back to the author), so the graph can trace each source back to a person.
When it goes wrong
A merge stops with a conflict ingraph.json. The driver isn’t registered in this clone, or it rejected a corrupt file. Check git config merge.graphify.driver. To recover, rebuild:
graph.json is one line of compact JSON, so a rebuilt graph shows as one changed line. Upgrade if you see more.
CI commits fail the hook. Install Graphify in CI, or set GRAPHIFY_SKIP_HOOK=1 for those commits.
Production patterns
- Commit hooks in
.githooks/and rungit config core.hooksPath .githooksin each clone so everyone shares them. - Run
graphify update .after a branch switch to refresh the untracked report and HTML. - In Graphify, the hosted product, the graph lives on our servers and every teammate’s agent reads the same one over MCP. There’s nothing to commit.
Complete example
What you built
Your team shares one graph through git. It merges without conflicts, rebuilds with each commit, and records who added each source.Next steps
Team workflows
The full reference for committing and merging the graph.
Keep docs in sync
Rebuild the graph and wiki on every commit.
Try it in Graphify
We build and host the graph for you. Start with a 14-day Pro trial, then keep up to 3 repositories on Free. No card required.