Chapter 4: Git Getting Started
You’ve already asked about install, config, Git vs GitHub… now we put everything together into the complete beginner-to-first-working-repo flow — the exact path most people follow when they truly start using Git for the first time in 2026.
No skipping steps. We’ll go slow, explain why each command exists, show real output examples, and build a tiny project together. By the end you’ll have:
- Git installed & configured
- Your first local repository
- Commits, status, log, diff
- A branch + merge
- Pushed everything to GitHub
Ready? Let’s begin like day 1 of a real bootcamp.
Phase 1 – Prerequisites Checklist (Do this first!)
-
Git Installed? Open terminal / Git Bash / PowerShell → run:
Bash0123456git --version→ You should see git version 2.53.0 (or very close — that’s the current stable release as of February 2026). If not → go back to our “Git Install” lesson and install it now.
-
Identity Set? (super important — appears on every commit)
Bash01234567git config --global user.name "Webliance"git config --global user.email "your-real-email-you-use-for-github@gmail.com" -
Modern defaults (2026 style — saves headaches)
Bash012345678git config --global init.defaultBranch maingit config --global core.editor "code --wait" # change to nano/vim if no VS Codegit config --global alias.lg "log --oneline --graph --decorate --all"Quick check:
Bash0123456git config --global --listSee your name/email + main branch default? Good!
Phase 2 – Create & Understand Your First Repository
Goal: Make a tiny “personal-notes” project.
|
0 1 2 3 4 5 6 7 8 9 10 11 |
# 1. Create empty folder & enter it mkdir personal-notes-2026 cd personal-notes-2026 # 2. Tell Git: "Start tracking this folder from now" git init |
Output you’ll see:
|
0 1 2 3 4 5 6 |
Initialized empty Git repository in /home/webliance/personal-notes-2026/.git/ |
→ A hidden .git/ folder appeared. That’s your entire version history database — don’t delete it!
Phase 3 – The Sacred Everyday Cycle (Add → Commit → Repeat)
-
Create your first file
(Use VS Code, Notepad, whatever — or terminal:)
Bash012345678echo "# My Personal Notes 2026" > README.mdecho "- Learn Git properly" >> README.mdecho "- Drink chai every day" >> README.md -
See what’s happening
Bash0123456git statusTypical output:
text01234567891011121314On branch mainNo commits yetUntracked files:(use "git add <file>..." to include in what will be committed)README.mdnothing added to commit but untracked files present→ Red = untracked (Git doesn’t care about it yet)
-
Stage the file (tell Git: “I want to snapshot this”)
Bash01234567git add README.md# or git add . ← everythingBash0123456git status # now green!text0123456789101112On branch mainNo commits yetChanges to be committed:(use "git rm --cached <file>..." to unstage)new file: README.mdStaging area = “preparation zone” before taking photo
-
Take the photo (commit!)
Bash0123456git commit -m "Initial commit: add README with my 2026 goals"Output:
text012345678[main (root-commit) 1a2b3c4] Initial commit: add README with my 2026 goals1 file changed, 3 insertions(+)create mode 100644 README.md→ First commit done! 🎉 You now have version history.
-
See your work history
Bash0123456git log --onelinetext01234561a2b3c4 Initial commit: add README with my 2026 goalsOr use our alias:
Bash0123456git lg(Even prettier with graph when branches come)
Phase 4 – Make Changes & See Diff
Edit README.md — add one more line:
|
0 1 2 3 4 5 6 |
- Finish this Git getting started lesson |
Now:
|
0 1 2 3 4 5 6 7 8 9 |
git status # Shows modified: README.md (red) git diff |
You’ll see red/green lines:
|
0 1 2 3 4 5 6 7 8 |
- Drink chai every day + Drink chai every day + - Finish this Git getting started lesson |
Stage & commit again:
|
0 1 2 3 4 5 6 7 |
git add README.md git commit -m "Add new learning goal to README" |
|
0 1 2 3 4 5 6 |
git log --oneline |
|
0 1 2 3 4 5 6 7 |
def5678 Add new learning goal to README 1a2b3c4 Initial commit: add README with my 2026 goals |
Phase 5 – Time Travel Basics (Undo / Go Back)
Made a typo? Want to see old version?
-
See what changed in last commit:
Bash0123456git show -
Go back temporarily to previous version:
Bash0123456git checkout 1a2b3c4 # use your real commit hash→ README goes back to old version (detached HEAD warning — normal)
-
Return to latest:
Bash0123456git checkout main -
Oops — want to undo last commit but keep changes?
Bash0123456git reset --soft HEAD~1→ Changes back to staged, commit gone
-
Throw away last commit completely (careful!):
Bash0123456git reset --hard HEAD~1
Phase 6 – Branches – Your Safety Net
Don’t experiment on main!
|
0 1 2 3 4 5 6 |
git checkout -b feature/learning-list |
→ Now on new branch.
Add to README:
|
0 1 2 3 4 5 6 |
- Buy new notebook |
|
0 1 2 3 4 5 6 7 |
git add . git commit -m "Add notebook reminder on learning branch" |
Switch back:
|
0 1 2 3 4 5 6 |
git checkout main |
→ Change disappeared! (safe)
Like it? Merge:
|
0 1 2 3 4 5 6 |
git merge feature/learning-list |
|
0 1 2 3 4 5 6 |
git lg # see the branch join! |
Clean up:
|
0 1 2 3 4 5 6 |
git branch -d feature/learning-list |
Phase 7 – Push to GitHub (Make it Live!)
-
Create repo on github.com:
- New repository → name: personal-notes-2026
- Public / Private → no README/init files (we have our own)
-
Connect & push:
Bash012345678git remote add origin https://github.com/Webliance/personal-notes-2026.gitgit branch -M maingit push -u origin main→ First time may ask login (browser pops up or use PAT)
Now refresh GitHub → your commits & README are online! 🌐
Your First-Day Workflow Summary (Memorize this)
- git status — always first!
- Work → change files
- git add . or specific files
- git commit -m “clear message”
- git push (after first setup)
- Repeat 10–20 times → muscle memory forms
Bonus commands you’ll use daily:
- git pull → get latest from GitHub
- git clone url → copy someone else’s repo
- git branch → list branches
You did it! You’ve gone from zero to real Git + GitHub working project in one sitting.
Next class?
- Conflicts & pull requests
- .gitignore
- Real team workflow
- Or fix any error you hit during this?
Just tell me what felt tricky or what you want deeper — we’ll keep building. You’re officially “getting started” now — proud of you! 🚀
