Good GitHub practices keep projects collaborative, consistent, and reviewable. Clear branching rules and disciplined pull requests prevent confusion and make code review much easier.
main: Production-ready code, protected branch. Only TAs/mentors merge here.jd/add-data-cleaninginitials/brief-description (e.g., th/fix-plotting, jd/add-regression-model)Student workflow:
git checkout -b jd/my-featuregit commit -m "Add data validation"main history clean:
main fills with many “fix typo” commits.Feature branches should stay current with the main branch to avoid conflicts and ensure your changes integrate smoothly.
When main gets updated while you’re working:
# 1. Save your current work (commit or stash)
git add .
git commit -m "WIP: current progress"
# 2. Update main branch
git checkout main
git pull origin main
# 3. Rebase your feature branch (recommended)
git checkout your-feature-branch
git rebase main
# 4. Resolve any conflicts
# Git will pause if there are conflicts - edit files to resolve them
git add .
git rebase --continue
# 5. Update your remote branch
git push --force-with-lease origin your-feature-branch
Alternative: merge approach (simpler but messier history)
git checkout your-feature-branch
git pull origin main
git push origin your-feature-branch
When to update your branch:
Why rebase instead of merge?
make test and make lint locally before approving..gitignore. Never commit:
git tag -a v1.0 -m "First client deliverable"
git push origin v1.0
pre-commit to enforce linting before commits:
ruff check (style & errors)ruff format (auto-formatting)“Student’s PR has merge conflicts”
# Guide student through resolving conflicts (don't do it for them)
# 1. Help them understand what conflicts mean
# 2. Walk through the rebase process
git checkout their-feature-branch
git rebase main
# 3. Show them how to read conflict markers and resolve manually
# 4. Ensure they test after resolving conflicts
“Multiple students working on the same files”
# Coordinate merge order and communication
# 1. Merge the first PR that's ready
# 2. Have other students rebase their branches:
git checkout student2-branch
git rebase main
# 3. Review conflicts together to avoid duplicated work
“Student force-pushed and lost commits”
# Help recover using reflog (if recent)
git reflog
git checkout student-branch
git reset --hard HEAD@{n} # n = number from reflog showing last good state
# Prevention: teach --force-with-lease instead of --force
git push --force-with-lease origin branch-name
“PR looks good but CI is failing”
# Don't merge until CI passes - help student debug
# 1. Check the CI logs together
# 2. Run the failing command locally:
make build # First check if the container builds
make test
make lint
# 3. Guide them to fix the issue, don't fix it yourself
“Dependencies not working in container”
# Common issues with uv and pyproject.toml
# 1. Check if uv.lock is committed
git status # Should show uv.lock as tracked
# 2. Verify pyproject.toml has dependencies
cat pyproject.toml # Should see [project] dependencies section
# 3. Test dependency installation
make build # Should install from uv.lock
# 4. If lock file is missing:
uv lock # Generate lock file
git add uv.lock
git commit -m "Add dependency lock file"
“Student’s branch is way behind main”
# Before reviewing, ensure they're current
# 1. Check how many commits behind: look at GitHub PR page
# 2. If >10 commits behind, require update before review
# 3. Guide them through rebase process
# 4. Re-review after update (context may have changed)
“Student wants to work on someone else’s branch”
# Coordinate handoffs properly
# 1. Original student pushes their current work
# 2. New student creates branch from that work:
git checkout -b alice/continue-bobs-work origin/bob/original-feature
# 3. Update PR to point to new branch, or close old PR and open new one
“Large dataset accidentally committed”
# Remove from history (BEFORE others pull)
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch path/to/large-file' \
--prune-empty --tag-name-filter cat -- --all
# Force push to update remote
git push --force-with-lease origin main
# Prevention: improve .gitignore, teach about data/ directories
“Squash and merge on GitHub”
“I forgot to pull before starting work”
# If you haven't committed yet
git stash
git pull origin main
git stash pop
# If you've already committed
git pull --rebase origin main
“My branch has conflicts with main”
# During rebase, Git will show conflict markers like:
# <<<<<<< HEAD
# main branch code
# =======
# your branch code
# >>>>>>> your-commit
# Edit the file to resolve conflicts, then:
git add resolved-file.py
git rebase --continue
“I need to update my PR after review”
# Make your changes
git add .
git commit -m "Address review feedback"
git push origin your-feature-branch
# PR automatically updates