Hooks
Automatisez les workflows avec les hooks Git et GitScrum CLI. Scripts de pré-commit, post-commit et push.
Automatisez vos workflows Git avec GitScrum.
Installation
gitscrum hooks installInstalle les hooks dans .git/hooks/.
Hooks Disponibles
| Hook | Fonction |
|---|---|
prepare-commit-msg | Ajoute l'ID de tâche au message |
post-commit | Démarre le timer automatiquement |
post-checkout | Change de tâche avec la branche |
pre-push | Met à jour le statut de la tâche |
Configuration
# Activer des hooks spécifiques
gitscrum config set hooks.prepare-commit-msg true
gitscrum config set hooks.post-commit true
# Désactiver
gitscrum config set hooks.pre-push falseHooks Personnalisés
Créez .gitscrum/hooks/post-commit :
#!/bin/bash
TASK_ID=$(git log -1 --format=%s | grep -oE 'GS-[0-9]+')
if [ -n "$TASK_ID" ]; then
# Timer automatique
gitscrum timer start --task $TASK_ID
# Notification Slack
curl -X POST "$SLACK_WEBHOOK" \
-d "{\"text\": \"Commit sur $TASK_ID\"}"
fiDésinstallation
gitscrum hooks uninstallDépannage
# Vérifier les hooks actifs
gitscrum hooks status
# Journaux
gitscrum hooks logs --last 10