DCubes
Git module

Lesson 13

Repo hygiene for pipelines

Layout, README, and ignore rules for a small data project repository.

beginner30 minRun on your machine

What you will be able to do

  • Sketch a clean repo layout for SQL + scripts
  • Write a short README
  • List a pre-commit mental checklist

Why this matters for data work

A tidy repo is faster onboarding and safer CI. Chaos (final_v3.sql, data dumps, secrets) is how incidents start.

Concepts

Suggested layout:

README.md
.gitignore
compose.yaml
sql/
  revenue_by_store.sql
src/
  # python jobs later
data/
  # gitignored raw; optional tiny fixtures tracked deliberately

Pre-push checklist:

  1. git status — no .env, no dumps
  2. Diff reads as one idea
  3. README still true
  4. Secrets only in env / secret store

Practice on your machine

mkdir -p ~/dcubes/git-lab/hygiene-demo/sql
cd ~/dcubes/git-lab/hygiene-demo
git init
git branch -M main
cat > .gitignore << 'EOF'
.venv/
.env
data/raw/
data/out/
__pycache__/
EOF
cat > README.md << 'EOF'
# hygiene-demo

Local practice layout for DCubes Git.

## SQL

See `sql/` for analytic queries. Run them against your sql-lab Postgres.
EOF
cat > sql/revenue_by_store.sql << 'EOF'
-- Completed revenue by store (run in retail DB)
SELECT store_id, round(sum(line_total), 2) AS revenue
FROM orders
WHERE status = 'completed'
GROUP BY store_id
ORDER BY revenue DESC;
EOF
git add .
git status
git commit -m "Scaffold hygiene-demo with README and sample SQL"

What you should see

  • One clean commit with three paths.
  • No data files tracked.

Common mistakes

  • Empty README — even five lines help.
  • SQL only in chat history — files in Git outlive Slack.

Next

Capstone: First Git shift.