Przejdลบ do treล›ci

๐Ÿงฌ Git Templates

Git templates define default files and hooks for all new repositories.


๐ŸŽ“ Who This Is For

  • Advanced engineers standardizing repo structure
  • DevOps teams enforcing global hooks
  • Organizations maintaining consistent workflows
  • Developers creating reusable project skeletons

๐Ÿ”ง Enable Global Template Directory

1
2
mkdir -p ~/.git-templates/hooks
git config --global init.templateDir ~/.git-templates

๐Ÿงฉ Example: Global pre-commit Hook

~/.git-templates/hooks/pre-commit:

1
2
3
#!/bin/sh
echo "Running global pre-commit checks..."
# Example: run linters or tests

Make executable:

1
chmod +x ~/.git-templates/hooks/pre-commit

๐Ÿ”ง What You Can Include

  • Default .gitignore
  • Default .gitattributes
  • Default hooks
  • Project skeletons