Soheil7799/workshop-git

git exercises

★ 0Forks 1PythonGitHub ↗Compare

README

Git Workshop

A hands-on collection of Git exercises with an interactive CLI tool.

Quick Start

python workshop.py

This opens an interactive menu where you can browse and set up exercises with arrow keys.

Alternative Usage

python workshop.py --list       # List all exercises
python workshop.py 3            # Set up exercise 3 directly

Requirements

  • Python 3.6+
  • Git

No external Python packages needed.

How It Works

  1. Run workshop.py and pick an exercise
  2. The tool creates a pre-configured git repository in the exercise's exercise/ folder
  3. cd into the exercise/ directory
  4. Follow the instructions in the exercise's README.md

Exercises

Part 1: Creating Snapshots

# Exercise Concepts
01 Init and Status git init, git status
02 Staging and Committing git add, git commit
03 Viewing Changes git diff, git diff --staged
04 Ignoring Files .gitignore
05 Undoing Local Changes git restore, git clean

Part 2: Browsing History

# Exercise Concepts
06 Browsing History git log, git show, filtering
07 Detached HEAD git checkout <hash>
08 Blame and Tagging git blame, git tag
09 Bisect git bisect

Part 3: Branching & Merging

# Exercise Concepts
10 Creating Branches git branch, git switch
11 Stashing git stash
12 Fast-Forward Merge git merge (fast-forward)
13 Three-Way Merge git merge (diverged branches)
14 Merge Conflicts Conflict resolution
15 Rebasing git rebase
16 Cherry Picking git cherry-pick

Part 4: Collaboration

# Exercise Concepts
17 Cloning and Fetching git clone, git fetch
18 Pushing and Pulling git push, git pull
19 Remote Branches git push -u, git branch -r

Part 5: Rewriting History

# Exercise Concepts
20 Amend git commit --amend
21 Reset git reset --soft/--mixed/--hard
22 Revert git revert
23 Interactive Rebase git rebase -i
24 Reflog git reflog

Cleanup

To remove all exercise working directories:

find exercises -name "exercise" -type d -exec rm -rf {} +

Contributors

Soheil7799

Issues