Ensuring You're On the Right Branch!

You can paste it in your editor, or drop this into the prompt to do it in-session:

  !cat > .claude/settings.local.json <<'EOF'
  {
    "permissions": { "allow": ["Bash(git checkout *)"] },
    "hooks": {
      "SessionStart": [ { "hooks": [ { "type": "command", "command": "echo \"[current git branch: $(git branch --show-current 2>/dev/null)]\"" } ] } ],
      "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "echo \"[current git branch: $(git branch --show-current 2>/dev/null)]\"" } ] } ]
    }
  }
  EOF

  After saving, run /hooks to confirm Claude Code picked them up (hook changes are read at session start, so you may need a new session or to re-enter via
  /hooks). From then on you'll see [current git branch: …] injected each turn — which is what keeps me from ever acting on a stale branch assumption again.

Comments

Popular posts from this blog

Claude.md for Python Data Science

Worktree Prompt (Separate Directories for Different Features - So You Can Work in Parallel)

Claude.md for Responsive Mobile App Development with React Native