Course contentsShow
← Data Science
Lesson 2032 of 2,14546. Version Control with GitFree lesson

Organizing Repository Structure for Data Science

Adopt standard project layouts that separate code, data, notebooks, and outputs for better version control.

Organizing Repository Structure for Data Science

You'll learn how to arrange your project folders so Git can track what matters and your team can navigate without confusion.

Why Structure Matters for Version Control

Think of your repository like a well-organized filing cabinet. When everything has its place—notebooks in one drawer, data in another, outputs in a third—you can quickly find what you need and Git can intelligently track changes where they matter most. Poor structure leads to merge conflicts, accidental commits of large data files, and teammates wasting time hunting for the right file.

Standard Layout Pattern

A battle-tested structure separates concerns:

project-name/
├── data/
│   ├── raw/          # Original, immutable data
│   └── processed/    # Cleaned, transformed data
├── notebooks/        # Jupyter notebooks for exploration
├── src/              # Source code (.py or .R files)
├── outputs/          # Generated figures, reports, models
├── tests/            # Unit tests
├── .gitignore        # Excludes data/ and outputs/
└── README.md         # Project documentation

Why This Works

Data isolation: Keep data/ and outputs/ in .gitignore to avoid bloating your repository. These directories hold generated or large binary files that don't belong in version control.

Code clarity: src/ contains reusable functions and scripts. notebooks/ holds exploratory analysis. This separation makes it obvious where production code lives versus experimental work.

Collaboration-friendly: Everyone knows where to find things. New team members onboard faster. Code reviews focus on src/ and notebooks/, not scattered scripts.

Practical Example

Instead of analysis_final_v3_REALLY_FINAL.py sitting next to old_data.csv, you have src/preprocessing.py and your .gitignore excludes the entire data/ directory.

Key Takeaway: A standard repository structure with separated code, data, notebooks, and outputs makes version control cleaner, prevents accidental commits of large files, and helps your entire team work efficiently.