Git Hooks जनरेटर
pre-commit, pre-push और अन्य Git hook स्क्रिप्ट जनरेट करें।
हुक मैनेजर
पैकेज मैनेजर
Git हुक स्टेज
Pre-Commit जाँच
pre-commit
# Block accidental commit of .env secrets
if git diff --cached --name-only | grep -qE "(^|/)\.env($|\.)" && ! git diff --cached --name-only | grep -qE "\.env\.example$"; then
echo "Error: Refusing to commit .env secret file. Unstage it first." >&2
exit 1
fi
npx --no -- lint-staged
npm run typecheck
सेटअप निर्देश
npx --no -- husky init # Save script into .husky/pre-commit
सहयोगी कॉन्फ़िगरेशन
{
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md,css}": [
"prettier --write"
]
}
}