Gitting Started LiveWires
01 / 32

Gitting
Started

Git and GitHub.

Outcomes

Make a commit. Push it. Open a pull request.

Commit

A save point with your name on it.

git commit -m "type: message"

Push

Your work on GitHub.

git push

Pull request

A change ready for review.

git push -u fork my-branch

Format

Working rules.

Follow along

Type the short commands.

Break things

Your fork is disposable.

Ask in chat

Stuck for 60 seconds? Ask.

Never paste a command you do not understand.

Plan

Agenda.

01Why version control
02Mental model
03Install Git
04Configure Git
05Conventional commits
06Lab 01: first repository
07Remotes and forks
08Lab 02: first pull request
09Pull and merge
10Safety and undo
11Recap

Problem

Version control by filename.

Which one is current?

proposal.doc12 Jan
proposal_final.doc18 Jan
proposal_final_v2.doc18 Jan
proposal_final_REALLY_final.doc19 Jan
proposal_USE_THIS_ONE.doc20 Jan

Commits

A commit is a snapshot.

9b2e104

chore: start project

Sami · 09:14

2c4b1a0

feat(web): add team wall

Priya · 09:48

9f8e7d6

fix(nav): correct broken link

Arjun · 10:02

a1b2c3d

feat(people): add sami profile

Sami · 10:19

HEAD

HEAD points to the latest commit.

Git and GitHub

Git is local. GitHub is remote.

GITyour laptop

Tracks history. Works offline.

# local commands
git init
git add .
git commit -m "chore: first commit"
GITHUBthe internet

Hosts repositories. Adds pull requests, reviews, and issues.

Livewires-Digital-Solutions
gitting-started

The three places

Working tree. Staging. Repository.

working tree modified

Files you edit.

Git sees changes here.

git add
staging area staged

Changes for the next commit.

You choose what goes in.

git commit
repository committed

Saved history.

Stored in .git.

git status shows where each change is.

The loop

Edit. Add. Commit. Push. Pull.

01Editchange a file
02Statussee what changed
03Addstage it
04Commitsave a snapshot
05Pushsend to GitHub
06Pullget new commits

Commit

What is in a commit.

commit a1b2c3d

feat(people): add sami profile

author
Sami · me@sam1.space
date
27 Oct 2026, 10:42
parent
9f8e7d6
changed
+8 −0 · 1 file
git log --oneline
a1b2c3d feat(people): add sami profile
9f8e7d6 docs: add team wall page
2c4b1a0 chore: start project

The hash identifies the commit. The parent links it to history.

Commit messages

type(scope): summary

examples
feat(people): add sami profile
fix(nav): correct broken link
docs: update setup guide
chore: initialize repository

Imperative, lowercase, no period.

feat

New feature.

fix

Bug fix.

docs

Documentation.

chore

Maintenance.

Install

Install Git.

Windows
winget install --id Git.Git -e --source winget
macOS
xcode-select --install
Linux
sudo apt install git
verify
git --version

Or download from git-scm.com/downloads.

Configure

Set your identity.

initial config
git config --global user.name "Sami"
git config --global user.email "me@sam1.space"
git config --global init.defaultBranch main
git config --global --list

First push

  1. GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
  2. Generate new token. Scope: repo.
  3. Use the token as your password.

Use your own name and GitHub email.

Lab 01

Your first repository.

Create a repo, make two commits, read the log.

  • Initialise with git init
  • Stage and commit a file
  • Read git log

Lab 01 · commands

Create and commit.

git-lab
mkdir git-lab
cd git-lab
git init

# create README.md with one line
git status
git add README.md
git commit -m "chore: initialize git lab"

Check

  • .git exists
  • untracked becomes staged
  • git status is safe
→ Create README.md with one line: # My Git Lab

Windows PowerShell: Set-Content README.md "# My Git Lab"

Lab 01 · checkpoint

Two commits. Clean tree.

second commit
# edit README.md, add one line
git diff
git add README.md
git commit -m "docs: add first note"

git log --oneline
git status

Check

  • Two commits
  • Your name on both
  • nothing to commit, working tree clean
! Nothing to commit? Save the file, then run git status.

Remotes

Two remotes. Two jobs.

origin

LiveWires repo

Pull from here.

Livewires-Digital-Solutions/gitting-started
fork

Your copy

Push here.

github.com/<you>/gitting-started
check

See both

List every remote.

git remote -v

Vocabulary

Repo. Fork. Clone. Branch.

Repository

Project plus history.

the thing
Fork

Your copy on GitHub.

GitHub
Clone

Your copy on the laptop.

git clone
Branch

A parallel line of work.

git checkout -b
Lab 02

Your first pull request.

Fork the repo, add your profile, open a PR.

github.com/
Livewires-Digital-Solutions/gitting-started
  • Fork the repo
  • Clone origin
  • Add your fork remote
  • Push a branch and open a PR

Lab 02 · setup

Clone. Add fork. Branch.

your fork
# fork on GitHub, then clone the original
git clone https://github.com/Livewires-Digital-Solutions/gitting-started.git
cd gitting-started
git remote add fork https://github.com/<your-handle>/gitting-started.git
git remote -v

git checkout -b add-<your-handle>
cp people/_template.md people/<your-handle>.md

Check

  • origin is LiveWires
  • fork is your copy
  • You are on add-<your-handle>
  • The profile file exists
→ Edit people/<your-handle>.md.

Lab 02 · ship

Commit. Push. Open the PR.

add-your-handle
# edit the file first
git add people/<your-handle>.md
git commit -m "feat(people): add <name> profile"
git push -u fork add-<your-handle>

Open the PR

  • Base: LiveWires · main
  • Compare: your fork · your branch
  • One file changed
→ GitHub prints the PR link after the push.

Password prompt? Use your personal access token.

Pull requests

A pull request asks to merge.

base Livewires-Digital-Solutions / gitting-started branch: main
PR #12
compare your-fork / gitting-started branch: add-your-handle

One branch into another. Review, then merge.

review

Comment on lines and request changes.

checks

Tests run before merge.

merge

A maintainer accepts the branch.

Good PRs

Small. Clear. One file.

One purpose

Add your profile. Nothing else.

Clear title

“feat(people): add Priya profile.”

Short description

What changed and why.

One file

Small diffs get reviewed.

feat(people): add Priya profile #12
priya-dev wants to merge 1 commit into Livewires:main from priya-dev:add-priya-dev
1 file changed +8 −0 Able to merge

Pull

Pull before you push.

sync
git checkout main
git pull origin main
fetch+merge=pull

Fetch downloads. Merge combines.

origin is the LiveWires repo.

Lab 03

Pull the team's work.

I merged a PR and updated LIVE.md.

sync check
git checkout main
git pull origin main

git log --oneline -3
cat LIVE.md

Check LIVE.md. If it says “Already up to date”, raise your hand.

Errors

Read the last line.

MessageMeaningFix
fatal: not a git repository Wrong folder. pwd, then cd.
Authentication failed GitHub wants a token. Use a personal access token.
Updates were rejected Someone pushed first. git pull, then git push.
src refspec ... does not match any Nothing committed, or wrong branch. git status · git branch
nothing to commit No saved changes. Save the file, then git status.

Before asking: git status and git log --oneline -5.

Undo

Undo without panic.

GoalCommandAfter push?
Unstage a filegit restore --staged <file>Yes
Discard local editsgit restore <file>Yes, edit is gone
Fix the last messagegit commit --amend -m "Message"No
Undo the last commit, keep changesgit reset --soft HEAD~1No
Undo a pushed commitgit revert <sha>Yes
↺ git reflog remembers where you were for about 30 days. Do not run git reset --hard yet.

Safety

Five rules.

01Never commit secrets

Rotate the secret. Deleting it is not enough.

02Don't force-push shared branches

It rewrites history other people have.

03One branch, one purpose

Small PRs get reviewed.

04Commit small, commit often

A commit is a save point.

05Pull before you push

It prevents rejected pushes.

First week

The daily loop.

startGet the latestgit pull
before editingMake a branchgit checkout -b my-change
as you workCheckgit status · git diff
at a checkpointSavegit add · git commit
endSharegit push · PR
→ Before asking: git status and git log --oneline -5.

Recap

Six commands. Four ideas.

01git init
02git config
03git add
04git commit
05git push
06git pull
repoProject plus history.
local / remoteLaptop and GitHub.
forkYour copy on GitHub.
pull requestA request to merge a branch.

End

Questions?

Reference

Cheat sheet.

Setup

git --version git config --global user.name "Name" git config --global user.email "email" git config --global init.defaultBranch main

Daily loop

git status git diff git add <file> git commit -m "type: message" git log --oneline

Branch and sync

git checkout -b my-branch git checkout main git push -u fork my-branch git pull origin main

Inspect

git status git diff --staged git log --oneline -10 git remote -v git branch -vv

Undo

git restore --staged <file> git restore <file> git commit --amend git reset --soft HEAD~1 git revert <sha> git reflog

Rules

# never commit secrets # don't force-push shared branches # one branch, one purpose # commit small, commit often # pull before you push