Git & GitHub 101 · Hands-on workshop
Git & GitHub 101, from first commit to a live portfolio.
Arlou Beloria
Every command group ends with an activity, and every activity leaves you with something to keep.
Part 01 / 06
What version control is, who made Git, and how GitHub fits in.
Which one is the real one? What changed between v2 and v3? Who broke it?
Version control answers all three, with one folder.
The analogy
Mess up the boss fight? Reload your previous save. Every commit is a save point you can return to.
Linus Torvalds, in 2005, after the Linux kernel team lost access to the tool they were using. He wrote a replacement in about two weeks.
~2 wks
to write the first working version
2005
released, still the standard 20+ years on
"git"
British slang; he named it after himself, as a joke
The tool
Git
Runs on your laptop. Tracks every change. Works offline.
The place
GitHub
A website that hosts Git repositories. Backup, sharing, collaboration.
You can use Git without GitHub. You cannot use GitHub without Git.
Git signs every snapshot with a name and email. Set yours once and never again.
Checkpoint: paste your git --version output in the chat.
Part 02 / 06
An SSH key is a password your computer types for you.
Private key
Stays on your laptop. Never share it, never paste it anywhere.
⇄
Public key
Goes to GitHub. When you push, the two keys shake hands.
No passwords to type, no tokens to expire mid-workshop.
SSH key
Tonight's path. One key pair per machine, set up once, never typed again.
HTTPS + token
Clone over https:// and paste a Personal Access Token where it asks for a password. Works where the network blocks SSH.
gh auth login
The GitHub CLI walks you through it in the terminal and stores the credential for you.
Desktop or VS Code
Sign in inside the app once and it handles the credential silently. No terminal needed.
Your own laptop: SSH. A work or shared machine: HTTPS with a fine-grained token you can revoke.
Checkpoint: "Hi username! You've successfully authenticated." Windows: run everything in Git Bash, not PowerShell.
Part 03 / 06
Turn a folder into a repository, take your first snapshot, publish it as your profile.
01
Edit
Change files like you always do.
02
Stage
Pick what goes in the snapshot.
03
Commit
Save it with a message.
04
Check
Read the history back.
add puts items in the shopping cart. commit checks out. Nothing is saved to history until you commit.
Ticked something anyway? Delete the repository and create it again, or run git pull origin main --allow-unrelated-histories once before you push.
On GitHub: New repository named exactly your-username, Public, README off, no .gitignore, no license (previous slide). Then:
Checkpoint: refresh github.com/your-username. Your README is live at the top of your profile.
Full reference: markdownguide.org/cheat-sheet
Part 04 / 06
Clone, break, undo, branch, and send a pull request.
Fork
A copy on GitHub, under your account. In the browser, once. You cannot push to a repo you do not own.
Clone
A copy on your laptop. In the terminal, as often as you like. Clone your fork, never the original.
origin
The remote your clone came from: your fork. Where git push goes when you do not say otherwise.
upstream
The name everyone gives the original. Not there by default; you add it, and you only pull from it.
Your fork does not update itself. Sync before you branch. Every time.
Fork lives in the repo header, top right
Leave "Copy the main branch only" ticked
Open github.com/Arlovzki/git-github-101 and press Fork. Then clone your fork, not the original:
Checkpoint: git log shows commits you did not write. That is the whole point of cloning.
restore
For files. Throw away edits you have not committed.
reset
For commits only you have. Rewinds history on your machine.
revert
For commits others may have pulled. Adds a new commit that reverses one.
Never reset --hard on a shared branch.
01Undo an edit you have not staged
02Undo a commit, keep the work
03Undo a commit, discard the work
04Undo a commit that is already pushed
Watch the Source Control icon on VS Code's left sidebar: the badge counts changed files, and it drops to zero after each undo.
A branch is an alternate timeline. Experiment there, then merge it back or throw it away.
A pull request is how you ask for the merge, with review.
type/short-description
A type that says what kind of change it is, a slash, then a short description in lowercase words joined by hyphens. The name tells a stranger what is on the branch before they open it.
feature/
Something new. A page, a section, a file that did not exist before. Some teams write feat/; one repo picks one.
fix/
Something repaired. A bug, a dead link, a typo that changes meaning. hotfix/ is the urgent kind, straight to production.
docs/
Only the words changed. README, comments, a guide like the workshop page.
chore/
Housekeeping. Dependencies, config, renames. Nothing a user of the project would notice.
Nobody rejects a pull request over a bad branch name. They do lose ten minutes working out what it was for, and one of those ten minutes is yours.
Lowercase, hyphens, no spaces. The rest is whatever the team you join already does.
if applied, this commit will Add Alex to attendees
A commit subject is a sentence about the change, not a diary entry about your afternoon.
type(scope): short description
type: one word from the list. (scope): the part you touched, optional. description: the same imperative sentence, now lowercase, still no full stop. Keep the whole first line under 72 characters; GitHub cuts it off there.
Conventional Commits keeps the imperative sentence and puts one lowercase word in front of it, so that a machine can read the log as well as a person.
Nobody sits down to write the changelog. The log already is one.
One repo, one convention. A consistent log beats a correct one.
Still inside git-github-101. Write notes on a branch, then merge them into main on your own machine.
Checkpoint: git log --oneline shows "Add my notes" on main. Nothing pushed yet; that comes next.
Read your own Files changed tab first. GitLab calls the same thing a merge request.
Same idea, on a repo you do not own: the merge happens on GitHub through a pull request. Add yourself to the attendance folder.
Checkpoint: your pull request appears on Arlovzki/git-github-101. I merge them live, one by one.
The green button has a dropdown. The three options do different things to history, and the repo lives with whichever you pick.
The dropdown beside the green button is where the choice lives
Unsure? Squash. One pull request becomes one commit on main. Never rebase a branch other people have already pulled: use git revert there instead.
Your fork only knows your name. The original repo now has the whole room's. Pull the update from there.
Checkpoint: the attendees folder has one file per person in the room. This is how teams work every day: branch, pull request, merge, pull.
Part 05 / 06
Clone a starter site, make it yours, put it on the internet for free.
Fork github.com/Arlovzki/portfolio-starter, then on your fork: Settings → Rename to portfolio. Then:
Checkpoint: your changes show on github.com/your-username/portfolio.
Settings → Pages → Deploy from a branch → main / (root)
A minute later the live URL appears at the top of the same screen
Checkpoint: drop your live link in the chat. Free hosting, forever.
Pages rebuilds on its own. That loop is the whole job.
Part 06 / 06
Every command from tonight, in the order you will reach for it.
Bookmark it: www.arloubeloria.com/workshop/git-github-101
Once
Every day
Per project
Branches and undo
Slides, cheat sheet, and every resource, in one place:
Running your own workshop someday? Fork all of it and use it as your starting point.
Questions?