Goal: clone a private repository, work on a branch, verify/stage a focused change, write a Conventional Commit, and open a reviewable pull request.
Prerequisites: your GitHub account can open the relevant repository in a browser and has accepted any organization invitation.
Execution context: Git commands run on your local computer in Windows PowerShell/Git Bash, macOS zsh, or Linux Bash. The same commands can run on a remote development machine only when the project intentionally lives there.
Required practice: First Safe Pull Request.
Table of Contents#
- Why Git?
- Semantic Commits (SemVer-friendly)
- Prerequisites
- Create / Upgrade Your GitHub Account
- Install Git
- Set Up GitHub Authentication
- Configure Git Identity
- Connect VS Code to GitHub
- Everyday Workflow
- Best Practices
- Cheat-Sheet
- Collaboration Example — "wing + fuselage"
Why Git?#
- Time-machine: Revert any file or the whole project to a previous state.
- Collaboration: Multiple people work in parallel with branches.
- Traceability: Commit history shows who changed what and why.
Semantic Commits (SemVer-friendly)#
Use Conventional Commits from day one so release tagging and versioning can be automated later.
Important distinction:
- Semantic Versioning (SemVer) is for release numbers (
MAJOR.MINOR.PATCH). - Conventional Commits is for commit message format.
- Conventional Commit history can be used to compute SemVer bumps automatically.
Commit message format:
type(scope): short summary
What scope means (very important for beginners):
scope= the main area you changed (module, folder, or feature).- Keep it short: usually 1 word, sometimes 2 (
first_steps,git_workflow,training). - Use lowercase and no spaces (use
_if needed). - Pick the dominant change only. If unsure, use
general.
Recommended type values:
feat: new functionalityfix: bug fixdocs: documentation changerefactor: code restructure without behavior changetest: tests added/updatedchore: tooling/maintenance
Examples:
feat(data): add CSV loader for tensile tests
fix(training): handle empty validation split
docs(onboarding): clarify Obsidian vault root
chore(general): update dev dependencies
SemVer mapping (used when creating releases):
fix:-> PATCH bumpfeat:-> MINOR bumpfeat!:orBREAKING CHANGE:footer -> MAJOR bump
Prerequisites#
| Tool | Windows | macOS / Linux |
|---|---|---|
| Git CLI | Installer | brew install git · apt install git |
| VS Code | Download | same link (.dmg / .deb / .rpm) |
| GitHub account | create / sign-in (next section) | — |
Run
git --versionin a terminal to verify install.
Create / Upgrade Your GitHub Account#
- Sign up at https://github.com/ or sign in.
- Enable MFA and store recovery codes in an approved password manager.
- Accept the IDEAL Lab organization/repository invitation.
- Confirm you can open the private repository in the browser before cloning.
For the recommended no-cost AI-agent route, apply for or confirm GitHub Education after the browser-access check:
- Open https://github.com/settings/education/benefits.
- Add and verify your ETH email if GitHub requests it.
- Complete GitHub's current student-verification process.
- After approval, activate GitHub Copilot Student from the benefits page.
GitHub Education is not required to read or clone an IDEAL Lab repository, but it is required for the no-cost Copilot Student benefit. Verification can take time. Continue the manual Git workflow while waiting; do not purchase Copilot or another AI plan merely to complete onboarding. Follow the canonical Copilot Student setup only after the manual FirstSteps change.
Install Git#
Windows#
- Run the Git for Windows installer.
- Keep defaults — especially “Git from the command line and 3rd-party software”.
- Open Git Bash or PowerShell →
git --version.
macOS / Linux#
- macOS: Just run
git --version- macOS will automatically prompt you to install Xcode Command Line Tools (includes Git) - Ubuntu:
sudo apt update && sudo apt install git. - Fedora:
sudo dnf install git.
Set Up GitHub Authentication#
Goal: authenticate without teaching unsafe token habits.
Recommended order:
- VS Code OAuth for beginners working mostly inside VS Code.
- GitHub CLI for terminal users:
gh auth login. - SSH keys for repeated development and remote machines.
- Fine-grained PATs only when OAuth, CLI, or SSH are not suitable.
Option A: VS Code OAuth#
- VS Code → Accounts icon → Sign in with GitHub.
- Browser opens → approve access.
- Clone private repositories from VS Code or the terminal.
This is the safest beginner default because VS Code stores credentials in the operating-system credential store.
Option B: GitHub CLI#
Install GitHub CLI from https://cli.github.com/ and run:
gh auth login
gh auth status
Choose GitHub.com, HTTPS or SSH, and follow the browser login. This avoids copying tokens into terminals, chats, or notes.
Option C: SSH Keys#
Use SSH for repeated Git operations when it fits the machine and network. Follow GitHub's current SSH key procedure, which includes checking for existing keys before generating one. Add only the public key to GitHub. Never share, upload, or commit the private key.
Do not copy a laptop private key to Euler. Authentication from Euler requires a separate approved choice such as GitHub CLI on Euler or deliberately configured agent forwarding; ask the project owner when unsure.
Option D: Fine-Grained PATs#
Use a fine-grained personal access token only when required by a specific tool. Make it short-lived, repository-limited, and permission-limited. Paste it only into the tool's credential prompt, never into an AI chat or Markdown file.
Avoid broad classic PATs unless a platform limitation truly requires one.
Configure Git Identity#
git config --global user.name "Your Real Name"
git config --global user.email "your-verified-email@example.org"
git config --global core.editor "code --wait" # VS Code as default editor
Connect VS Code to GitHub#
VS Code ships with the GitHub auth extension built-in.
Option A – OAuth (1-click sign-in)#
- VS Code → click the Accounts icon (bottom-left).
- Choose Sign in with GitHub.
- Browser opens → approve access → VS Code refreshes.
- Token saved in OS keychain / credential manager.
Option B – Personal Access Token (PAT)#
- GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens.
- Select only the repository or organization you need.
- Grant the minimum required permissions, usually Contents: read/write and Metadata: read for Git operations.
- Set an expiration date and copy the token (shown once!).
- VS Code → Accounts icon → Sign in with GitHub → Paste authentication token.
Use PATs only if OAuth, GitHub CLI, or SSH are blocked on shared / VM environments. Never paste a PAT into an AI chat, notebook, Markdown file, or screenshot.
Everyday Workflow#
Clone a Repository#
- Copy repo URL from GitHub (
https://github.com/org/project.git). - VS Code → ⌘/Ctrl + ⇧ + P → Git: Clone → paste URL.
- Choose local folder → open workspace when prompted.
Create & Switch Branches#
- Status bar (bottom-left) shows current branch → click → Create new branch… (e.g.
feature/my-analysis). - Pick any branch in the list to switch.
Stage → Commit → Push#
- Change files → open Source Control (sidebar).
- + beside file or Stage All.
- Write a Conventional Commit message (for example
fix(parser): handle empty rows) → Commit (✓). - Click Push/Synchronize (↥) in the status bar.
Safer command-line equivalent while learning. Replace the two example paths
with files shown by your own git status:
git status --short
git diff
git add -- src/module.py tests/test_module.py
git diff --cached
git commit -m "type(scope): short summary"
git push -u origin HEAD
AI Prompt for Commit Messages#
If you use Copilot/LLM tools, prompt like this:
From my staged git diff, write exactly ONE Conventional Commit message.
Rules: use type(scope): summary, where type is feat|fix|docs|refactor|test|chore;
scope must be the main changed area (module/folder/feature), lowercase, no spaces,
use general if unclear; imperative mood; max 72 chars; no trailing period;
output only the message.
Then paste the result into:
git commit -m "fix(scope): describe the verified change"
Before committing, run git diff --staged and check that the message matches
the actual change. Do not let an agent invent scope or tests that did not happen.
Pull / Sync Changes#
- Click Pull (↧) or ⌘/Ctrl + ⇧ + P → Git: Pull.
- VS Code auto-merges or prompts on conflicts.
Open a Pull-Request#
- After pushing branch, VS Code shows Create Pull Request.
- Fill title / description → target
main. - Supervisor reviews & merges.
AI-Assisted PR Summary and Review#
Use agents to make review easier, not to bypass review.
Good prompt:
From my branch diff against main, draft a PR summary.
Include: what changed, why, interfaces or users affected, risk areas, and
verification I actually ran.
Do not invent tests or claim checks passed unless they appear in my terminal output.
Good review prompt:
Review this diff for bugs, missing tests, secret leaks, and over-broad changes.
Prioritize correctness and safety over style.
Return findings with file/line references where possible.
Human checklist before merge:
- You understand every file changed.
- You identified affected interfaces and downstream users, or stated
None. - You requested review from the owner of an affected interface when applicable.
- Generated code has tests or a smoke check.
- No secrets, datasets, checkpoints, or local config were added.
- The PR description lists real verification output.
Best Practices#
- Branch per task:
feature/...,bugfix/...,doc/.... - Atomic commits: one logical change each.
- Use Conventional Commits always:
type(scope): short summary. - .gitignore: exclude large data & secrets.
- Fetch and inspect shared changes: synchronize deliberately before merge.
- Never commit directly to
main: always PR. - Review AI diffs carefully: the model can be fluent and wrong.
- Give agents constraints: files to inspect, files not to touch, checks to run.
- Never paste secrets into prompts: use OAuth, SSH,
gh auth login, or credential prompts.
Cheat-Sheet#
| Action | Git CLI | VS Code UI |
|---|---|---|
| Clone | git clone <url> |
⌘/Ctrl + ⇧ + P → Git: Clone |
| New branch | git switch -c mybranch |
Status bar → New branch |
| Stage selected | git add <path>... |
+ beside intended files |
| Commit | git commit -m "type(scope): short summary" |
Commit (✓) |
| Push | git push -u origin mybranch |
↥ icon |
| Pull | git pull |
↧ icon |
| Log graph | git log --oneline --graph --all |
Git: View History |
Collaboration Example — “wing + fuselage”#
🧠 Concept#
- You develop on branch
wing - Colleague develops on
fuselage - Integration branch
integrate-wing-fuselageis where both sets of work meet for testing. - Git handles merging — no manual file copies.
🚀 Step-by-Step in VS Code#
| # | Task | VS Code / Command |
|---|---|---|
| 1 | Update local main | Checkout main → Pull (↧) |
| 2 | Create integration branch | Status-bar → New branch → integrate-wing-fuselage → Push |
| 3 | Merge wing into integration | Checkout integrate-wing-fuselage → ⌘/Ctrl + ⇧+ P → Git: Merge Branch… → select wing → resolve conflicts → Commit merge → Push |
| 4 | Merge fuselage | Repeat step 3 selecting fuselage |
| 5 | Test together | Both developers checkout integrate-wing-fuselage and run tests |
| 6 | Keep working | Continue on wing / fuselage; periodically repeat merges |
| 7 | Final PR → main | When integration branch is green, open PR to main, request review, merge |
💡 Extra Tips#
- Pull first, merge later — sync integration branch before merging feature branches.
- Use VS Code conflict helpers: Accept Current, Accept Incoming, Accept Both.
- Open draft PRs early to share progress and trigger CI.
- Delete branches after they’re merged to keep the repo tidy.
Expected Result And Verification#
git status --short --branchnames a task branch, notmain.git diff --cachedcontains only intended changes.- The commit uses
type(scope): summaryand matches the diff. - The PR lists only verification actually performed.
- No credential, data, checkpoint, local environment, or generated result is present.
Common Failures And Safe Recovery#
- Private clone fails: confirm browser access and authentication; do not put a token in the URL.
- Wrong file staged: run
git restore --staged <path>to keep the local edit but remove it from the staged diff. - Unwanted unstaged agent edit: inspect
git diff, then restore only the specific unwanted path. Do not usegit reset --hard. - Secret committed: revoke it immediately, notify the repository owner, and coordinate any history cleanup.
- Push rejected: fetch and inspect the remote branch; do not force-push a shared branch without explicit coordination.
Ask For Help When#
Recovery would rewrite shared history, authentication requires a token you do not understand, a secret entered history, or merge conflicts include unfamiliar project changes.
Verified: 2026-08-26. Review by: 2026-11-26. Owner: lab software maintainer.