←back to thread

Claude Code now supports hooks

(docs.anthropic.com)
381 points ramoz | 1 comments | | HN request time: 0.001s | source
Show context
aantix ◴[] No.44431102[source]
Wish it supported rollbacks..
replies(1): >>44432114 #
1. robbomacrae ◴[] No.44432114[source]
With this you could add support yourself!

Add a PostToolUse [0] hook that automatically creates a git commit whenever changes are made. Then you can either git checkout the commit you want to rollback to... Or you could assign those git commits an index and make a little MCP server that allows you to /rollback:goto 3 or /rollback:back 2 or whichever syntax you want to support.

In fact if you put that paragraph into Claude I wouldn't be surprised if it made it for you.

[0] https://docs.anthropic.com/en/docs/claude-code/hooks#posttoo...