📊 Assessment Module 0.3 4 Sections · 20 Questions

Git & GitHub —
Version Control Assessment

Verify your understanding of Git version control and GitHub workflows for professional embedded systems development — from four-stage commits to CI pipelines.

Module0.3 — Git and GitHub
TopicVersion Control Fluency for Embedded Systems
PurposeSafe version control practices & collaboration

About This Assessment

This assessment verifies that you understand how Git and GitHub are used in professional embedded software development, can apply safe version control practices, and are ready to collaborate and recover from common mistakes throughout the course.

Section A — Multiple Choice

10 questions covering core Git concepts, safety, and workflow.

✏️

Section B — Short Answer

5 questions requiring detailed written explanations.

🧠

Section C — Scenario-Based

4 real-world Git troubleshooting and decision-making scenarios.

📋

Section D — Verification Checklist

16-item checklist confirming every Git and GitHub setup step.

ASection A

Multiple Choice Questions

Each question shows the verified correct answer and the reasoning behind it.

A1
The Git four-stage model is:
Correct Answer
(b) Working Directory → Staging Area → Local Repository → Remote Repository
Explanation

Git manages files through four important stages. Understanding these stages makes every Git command easier to reason about, because every command operates on exactly one of them.

Working Directory create & edit files git add Staging Area selected changes git commit Local Repository commits on your machine git push Remote Repository GitHub git pull / git fetch

Every Git command operates on exactly one of these four stages. git add moves changes from the working directory to staging; git commit records them locally; git push uploads them to GitHub.

A2
What does git add -p do that git add <file> does not?
Correct Answer
(b) Lets you stage individual hunks interactively.
Explanation

git add <filename> adds the entire file to staging. git add -p starts Patch Mode, where Git asks whether each small section (called a hunk) should be staged. This is useful when one file contains multiple unrelated changes — you can commit only the required change while leaving the rest for a separate commit.

git add filename
Stages the WHOLE file. All changes in one commit.
git add -p
Stages SELECTED hunks. Different concerns in separate commits.
A3
git stash is most useful when:
Correct Answer
(b) You have uncommitted changes but need to switch branches temporarily.
Explanation

Sometimes you’re developing a feature when an urgent bug needs fixing in another branch. If your work is incomplete, Git prevents switching branches. git stash saves all uncommitted changes without creating a commit, so you can switch safely and restore with git stash pop.

Unfinished Work feature/uart (WIP) git stash Stash Stack changes saved git switch main Fix Bug main branch git switch feature/uart → git stash pop Work Restored

git stash acts as a temporary drawer for unfinished work — save it, switch context, come back and pop it out exactly where you left off.

A4
Why is .gitignore critical for an embedded project?
Correct Answer
(b) Prevents committing build artifacts, credentials, and unnecessary system files.
Explanation

Embedded projects generate many temporary files during compilation (.pio/, build/, .vscode/, *.log). These increase repository size, change constantly, and can expose private information like Wi-Fi credentials. A .gitignore file tells Git which files and folders should never be tracked.

A5
What does git reset --hard HEAD do?
Correct Answer
(a) Permanently deletes all uncommitted changes in tracked files.
Explanation

This command restores the project to the most recent commit, removing all modified files, staged changes, and uncommitted edits. The deleted changes cannot normally be recovered. Use this command with care.

A6
Why is git revert <commit> preferred over git reset for pushed commits?
Correct Answer
(b) It creates a new commit that safely undoes the previous commit while preserving project history.
Explanation

There are two ways to undo commits. git reset removes commits from history, rewrites the timeline, and is unsafe after pushing to GitHub. git revert creates a new commit that reverses the previous changes, keeps the complete history intact, and is safe for shared repositories.

✗ git reset — rewrites history A B C D deleted! → becomes → A B C History rewritten — breaks remote ✓ git revert — preserves history A B C D kept in history D’ reverts D D’ is a new commit that undoes D — history intact ✓

git reset rewrites history — dangerous on pushed commits. git revert adds a new undoing commit and leaves history untouched.

A7
A good Git commit message subject line is:
Correct Answer
(b) Imperative mood, no more than 50 characters.
Explanation

Professional Git projects follow a standard commit message style — short, action-oriented, and in the imperative mood (as if giving an instruction).

✓ Good examples
Add UART driver Fix SPI timeout Update README
✗ Bad examples
Added UART driver Fixing bug Stuff
A8
Why is Two-Factor Authentication (2FA) mandatory for GitHub?
Correct Answer
(b) A leaked password can allow attackers to access repositories, secrets, and CI pipelines.
Explanation

GitHub repositories often contain important source code. With only a stolen password, an attacker could delete repositories, upload malicious code, access CI/CD secrets, and cause serious damage. With 2FA enabled, logging in also requires a second verification step, making unauthorized access significantly harder.

A9
What is the difference between git merge main and git rebase main?
Correct Answer
(a) Merge preserves history with a merge commit, while rebase creates a cleaner, linear history.
Explanation

Merge keeps the original branch history and creates a merge commit — safe for collaborative work. Rebase moves feature commits on top of the latest main branch, producing a clean, linear history, but rewrites commit history. For solo projects, rebase often creates a cleaner history; merge is generally safer for team collaboration.

A10
Git tags are mainly used for:
Correct Answer
(a) Marking software releases such as v1.0.0.
Explanation

A Git tag marks an important point in the project’s history. Tags are used to mark stable firmware releases, create GitHub Releases, track software versions, support OTA firmware updates, and allow developers to easily return to a previous stable version.

BSection B

Short Answer Questions

Detailed written answers in your own words.

B1
Explain why the course mandates “commit and push after every session, even WIP commits.” What goes wrong if you don’t?

Committing and pushing after every work session is one of the most important Git practices. Even when a project is incomplete, saving current progress ensures the work is safely stored and recoverable.

  • Prevents data loss. Computers crash, storage fails, and files get deleted. If the latest changes are already pushed to GitHub, the project can be restored at any time.
  • Creates backup copies. GitHub acts as an online backup. Instead of keeping the only copy locally, code is safely stored in a remote repository.
  • Makes debugging easier. Each commit is a checkpoint. If a bug appears after several changes, Git can compare commits to identify exactly when the problem was introduced.
  • Encourages small, organized commits. Frequent commits each contain one logical change (“Add UART initialization”, “Fix SPI timeout”), which are far easier to review than one enormous commit.
  • Helps collaboration. Everyone on the team can see the latest progress after each push, and the remote remains available from any computer.

Without regular commits, you risk losing work to hardware failure, struggling to locate the source of a bug, accumulating unmanageable commits, and accidentally destroying unfinished code with a careless git reset --hard.

B2
Walk through, using Git commands, how you would: create a feature branch for a new UART driver, commit a partial implementation, switch back to main to fix a bug, and return to the feature branch later.

Suppose we need to develop a new UART driver without affecting the stable main branch.

1
Create a feature branch
Create and immediately switch to a new branch.
2
Stage the driver files
Move only the relevant files into the staging area.
3
Commit the partial implementation (WIP commit)
Even though the driver is incomplete, this commit safely stores the current progress.
4
Switch to main for the urgent fix
Since the work is committed, switching is straightforward. If there are unstaged changes, git stash first.
5
Commit and push the bug fix
6
Return to the feature branch
If a stash was used, restore it with git stash pop.
bash — complete command sequence
# 1. Create and switch to the feature branch
git switch -c feature/uart-driver

# 2. Stage the driver files
git add uart_driver.c uart_driver.h

# 3. WIP commit
git commit -m "Add UART driver scaffold"

# 4. Switch to main (use git stash first if you have uncommitted changes)
git switch main

# 5. Fix the bug, commit, and push
git add .
git commit -m "Fix startup bug"
git push

# 6. Return to the feature branch (restore stash if applicable)
git switch feature/uart-driver
git stash pop    # only if stash was used
💡
Why This Works
Feature branches keep experimental or incomplete code completely isolated from the stable main branch. The main branch always compiles and runs correctly, while new features develop independently until they’re tested and ready to merge.
B3
You accidentally committed and pushed your Wi-Fi credentials to GitHub. What should you do?

If Wi-Fi credentials are pushed to GitHub, they should be treated as compromised immediately, even if the repository is private.

1
Change the Wi-Fi password immediately
Assume the credentials have been exposed the moment they were pushed.
2
Remove credentials from Git history
Simply deleting the file is not enough — it still exists in previous commits. Use git filter-repo or BFG Repo-Cleaner to permanently remove the sensitive file from all history.
3
Force push the cleaned repository
git push --force replaces the remote history with the cleaned version.
4
Inform collaborators
Anyone who cloned the repo still has the old history. They must re-clone or reset to the new history.
5
Add the file to .gitignore
Add wifi_credentials.h, secrets.h, and .env so Git never tracks them again.
6
Commit a template file instead
Create wifi_credentials_example.h with placeholder values. Users copy it and fill in their own credentials locally. The real credentials file stays untracked.
B4
What is a sensible branching strategy for solo embedded development?

A simple branching strategy keeps projects organized and prevents bugs from entering stable firmware.

Main branch: always contains stable, compiling, hardware-tested code. Only merge tested features into this branch.

Feature branches: one branch per new feature (feature/uart, feature/spi, feature/bluetooth). Keeps experimental code away from stable firmware.

Bug-fix branches: dedicated branches like fix/spi-timeout keep maintenance work organized.

Merge only after testing: a feature merges into main only after successful compilation, no build errors, and hardware testing.

Tag stable releases: create tags (v0.1, v0.5, v1.0) at each stable version so you can always return to a known-good state.

A B C v1.0 tag main feature/uart feature/spi

Main stays stable while features develop in isolation. Both branches merge only after testing, and a tag captures the stable release.

B5
What does it mean to add SSH keys to GitHub, and why is it preferred over password authentication?

SSH keys provide a secure way to authenticate with GitHub without entering a password on every push or pull. An SSH key consists of two parts: a private key (stored securely on your computer, never shared) and a public key (uploaded to GitHub). Both keys work together to verify identity securely.

  • Better security. SSH keys are cryptographically much harder to steal or guess than passwords.
  • No password prompt. After setup, git push and git pull work silently and instantly.
  • Required by GitHub. GitHub removed password authentication for Git operations. Developers must now use SSH keys or Personal Access Tokens.
  • Easy to revoke. If a device is lost, remove only that device’s SSH key from GitHub — no need to change the account password.
  • Works in automation. SSH authentication integrates cleanly with CI/CD pipelines, build servers, and automation scripts.
CSection C

Scenario-Based Questions

Real-world Git situations you’ll encounter in embedded development.

C1
You accidentally committed a 200 MB build folder because you forgot to add it to .gitignore. The commit has not been pushed yet. How would you clean it up?

Since the commit has not yet been pushed, the mistake can be corrected safely without affecting anyone else.

1
Undo the last commit (keep files in staging)
git reset --soft HEAD~1 — removes the commit from history but keeps files intact.
2
Remove the build folder from staging
git restore --staged build/ (or .pio/ for PlatformIO projects) — unstages only the build directory while leaving source files staged.
3
Update .gitignore
Add build/, .pio/, .vscode/, *.log, and *.tmp so these files are never committed again.
4
Stage only the correct files
git add . — Git will automatically exclude everything listed in .gitignore.
5
Create a clean commit
git commit -m "Add source files and update gitignore"
6
Verify before pushing
Run git status and git ls-files to confirm the build folder is no longer tracked, then push.
⚠️
If It’s Already Pushed
Use git filter-repo or BFG Repo-Cleaner to remove the large folder from all history, then force-push. This is the same process as removing leaked credentials — treat a pushed large-file mistake as a history rewrite.
C2
GitHub Actions is used for Continuous Integration (CI). What is the minimum useful CI workflow for a PlatformIO STM32 project?

Continuous Integration automatically builds and tests a project whenever new code is pushed to GitHub. Even a simple workflow significantly improves reliability by confirming that the project compiles on a clean machine every time.

The minimum useful workflow for a PlatformIO STM32 project should: trigger on every push and pull request, check out the repository, install PlatformIO, download all project dependencies, run pio run to compile the firmware, and report the result as a pass or fail status.

Push Code → GitHub GitHub Actions Starts Checkout Repository Install PlatformIO Download Dependencies pio run → Build ✓

Even this minimal pipeline catches compilation errors before they become someone else’s problem, and confirms all dependencies are correctly configured.

C3
Your feature branch is behind the main branch. Should you use Merge or Rebase?

When main has received new commits, the feature branch should be updated before merging. Both merge and rebase update the branch but produce different histories.

git merge main
Preserves full history.
Creates a merge commit.
Safe for shared branches.
Best for team collaboration.

History is non-linear but complete.
git rebase main
Rewrites history.
No merge commit.
Creates a clean linear log.
Best for solo projects.

Easier to read but rewrites commits.
git merge — history preserved A B C E F M merge commit git rebase — linear history A B C E’ F’ replayed on top Non-linear, complete history Linear, clean — commits rewritten

For solo embedded projects, rebase produces a cleaner, easier-to-read history. For team work, merge is safer as it doesn’t rewrite shared commits.

C4
How do you pin your best six repositories on GitHub, and why should you do it?

GitHub allows users to highlight up to six public repositories on their profile page. Pinned repositories are typically the first projects viewed by instructors, recruiters, and employers.

1
Open your GitHub profile
2
Click Customize your pins
3
Select up to six public repositories
4
Save — those repositories appear at the top of your profile

Choose the projects that best demonstrate your embedded systems skills: STM32 Driver Development, ESP32 IoT Project, BLE Application, FreeRTOS Project, LVGL HMI, or RS-485 Communication Project.

Pinning improves your professional profile by highlighting your strongest work, making your page more organized, and helping recruiters quickly evaluate your skills for internships and job applications.

DSection D

Git & GitHub Setup Verification Checklist

Completing every item confirms the development environment is ready for version control, collaboration, CI, and all future embedded projects.

ItemVerification Method
Git version ≥ 2.40git --version shows 2.40 or later
Git Username Configuredgit config --global user.name returns your name
Git Email Configuredgit config --global user.email returns your email
Default Branch Set to maingit config --global init.defaultBranch main
SSH Key Generated (ed25519)Public and private SSH keys created successfully
SSH Key Added to GitHubSSH public key uploaded to GitHub account settings
SSH Authentication Verifiedssh -T git@github.com shows successful authentication
Two-Factor Authentication EnabledGitHub account protected using 2FA
Recovery Codes SavedRecovery codes stored safely offline
Repository Createdembedded-journey repository created on GitHub
README.md AddedProject description committed
LICENSE AddedMIT or another suitable license committed
.gitignore AddedIgnore file committed with required patterns
First Commit PushedInitial project uploaded to GitHub successfully
GitHub Profile CompletedProfile photo, bio, and pinned repositories added
VS Code Git Integration WorkingSource Control panel detects the repository

Verification Details

1
git --version → e.g. git version 2.45.1
2
git config --global user.name → your name
3
git config --global user.email → your email
4
git config --global init.defaultBranchmain
5
ssh -T git@github.comHi username! You’ve successfully authenticated.
6
GitHub Settings → Password and Authentication → 2FA: enabled
7
Repository embedded-journey is public and visible on GitHub
8
git log --oneline → shows Initial commit
9
.gitignore contains .pio/, build/, *.log, .env, wifi_credentials.h
10
VS Code Source Control panel shows branch name and modified files

Recommended .gitignore Content

.gitignore — embedded project
.pio/
build/
.vscode/
*.log
*.tmp
*.swp
.DS_Store
Thumbs.db
.env
wifi_credentials.h
secrets.h
Summary

Self-Grade Rubric

CriterionMaximum MarksSelf Marks
All setup items completed14_____
.gitignore contains at least 8 relevant patterns4_____
Commit messages follow professional conventions4_____
GitHub Actions workflow added to a project3_____

Total Marks: 25

Best Practices Learned

✅ Professional Git practices from this module
  • Commit changes frequently and push after every work session.
  • Write meaningful commit messages in the imperative mood, under 50 characters.
  • Keep the main branch stable — only merge tested, working code.
  • Use feature branches for all new development.
  • Ignore build artifacts, credentials, and system files using .gitignore.
  • Protect the GitHub account with Two-Factor Authentication.
  • Use SSH keys for secure, password-free authentication.
  • Tag stable firmware versions (v0.1, v0.5, v1.0).
  • Use GitHub Actions for Continuous Integration to verify every push compiles.
  • Maintain a clean and professional GitHub profile with pinned repositories.
  • Prefer git revert over git reset for pushed commits.
  • Use git stash when you need to switch context without losing WIP work.
📚Close

Overall Summary

This assessment introduced the essential Git and GitHub concepts required for professional embedded software development.

Throughout this module, we learned how Git tracks changes using the four-stage workflow, how to safely manage code with commits, branches, stashes, and tags, and how to recover from common mistakes such as accidentally committing large build folders or exposing sensitive credentials.

We also explored professional development practices — writing meaningful commit messages, organizing work using feature branches, securing GitHub with SSH keys and Two-Factor Authentication, and using GitHub Actions to automatically verify that projects build successfully on every push.

Finally, we verified the complete Git and GitHub setup through a practical checklist, ensuring the development environment is fully prepared for future embedded systems projects. By mastering these concepts, developers can confidently manage source code, collaborate effectively, maintain clean project histories, and build reliable embedded software using industry-standard version control practices.

End of Assessment — Module 0.3

Embedded Systems Foundations — Assessment, Module 0.3: Git and GitHub