#### What I use GitHub for:
- Store and version code, notebooks, and config files across projects
- Track changes and debug issues using commits, diffs, and pull requests
- Collaborate with others through branches, reviews, and issues
- Automate workflows with GitHub Actions (e.g., testing, data pipeline triggers)
- Document processes or data decisions directly in the repo using `README.md` and Markdown
-----
## Going Deeper: Automating with Git Hooks
One of the most underrated features I’ve used in GitHub (and Git itself) is **Git hooks** — scripts that run automatically at key points in your Git workflow.
They’re incredibly useful for enforcing consistency, reducing errors, and automating small but critical tasks.
---
### Example: Pre-commit Hook for Code Quality
Let’s say I want to ensure every commit runs a few checks:
- Auto-formatting with `black`
- Linting with `flake8`
- Quick sanity checks with `pytest`
Here’s how to set that up:
```bash
# Step 1: Create the pre-commit hook
touch .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
```
```bash
# Step 2: Add logic to the script
#!/bin/bash
echo "Running pre-commit checks..."
black . || exit 1
flake8 . || exit 1
pytest --quiet || exit 1
```
> Now every time I commit, this runs first. If formatting, linting, or tests fail — the commit is blocked.
---
### Why This Matters
- Catch issues **before they hit main/master branch**
- Maintain code quality **locally** without relying solely on CI
- Build repeatable habits that scale across teams as well as save time
---
### Pro Tip
> Use [`pre-commit`](https://pre-commit.com/) (a Python-based tool) to manage Git hooks across teams.
> It makes hooks declarative, repo-controlled, and language-agnostic — so everyone runs the same checks, the same way.
---
**Part of**: [[Code Repository]]