Skip to content

Instantly share code, notes, and snippets.

@PovilasKorop
Created September 22, 2025 17:02
Show Gist options
  • Select an option

  • Save PovilasKorop/4d29db55e9e23c5e30d8b777a009eedd to your computer and use it in GitHub Desktop.

Select an option

Save PovilasKorop/4d29db55e9e23c5e30d8b777a009eedd to your computer and use it in GitHub Desktop.
Claude Code Hook for Checking Git Status on Session Start
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "git rev-parse --git-dir > /dev/null 2>&1 && (! git diff-index --quiet HEAD -- && echo '⚠️ You have uncommitted changes in your git repository.' && echo '' && echo 'Changes:' && git status --porcelain || echo '✅ Git repository is clean')"
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment