Session 5: Git Setup for VSCode
Goal: Install and configure Git for VSCode, then practice the complete Git workflow by making improvements to this training repository
What We’ll Do Today
- ✅ Install Git and configure it in VSCode
- ✅ Set up GitHub account and connect to VSCode
- ✅ Clone this repository and practice Git workflow
- ✅ Make improvements to training materials
- ✅ Create a Pull Request through VSCode and GitHub
Part 1: Install Git
Complete the git setup in Optional: Git Setup
Part 2: Create & Link GitHub Account
Create GitHub Account
- Go to https://github.com
- Click “Sign up”
- Follow the registration process
- Verify your email address
Connect GitHub to VSCode
VSCode has built-in GitHub authentication:
- In VSCode, open the Source Control panel (
Ctrl+Shift+G) - You might see a notification: “Sign in to GitHub to access remote repositories”
- Click Sign in
- Your browser will open with GitHub authentication
- Click Authorize when prompted
- Return to VSCode - you should now see your GitHub account connected
If you don’t see the notification, you can also sign in via:
- Command Palette (
Ctrl+Shift+P) → “Accounts: Sign in”- Or click the account icon in the bottom-left corner
Verify Connection
- Open Source Control panel
- You should see your GitHub account name at the bottom
Part 3: Practice Git Workflow
Now you’ll practice the complete Git workflow by making improvements to this training repository.
Step 1: Clone the Repository
- In VSCode, press
Ctrl+Shift+Pto open Command Palette - Type “Git: Clone” and select it
- When prompted for URL, paste:
https://github.com/itk-ai/learn-to-prompt-foo - Choose a local folder to save the repository (e.g.,
C:\Users\YourName\<projects>, where you created your initialpromptfoo-getting-startedproject in Session 2: Getting Started). In the cloning process a folder will be created with the same name as the github repo “learn-to-prompt-foo” - VSCode will clone the repository
- When prompted, click Open to open the folder in VSCode
Step 2: Explore the Repository
The repository contains training materials organized in folders:
docs/
├── setup/ # Sessions 1-2
├── evaluations/ # Sessions 3-4
├── git/ # Session 5 (this guide!)
├── cheat-sheets/ # Reference materials
└── material/ # Downloadable files
Step 3: Find Something to Improve
Your task: Find a section in the training materials that could be clearer. Do not edit it yet, you’ll do that in Step 5: Make Your Edit
Good places to look
- The sessions you’ve already completed (SETUP.md, GETTING-STARTED.md, PROMPTFOO-EVALUATIONS.md, ASSERTIONS-REFERENCE.md, BIAS-CHECKER.md)
- Look for:
- Long paragraphs that could be split
- Missing examples or clarifications
- Typos or formatting issues
- Unclear instructions
- Sections that could use more detail
Don’t overthink this! Even small improvements like fixing a typo or clarifying one sentence are valuable.
Step 4: Create a New Branch
Why branches? They are a way to collect change and “package” them for others to look at. They are also a way to let you experiment without affecting the main version.
- Look at the bottom-left of VSCode window - you’ll see
main(current branch) - Click on
main - Click “Create new branch”
- Type a descriptive name:
fix/improve-[topic]Examples:
fix/improve-setup-clarityfix/typo-getting-startedadds/example-to-evaluations
- Press Enter
VSCode automatically switches to your new branch.
Step 5: Make Your Edit
Remember what you decided to edit in step 3
- Navigate to the file you want to improve (in the file explorer on left)
- Open the markdown file
- Make your improvement:
- Fix typos
- Clarify confusing sentences
- Add missing examples
- Improve formatting
- Save the file (
Ctrl+S) - Format the document (
Shift+Alt+F) to ensure proper markdown formatting
Step 6: Review Changes in Source Control
- Open Source Control panel (
Ctrl+Shift+G) - You’ll see your modified file under “Changes”
- Click on the filename to see the diff:
- Green lines = text you added
- Red lines = text you removed
- Review carefully to make sure changes look correct
The diff view helps you catch mistakes before committing!
Step 7: Stage and Commit Your Changes
Staging: Preparing files for commit (like putting items in a box)
- In Source Control panel, hover over your modified file
- Click the + (plus) icon next to the filename
- The file moves to “Staged Changes”
Committing: Saving a snapshot of your changes
- In the text box at the top of Source Control panel, write a commit message
- Be specific and descriptive:
- ✅ Good: “Improve clarity in Part 3 of GETTING-STARTED guide”
- ✅ Good: “Fix typo in BIAS-CHECKER installation steps”
- ❌ Bad: “fix” or “update” or “changes”
- Click the checkmark (✓) button to commit
- Or press
Ctrl+Enter
Step 8: Push to GitHub
Now your commit is local. Push it to GitHub to share it.
- In Source Control panel, look for the sync icon (⏫⏬) at the bottom
- Click “Sync Changes” or the sync icon
- VSCode pushes your branch to GitHub
- You might see a notification confirming the push
The first time you push, VSCode might ask for confirmation to publish the branch. Click “Publish Branch”.
Step 9: Create Pull Request on GitHub
A Pull Request (PR) proposes your changes for review and merging.
- Open your web browser
- Go to: https://github.com/itk-ai/learn-to-prompt-foo
- You should see a banner: “[your-username] has 1 push on branch [your-branch]”
- Click Compare & pull request
- If you don’t see the banner:
- Click the Pull requests tab
- Click New pull request
- Base:
main - Compare: your branch name (e.g.,
docs/improve-clarity) - Click Create pull request
Step 10: Fill in Pull Request Details
- Title: Describe your change
- Example: “Improve clarity in Session 2 installation steps”
- Description: Explain what you changed and why
- Example: “I found the installation instructions in Part 3 were unclear about the order of steps. I’ve reorganized them and added a clarifying example.”
- Review your changes in the “Files changed” tab
- Click Create pull request (not “Merge pull request”!)
Don’t merge your own PR! The instructor will review and merge it.
Step 11: Review Your Pull Request
- Click on the Files changed tab
- Verify your changes look correct
- Practice adding comments (optional):
- Hover over any line
- Click the + icon to add a comment
- This is how reviewers leave feedback
Part 5: Practice Undoing Mistakes
Git is your safety net. Let’s practice undoing changes.
Exercise A: Discard Uncommitted Changes
Warning: This is irreversible!
- Open any markdown file
- Make some changes (don’t commit)
- Open Source Control panel (
Ctrl+Shift+G) - Find your file under “Changes”
- Right-click on the filename
- Select “Discard Changes”
- Verify the file reverts to its original state
Exercise B: Undo a Commit
- Make a change to a file
- Stage it (click +)
- Commit with a message
- In Source Control panel, scroll to “Commits” section
- Find your commit
- Right-click on the commit
- Select “Undo Commit”
- The commit is undone, changes return to staging area
Important: Both “Discard Changes” and “Undo Commit” are irreversible operations. Always review before using!
VSCode Git Shortcuts
| Action | Keyboard Shortcut |
|---|---|
| Open Source Control | Ctrl+Shift+G |
| Open Terminal | Ctrl + ` |
| Save File | Ctrl+S |
| Format Document | Shift+Alt+F |
| Command Palette | Ctrl+Shift+P |
Next Steps
✅ Ready for Session 6
You now have Git set up and have practiced the complete workflow. In Session 6 (CONTRIBUTE.md), you’ll:
- Clone the prompfoo-docker repository
- Add your own promptfoo evaluation configs
- Create branches and commits
- Submit Pull Requests to contribute to the shared repository