Git & GitHub —
Advanced Concepts
Fork workflows, pull requests, submodules, discussions, tags, and branch protection — the professional tools used in open-source and embedded firmware projects worldwide.
Fork a Repository
A Fork is your personal copy of someone else's GitHub repository. You cannot directly modify a repository you don't own — forking creates your own copy where you have full write access.
Fork → Modify → Pull Request. The standard open-source contribution workflow.
# Clone YOUR fork (not the original)
git clone https://github.com/satwik/ESP32-IoT-Dashboard.git
# Always create a feature branch — never work on main
git switch -c fix-readme-typoPull Requests
A Pull Request (PR) is a formal request to merge your changes into another repository. It's how open-source contribution works worldwide.
git status # check what changed
git add README.md # stage the file
git commit -m "Fix typo in README" # commit
git push origin fix-readme-typo # push the branchThen on GitHub, navigate to your fork. GitHub shows a Compare & Pull Request banner. Click it, write a clear title and description, and click Create Pull Request.
Code Review
Maintainers read your changes and can leave comments, suggestions, or approve them.
Quality Gate
CI checks run automatically on PRs — code must pass before it can be merged.
Portfolio Proof
Merged PRs are visible on your GitHub profile and prove real-world collaboration experience to recruiters.
Git Submodules
A Submodule allows one Git repository to contain another Git repository. Used in embedded projects to include shared libraries (FreeRTOS, LVGL, OLED drivers) as tracked dependencies.
The parent project tracks the submodule at a specific commit — always pinned to the version you tested with.
git submodule add https://github.com/user/oled-library.git lib/oled
git commit -m "Add OLED library as submodule"
git pushGit creates a .gitmodules file tracking the URL and version. Common in embedded projects for FreeRTOS, LVGL, TensorFlow Lite, and ESP-IDF components.
GitHub Discussions
Discussions are community forums built directly into repositories — a space for conversations that aren't bug reports or feature requests.
Enable Discussions
Repository → Settings → Features → Discussions → Enable. Then open the Discussions tab, click New Discussion, select a category (General, Ideas, Q&A), and start the conversation.
Git Tags
A Tag is a permanent label attached to a specific commit. Unlike branches (which move forward), tags stay fixed — making them perfect for marking firmware releases.
git tag -a v1.0.0 -m "First stable firmware release"
git push origin v1.0.0 # push this specific tag
git push --tags # push all tags at once
git tag # list all tags| Feature | Branch | Tag |
|---|---|---|
| Moves forward? | ✅ Yes | ❌ No — stays fixed |
| Used for development? | ✅ Yes | ❌ No |
| Used for releases? | ❌ Usually no | ✅ Yes |
| Can receive new commits? | ✅ Yes | ❌ No |
Branch Protection Rules
Branch Protection prevents unsafe changes from being pushed directly to important branches like main. Without protection, any team member can accidentally push broken code directly to the stable branch.
Configure Protection
Repository → Settings → Branches → Add branch protection rule → select main.
Require Pull Requests
No direct pushes to main. All changes must go through a PR with review.
Require Status Checks
GitHub Actions must pass (build, tests, lint) before any merge is allowed.
Require Reviews
At least one approving review required. No self-merging.
Require Up-to-Date
Branch must include latest main before merging — prevents stale PRs.
Professional Workflow With Protection
Professional Workflow Summary
| Concept | Purpose | Key Command/Action |
|---|---|---|
| Fork | Personal copy of another repo | GitHub UI → Fork button |
| Pull Request | Request to merge changes | GitHub UI → Compare & PR |
| Submodule | Repo inside another repo | git submodule add |
| Discussions | Community conversations | Repo → Discussions tab |
| Tag | Permanent release marker | git tag -a v1.0.0 |
| Branch Protection | Prevent unsafe changes | Settings → Branches |
- Always work on feature branches — never commit directly to
main. - Use PRs for everything — code review makes code better, always.
- Protect
mainwith branch rules — keep it always stable and flashable. - Tag every release — you must be able to reproduce any firmware version exactly.
- Use submodules for shared libraries — pin external dependencies to known-good versions.
- This is the workflow used in professional software, firmware, embedded systems, DevOps, and open-source projects worldwide.
Git & GitHub — Advanced Concepts · Embedded Systems Foundations