Quiz 2

Git & GitHub for Data Science

356 words
2 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Git & GitHub for Data Science ## 🎯 Learning Objectives - Initialize a Git repository and make commits - Create and merge branches for feature development - Collaborate via pull requests on GitHub - Manage large datasets with Git LFS and .gitignore ## 📖 Core Content ### 2.1 Essential Git Workflow *(Diagram)* ###...

Git & GitHub for Data Science

🎯 Learning Objectives

  • Initialize a Git repository and make commits
  • Create and merge branches for feature development
  • Collaborate via pull requests on GitHub
  • Manage large datasets with Git LFS and .gitignore

📖 Core Content

2.1 Essential Git Workflow

(Diagram)

2.2 Branching Strategy for Data Science

(Diagram) Best practices:
  • main: Production-ready code only
  • develop: Integration branch
  • feature/*: One branch per feature/experiment
  • experiment/*: For ML experiments that may be discarded

2.3 Data Versioning

gitignore
# .gitignore for data science
*.csv
*.pkl
*.h5
data/
models/
*.log
.ipynb_checkpoints/
__pycache__/
For large datasets: use Git LFS (Large File Storage) or DVC (Data Version Control).

2.4 Practical Git Commands

bash
# Basic workflow
git init
git add .
git commit -m "Initial commit: EDA notebook"
git branch feature/engineering
git checkout feature/engineering
# ... work ...
git add src/feature_engineering.py
git commit -m "Add feature engineering module"
git checkout main
git merge feature/engineering
git push origin main

📝 Practice Questions

Q1: Why shouldn't you track large datasets with regular Git?
Git stores the full history of every file. A 1 GB dataset modified 10 times becomes 10 GB in the repository. Cloning becomes slow, storage costs explode, and GitHub has file size limits (100 MB per file). Use Git LFS (stores pointers in Git, data in remote storage) or DVC. Q2: What's the difference between git merge and git rebase?
Merge creates a new commit that combines histories (preserves branching history). Rebase moves commits from one branch to the tip of another (linear history). Merge is safer for shared branches. Rebase creates cleaner history for personal branches. Rule: rebase before pushing, merge after pushing. Q3: When should you create a new branch vs commit to main?
Create a branch when: (1) experimenting with a new approach, (2) developing a feature that might take multiple days, (3) collaborating with others on the same file. Commit to main directly only for trivial changes (fixing typos, updating README). Join Discord PreviousCourse OverviewNextJupyter & IDE
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.