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.

5 chapters·120 min schedule·Basic prior experience required
git-bashlocal repo
$git status
On branch main
Your branch is up to date with 'origin/main'.
$git switch -c feature/portfolio
Switched to a new branch 'feature/portfolio'
$git commit -m "feat: branch workflow"
[feature/portfolio a1b2c3d] feat: branch workflow
2 files changed, 48 insertions(+)

5-chapter curriculum

Step-by-step progression from core ideas to working implementation

5 chapters · 120 min
01

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.

20 min·4 sections·1 exercise
Open lesson
02

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.

25 min·4 sections·1 exercise
Open lesson
03

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.

25 min·4 sections·1 exercise
Open lesson
04

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`.

25 min·4 sections·1 exercise
Open lesson
05

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.

30 min·4 sections·1 exercise
Open lesson

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.

01Three-tree mental model

Move edits cleanly between working tree, staging index, and object store.

02Feature branching

Isolate experimental work on dedicated branches away from main.

03Conflict resolution

Read conflict markers and merge divergent commit histories safely.

04GitHub remotes & upstream

Attach remotes and push with git push -u origin main.

Git skills covered
  • 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

Open GeeksforGeeks