Skip to main content
DevDaily can automatically capture work snapshots using git hooks, ensuring you never lose context when switching branches or making commits.

Overview

Git hooks allow DevDaily to silently record your work state at key moments:
  • post-commit: Captures a snapshot after every commit
  • post-checkout: Captures a snapshot when switching branches
These snapshots power context recovery, work history search, and cross-project summaries.
Git hooks are opt-in and respect existing hooks by appending DevDaily calls instead of overwriting.

Installation

Interactive Setup

The easiest way to install git hooks is via the interactive setup:
This will:
  1. Check if you’re in a git repository
  2. Detect existing hooks in .git/hooks/ or your custom core.hooksPath
  3. Install or append DevDaily hooks
  4. Set journal.gitHooks: true in your config

Manual Installation

You can also manually create hook files:
Make them executable:

Configuration

Control git hooks behavior in your .devdaily.json:
.devdaily.json
boolean
default:"true"
Master switch for all automatic snapshots (including hooks)
boolean
default:"false"
Enable git hooks for automatic snapshots. Set to true after running devdaily init --git-hooks.
boolean
default:"true"
Capture snapshot after each commit
boolean
default:"true"
Capture snapshot when switching branches
boolean
default:"true"
Suppress snapshot messages (recommended for hooks to avoid noise)

How It Works

Post-Commit Hook

After every git commit, DevDaily captures:
  • Current branch and commit hash
  • Commit message and author
  • Files changed and diff stats
  • Timestamp and tags (auto:post-commit)
The snapshot runs in the background using a subshell, so it doesn’t slow down your commit:

Post-Checkout Hook

When you switch branches (git checkout or git switch), DevDaily captures:
  • Previous and new branch names
  • Current working state
  • Uncommitted changes
  • Timestamp and note (“Switched branch”)
The post-checkout hook only runs for branch checkouts, not file checkouts (like git checkout -- file.txt).

Existing Hooks

If you already have git hooks, DevDaily will append its calls instead of overwriting:

Before Installation

.git/hooks/post-commit

After Installation

.git/hooks/post-commit
This ensures compatibility with tools like Husky, pre-commit, and custom scripts.

Uninstalling Hooks

To remove DevDaily git hooks:
This will:
  • Remove standalone DevDaily hooks completely
  • Remove appended DevDaily sections from mixed hooks
  • Leave other hook logic intact
  • Set journal.gitHooks: false in config

Manual Removal

If hooks were fully managed by DevDaily:
If hooks were appended to existing files, manually edit and remove the section between:

Custom Hooks Path

If you use a custom git hooks directory (via core.hooksPath):
DevDaily will automatically detect and use that path:

Performance

Git hooks use light snapshots (--light flag) which:
  • Skip PR and ticket fetching (fast, local-only)
  • Run in the background (non-blocking)
  • Capture only essential data (commits, branches, files)
  • Complete in ~50-200ms on average repositories
You won’t notice any slowdown in git commit or git checkout.

Snapshot Storage

Snapshots are stored in your local journal:
Each snapshot is a small JSON file (~2-10 KB) containing:

Use Cases

Context Recovery

When you return to a project after days or weeks:
DevDaily analyzes your journal snapshots (including hook-captured data) to tell you:
  • What branch you were on
  • What you were working on
  • Uncommitted changes
  • Related tickets
Find when you worked on specific features:

Cross-Project Summaries

Aggregate work across multiple repositories:
This pulls from your journal, which includes snapshots from all projects where hooks are installed.

Disabling Auto-Snapshots

If you want to keep hooks installed but temporarily disable snapshots:
.devdaily.json
Or per-repository:

Troubleshooting

Hooks Not Running

  1. Check if hooks are executable:
  2. Check if DevDaily is in PATH:
  3. Test manually:

Hooks Slow Down Commits

This shouldn’t happen because snapshots run in the background. If you experience slowdown:
  1. Check that hooks use the background syntax:
  2. Ensure journal.quiet: true to suppress output
  3. Check for other hooks that might be slow

Snapshots Not Appearing

Check journal directory:
If empty, check config:

Best Practices

1

Start with manual snapshots

Use devdaily snapshot manually for a few days to understand what’s captured.
2

Enable side-effect snapshots

Let standup, pr, and week commands capture automatic snapshots.
3

Install git hooks

Once comfortable, run devdaily init --git-hooks for complete coverage.
4

Review periodically

Check your journal with devdaily snapshot --stats to see growth and prune old entries.

Security & Privacy

All snapshots are local-only. DevDaily never sends journal data to any server.
  • Snapshots contain commit messages, file names, and diff stats (no file contents)
  • Stored in ~/.config/devdaily/journal/ with user-only permissions
  • No network calls during snapshot capture
  • Safe to use in private/proprietary repositories

Configuration Overview

Learn about all configuration options

Project Management

Integrate ticket data into snapshots