Template
.claude/hooks/schutz-main.sh hinzugefügt
This commit is contained in:
1 parent
44b96f5969
commit
ed2d369da6
1 file changed
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Blockiert git commit und git push, solange main ausgecheckt ist.
|
||||||
|
befehl=$(node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{console.log(JSON.parse(s).tool_input?.command??"")}catch{console.log("")}})')
|
||||||
|
if echo "$befehl" | grep -Eq 'git (commit|push)'; then
|
||||||
|
branch=$(git -C "$CLAUDE_PROJECT_DIR" branch --show-current)
|
||||||
|
if [ "$branch" = "main" ]; then
|
||||||
|
echo "Du stehst auf main. Lege zuerst einen Branch an: git switch -c feat/<name>" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
Reference in new issue
Block a user