27. How to Use Git with Jupyter Notebooks for Data Projects
27.7 Practice, Tip and Close
Why. Muscle memory beats a long Git manual for analysts.
What. Initialize a tiny lab repo and make two clean commits.
How.
Chapter practice lab
- Create
blinkit_mh_lab/with the folder layout and README (fictional data note). - Add the starter
.gitignorefrom 27.3. - Put a tiny
data/raw/sample_orders.csv(5–10 rows) and a notebook pathnotebooks/01_clean.ipynb(even an empty notebook file is fine to start). git init, first commit: “Initial lab skeleton”.- Clear outputs if you ran cells; second commit: “Add sample orders and clean stub”.
- Run the pre-push checklist; write three bullets you would tell a teammate.
mkdir -p blinkit_mh_lab/{data/raw,data/clean,notebooks,outputs}
cd blinkit_mh_lab
printf '%s\n' '# Blinkit MH lab (fictional sample data)' > README.md
printf '%s\n' '.ipynb_checkpoints/' '.venv/' 'venv/' '.env' 'data/raw/*.csv' '!data/raw/sample_orders.csv' > .gitignore
printf '%s\n' 'order_id,city,amount_inr' 'BLK-1,Pune,189' 'BLK-2,Nashik,95' > data/raw/sample_orders.csv
printf '%s\n' '{"cells":[],"metadata":{},"nbformat":4,"nbformat_minor":5}' > notebooks/01_clean.ipynb
git init
git add README.md .gitignore data/raw/sample_orders.csv notebooks/01_clean.ipynb
git commit -m "Initial lab skeleton with sample orders"
Practice task
Raja: “Show git status clean after commit, and prove data/raw/huge.csv would be ignored by creating an empty huge.csv name and confirming it is untracked.” No real secrets.
Ravindra Bagale's Tip
Follow this order for every new data project: folder skeleton, then .gitignore, then small commits, and clear outputs before each commit. Never commit a password or any real secret. Leave a short README note for your future self, because the person who opens this project next month may be you.
Ravindra Bagale's Tip – मराठी
प्रत्येक नव्या data project साठी हा क्रम पाळा: आधी folder skeleton, मग .gitignore, मग छोटे commits, आणि प्रत्येक commit आधी outputs clear करा. Password किंवा कोणतंही खरं secret कधीही commit करू नका. भविष्यातील स्वतःसाठी README मध्ये छोटी note ठेवा, कारण पुढच्या महिन्यात हा project उघडणारी व्यक्ती तुम्हीच असू शकता.
Ravindra Bagale's Tip – हिंदी
हर नए data project के लिए यह क्रम अपनाओ: पहले folder skeleton, फिर .gitignore, फिर छोटे commits, और हर commit से पहले outputs clear करो। Password या कोई भी असली secret कभी commit मत करो। भविष्य के अपने लिए README में छोटा note छोड़ो, क्योंकि अगले महीने यह project खोलने वाले आप ख़ुद हो सकते हो।
Thodkyaat sangaycha tar (quick recap)
- Git replaces
final_v3filename chaos - Layout: raw / clean / notebooks / outputs
.gitignorebefore big adds- Clear notebook outputs for readable diffs
- Commit messages with a clear what/why
- Never commit secrets or multi-GB extracts
Samajla ka? Aata Jupyter lab Git sobat neat rahnar — pudhe ek chhota commit / evening.