Skip to content

Git Automation

Fresh

Overview

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 install

This installs two hooks in your .git/hooks/ directory:

HookTriggerAction
post-commitAfter every commitIncremental graph rebuild (--update)
post-checkoutAfter every branch switchIncremental 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 status

Shows whether hooks are installed and which hooks are active.

Uninstall Hooks

bash
graphify hook uninstall

Removes 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-viz

CI/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 status shows hooks as installed
  • [ ] Make a test commit and verify graphify-out/graph.json timestamp updates
  • [ ] Branch switch re-runs the graph update