Git Automation
FreshOverview
Graphify's Git hooks keep your knowledge graph automatically current without any manual intervention. After installing, every commit triggers a graph update.
Install Git Hooks
bash
graphify hook installThis installs two hooks in your .git/hooks/ directory:
| Hook | Trigger | Action |
|---|---|---|
post-commit | After every commit | Incremental graph rebuild (--update) |
post-checkout | After every branch switch | Incremental graph rebuild (--update) |
How Hooks Work
flowchart LR
A[git commit] --> B[post-commit hook fires]
B --> C[graphify . --update]
C --> D[graph.json updated]
D --> E[New graph ready for queries]flowchart LR
A[git checkout feature-branch] --> B[post-checkout hook fires]
B --> C[graphify . --update]
C --> D[Graph reflects new branch state]Hook Status
bash
graphify hook statusShows whether hooks are installed and which hooks are active.
Uninstall Hooks
bash
graphify hook uninstallRemoves both hooks from .git/hooks/. Your graphify-out/ is untouched.
Performance Impact
The --update flag makes post-commit hooks practical:
- Code-only changes (most commits): pure tree-sitter AST rebuild — near-instant
- New documentation or prose files: triggers LLM extraction — adds a few seconds per new file
- Large commits with many new docs: may take a minute or two
For Fast Commits
If hook runtime is a concern, modify the hook to run with --no-viz (skips HTML generation):
bash
# .git/hooks/post-commit
graphify . --update --no-vizCI/CD Integration
For teams using CI:
yaml
# GitHub Actions example
- name: Update knowledge graph
run: |
pip install graphifyy
graphify . --update --no-viz
- name: Commit updated graph
run: |
git add graphify-out/graph.json graphify-out/GRAPH_REPORT.md
git diff --staged --quiet || git commit -m "chore: update graph [skip ci]"Verification Checklist
- [ ]
graphify hook statusshows hooks as installed - [ ] Make a test commit and verify
graphify-out/graph.jsontimestamp updates - [ ] Branch switch re-runs the graph update