27. How to Use Git with Jupyter Notebooks for Data Projects
27.6 Common Mistakes
Why. The cost of a bad Git habit shows up weeks later — leaked tokens, broken clones, unreadable history.
What.
- Committing
data/raw/full_extract.csv(huge). - Committing
.envwith API keys (Chapter 26). - Committing notebooks full of outputs every 5 minutes.
- Editing the same cell on two laptops without pull/push discipline.
- Putting passwords in notebook markdown “for later”.
How.
Pre-push checklist
git status— any.envor unexpected CSV?- Open diff — is it code or a giant output blob?
- Confirm README still says data is fictional if applicable.
- Confirm venv is not inside the repo commit.
- Ask: can a classmate clone and understand the next step?
Worked example A — Secret sniff (manual).
git grep -n "API_KEY\|password\|SECRET" || true
Worked example B — Size alarm.
git ls-files -s | sort -k2 -n | tail
(Or simply check file sizes in data/raw/ before git add.)
Worked example C — Checkpoint clutter.
.ipynb_checkpoints/ duplicates notebooks. Always ignore it.
Ravindra Bagale's Tip
Watch for three red flags before every push: a huge data file, a secret such as a .env file or a password, and a notebook full of noisy outputs. The pre-push checklist takes only about 30 seconds, so run it every time. Never force-push to hide a leaked key; rotate the key and ask a teammate before you rewrite history.
Ravindra Bagale's Tip – मराठी
प्रत्येक push आधी तीन धोक्याच्या खुणा तपासा: खूप मोठी data file, .env file किंवा password सारखं secret, आणि गोंगाट करणाऱ्या outputs ने भरलेली notebook. Pre-push checklist ला फक्त सुमारे 30 seconds लागतात, म्हणून ती प्रत्येक वेळी चालवा. Leak झालेली key लपवण्यासाठी कधीही force-push करू नका; key rotate करा आणि history बदलण्याआधी teammate ला विचारा.
Ravindra Bagale's Tip – हिंदी
हर push से पहले तीन ख़तरे के निशान जाँचो: बहुत बड़ी data file, .env file या password जैसा secret, और शोर करने वाले outputs से भरी notebook। Pre-push checklist में सिर्फ़ लगभग 30 seconds लगते हैं, इसलिए इसे हर बार चलाओ। Leak हुई key छिपाने के लिए कभी force-push मत करो; key rotate करो और history बदलने से पहले teammate से पूछो।