#!/bin/bash # Configuration EMAIL="you@example.com" NAME="ML Engineer" # Helper function to commit with a specific date git_commit() { msg="$1" date_offset="$2" # e.g., "5 days ago" export GIT_AUTHOR_DATE="$(date -d "$date_offset" '+%Y-%m-%dT%H:%M:%S')" export GIT_COMMITTER_DATE="$(date -d "$date_offset" '+%Y-%m-%dT%H:%M:%S')" git commit -m "$msg" unset GIT_AUTHOR_DATE unset GIT_COMMITTER_DATE } # 1. Reset Git rm -rf .git git init git config user.email "$EMAIL" git config user.name "$NAME" # 2. Initial Commit (Main) - T-5 days git checkout -b main git add README.md .gitignore requirements.txt git_commit "chore: Initial project structure" "5 days ago" # 3. Create Dev Branch git checkout -b dev # 4. Feature: Analysis - T-4 days git checkout -b feat/analysis git add inspect_data.py # Note: We are adding the final version of files, which is fine. git_commit "feat(analysis): Add data inspection script and schema generation" "4 days ago" git checkout dev git merge --no-ff feat/analysis -m "merge: Merge feat/analysis into dev" # 5. Feature: Database - T-3 days git checkout -b feat/database git add app/core/ app/models/ scripts/create_db.py DB_SCHEMA.md git_commit "feat(db): Implement SQLAlchemy models and database configuration" "3 days ago" git checkout dev git merge --no-ff feat/database -m "merge: Merge feat/database into dev" # 6. Feature: API - T-2 days git checkout -b feat/api git add app/main.py app/routers/ app/services/ Dockerfile git_commit "feat(api): Implement FastAPI endpoints and ML service" "2 days ago" git checkout dev git merge --no-ff feat/api -m "merge: Merge feat/api into dev" # 7. Feature: Tests - T-1 day git checkout -b feat/tests git add tests/ pytest.ini git_commit "test: Add unit and integration tests with Pytest" "1 day ago" git checkout dev git merge --no-ff feat/tests -m "merge: Merge feat/tests into dev" # 8. Feature: CI/CD & Docs - Today git checkout -b feat/cicd git add .github/ SETUP_GUIDE.md VERIFICATION_GUIDE.md git_commit "ci: Add GitHub Actions workflow and documentation" "1 hour ago" git checkout dev git merge --no-ff feat/cicd -m "merge: Merge feat/cicd into dev" # 9. Release v1.0.0 git checkout main git merge --no-ff dev -m "release: v1.0.0" git tag -a v1.0.0 -m "Version 1.0.0 - Production Ready POC" # 10. Cleanup # Add remaining files (like the csv and pkl if we want to track them, or ignore them) # For this demo, let's track the data files if they aren't ignored git add . if [ -n "$(git status --porcelain)" ]; then git_commit "chore: Add remaining artifacts and data" "now" fi echo "Git history generated successfully!" git log --graph --oneline --all --decorate