Workshop 02 · Beginner · 120 min
Git & GitHub: Version Control, History Surgery & Collaboration
Local Repositories, Branching Trees, Resets, Cherry-Picks & GitHub Setup
A practical guide to version control on your computer: repository layout, git init, staging, commits, branching, merge conflicts, and GitHub collaboration.
Your branch is up to date with 'origin/main'.
2 files changed, 48 insertions(+)
5-chapter curriculum
Step-by-step progression from core ideas to working implementation
Installing Git & Local PC Environment Setup
Welcome to Workshop 02: Git & GitHub. Professional software engineering and data science require ironclad version control. Unlike cloud documents with opaque autosave, Git provides a distributed, cryptographic snapshot history of your entire project. In this chapter, you will install Git directly onto your local computer (macOS, Windows, or Linux), configure your global developer identity, and set up your command line environment.
The Three Trees: Initializing, Staging & Commits
To master Git, you must understand its internal mental model: **The Three Trees**. Unlike other version control systems that track file deltas, Git manages three distinct areas: your Working Directory, the Staging Area (Index), and the Git Repository history. In this chapter, you will initialize your first repository from scratch, inspect repository status, stage files with surgical precision, write atomic commit messages adhering to industry standards, and configure a production-grade .gitignore file.
Branching Workflows & Resolving Merge Conflicts
In professional engineering teams, developers never commit directly to the primary production branch (`main`). Instead, each new feature, bug fix, or data experiment is isolated on an independent **feature branch**. In this chapter, you will master Git's lightweight branching mechanism, execute smooth merges, demystify what causes merge conflicts, and resolve conflicts step-by-step like a senior engineer.
Time Travel & History Surgery: `git reset` (Soft, Mixed, Hard) & `git cherry-pick`
Every engineer makes mistakes: committing half-finished code, including accidental API keys, writing typo-ridden commit messages, or wanting a single bug-fix commit from an experimental branch without merging weeks of unfinished work. Git provides surgical time-travel primitives to handle these exact scenarios. In this chapter, you will master `git reset` across its three distinct modes (`--soft`, `--mixed`, `--hard`), understand why you should never reset public history (and use `git revert` instead), and perform surgical commit transplants using `git cherry-pick`.
Remote Repositories, GitHub Integration, `git push` & Pull Requests
Git is a powerful local tool, but its true superpower emerges when connected to remote hosts like **GitHub**. GitHub acts as a centralized cloud hub for your repositories, team collaboration, code reviews, and automated CI/CD pipelines. In this capstone chapter, you will connect your local machine's Git repository to GitHub, configure secure authentication, push changes with upstream tracking, synchronize upstream updates with fetch and pull, and master the industry-standard Pull Request (PR) workflow.
Practical project
Git mastery portfolio: multi-branch repository
Build a clean repository on your computer: initialize Git, add a .gitignore, isolate features on dedicated branches, resolve merge conflicts, and push to GitHub with upstream tracking.
Move edits cleanly between working tree, staging index, and object store.
Isolate experimental work on dedicated branches away from main.
Read conflict markers and merge divergent commit histories safely.
Attach remotes and push with git push -u origin main.
- Local CLI config (~/.gitconfig)
- Repository setup & .gitignore
- Atomic conventional commits
- Branching, merge & cherry-pick
- GitHub CLI auth & remote sync
Measurable competencies
- 01Install Git and GitHub CLI (gh), configure global identity, and authenticate via gh auth login
- 02Master the Three Trees architecture: initialize repos (git init), inspect status, stage files (git add), and write atomic commits
- 03Navigate, create, and manage branches with git branch, git checkout, and git switch, and resolve merge conflicts
- 04Master time travel: undo commits with git reset (--soft, --mixed, --hard), recover lost work with git reflog, and safely revert public commits
- 05Perform surgical commit transplants across branches with git cherry-pick
- 06Connect local repositories to GitHub (git remote add origin), push with upstream tracking, pull updates, and manage Pull Requests
Prerequisites & environment
- Completion of Workshop 01: Python Foundations (recommended)
- A personal computer (macOS, Windows, or Linux) with terminal access
- A free account on GitHub.com
Further reading
GeeksforGeeks introduction to GitHub
Visit GeeksforGeeks for additional GitHub repository and workflow reference