Title: Lab 7 — Initialize, Ignore, Branch, and Merge a Clean ML Repo
Course: AIINFRA 100: AI Systems & Development Environments > Section: Week 07 — Version Control with Git

🛠️ Lab 7 — Initialize, Ignore, Branch, and Merge a Clean ML Repo (50 pts)

Goal: Using VS Code's built-in Source Control panel (free — no tools beyond VS Code and Git are required), you will initialize a local Git repository for a toy "ML project," write a .gitignore that correctly excludes data/model/secret files, build up your first real commit history, then create a branch and merge it back into main.

Steps

1. Create the project folder. On your computer, create a new folder named ml-project-lab7. Inside it, create these placeholder files:
  - train.py — a Python script (even a few lines, e.g., print("training model..."), is fine).
  - data/raw_data.csv — a folder called data/ with any fake .csv file to stand in for your "large dataset" (a few rows of dummy text is enough).
  - model.pkl — an empty or placeholder file representing a saved model.
  - .env — a text file with a fake line like API_KEY=fake-secret-value-12345.
2. Open the folder in VS Code, then open the Source Control panel (the branching-line icon in the left sidebar, or View > Source Control).
3. Initialize the repository. Click Initialize Repository (the graphical equivalent of git init). VS Code now lists every file in your folder as untracked.
4. Write your .gitignore file. Create a new file named exactly .gitignore in the project root and add these lines:

data/
*.pkl
.env
__pycache__/
.ipynb_checkpoints/
venv/

1. Verify with git status. Open a terminal (Terminal > New Terminal) and run git status. Confirm that data/, model.pkl, and .env are not listed — only train.py and .gitignore should appear as untracked. If ignored files still show up, double-check your .gitignore spelling and file locations.
2. Make Commit 1 — the script. In the Source Control panel, stage train.py and .gitignore, write the commit message Add training script and .gitignore, and click the checkmark (✓) to commit.
3. Add a requirements file. Create requirements.txt listing a couple of fake packages (e.g., pandas, scikit-learn). Stage it and make Commit 2 with the message Add requirements.txt.
4. Add a README. Create README.md with a one-sentence project description. Stage it and make Commit 3 with the message Add project README.
5. Branch for an experiment. Create and switch to a new branch: git switch -c experiment/bigger-batch. Edit train.py (for example, add a line BATCH_SIZE = 64), save, stage, and commit with a descriptive message. Run git log --oneline and note this commit exists on the branch but not on main.
6. Merge it back. Switch to main (git switch main) and run git merge experiment/bigger-batch. Confirm the merge completes and that your train.py edit is now present on main.
7. Review your history. Run git log --oneline --graph --all and confirm you see all your commits and the branch coming back into main.
8. Take screenshots of your git log --oneline --graph --all output and your final Source Control panel showing a clean working tree (no pending changes).

Deliverables: Submit (a) a screenshot of your git log --oneline --graph --all output showing your commits and the merge, (b) a screenshot or copy-paste of your final .gitignore file contents, and (c) 2–3 sentences describing what git status showed you before vs. after adding the .gitignore file, and one sentence on why branching kept your experiment isolated from main.