30 Minutes to Git Good
A hands-on Git workshop with real chaos, real fixes, and real exercises.
Setting the stage with a painful story everyone recognises
Meet the "DSP-backend" team: Ravi (dsp), Isha (dsp), Dhaval (QA), and Radhika (DevOps).
It's a Friday! Ravi sends final_api_v3_FINAL_USE_THIS.zip on Teams to Isha. Isha accidentally overwrites Ravi's API fix while editing the same file. Dhaval can't reproduce a bug because he doesn't know which version he's testing. Radhika is furious in the corner.
Git is the solution to this exact chaos. It's a version control system - like a magical "time machine + collaboration hub" for your code.
Think of it as: Draft → Review Table → Your Bookshelf → Public Library
Create a new repository on GitHub first (empty, no README), then run these commands locally:
Working Dir → Staging → Local Repo → Remote, which command moves code from Staging → Local Repo?
2 pts
git commit, the code is automatically visible on GitHub to your teammates.
2 pts
Commands your team will use 90% of the time
Dev comes in, opens his laptop, and starts coding directly on main… without pulling the latest changes. Priya had pushed a big refactor on Friday. Dev's about to have a very bad time.
The Golden Rule: Always git pull before you start working.
What happened: Sam pushed directly to main but got a rejection because Priya had also pushed in the meantime.
The Fix:
git config --global pull.rebase true so rebase is always the default.What happened: Tanu committed a half-finished feature directly to main instead of a feature branch.
git reset --hard unless you want to permanently discard changes!git add . and git add src/login.js? When should you prefer each?
2 pts
main. Write the 3-command sequence to undo and move the work to feature/noor-api.
3 pts
Work in parallel without stepping on each other
The Rocket team has 3 things to ship this week: Priya builds the OAuth login, Dev builds the dashboard redesign, and Sam writes the test suite.
If they all work on main - it'll be a disaster movie. With branches? Pure harmony.
Dev went on a deep coding tangent. His branch is now 47 commits behind main. Merging will be painful.
feature/dark-mode from main, commit "feat: add dark mode toggle", and push it.
3 pts
git merge main or git rebase origin/main? Explain the difference.
2 pts
git push --force vs git push --force-with-lease?
2 pts
The most feared Git moment, demystified
Priya and Dev both edited src/utils/auth.js line 42 at the same time. Priya's version checks for a null token. Dev's version adds a new JWT decoder.
When Dev pulls and merges - Git doesn't know whose version to keep. Git leaves breadcrumbs to help you decide.
You need to manually edit this file to combine both intentions, then mark it resolved.
git mergetool or VS Code's built-in conflict editor for a visual way to resolve.git revert instead - it's safer for shared branches.HEAD represent and what does origin/main represent?
2 pts
git add the resolved file. What error will Git show?
2 pts
git merge feature/dark-mode. Write the step-by-step process to resolve.
3 pts
git revert preferred over git reset --hard on shared branches?
3 pts
The unwritten rules that make great teams great
feat:, fix:, docs:, chore:, refactor:, test:Sam pushed a .env file with real API keys. This is a serious security incident.
pre-commit hooks to block .env pushes..env with DB credentials. Write the action plan: Git steps AND security actions.
4 pts
5 sections · 5 exercises · 30 minutes
Now go forth and Git Good together.
Edit the presentation as JSON. Saving stores it in this browser only (local storage), then reloads the page.