Chapter 18: Git GitHub Getting Started
Git + GitHub – Getting Started from absolute zero (2026 edition)
This is the exact path most people follow when they really start using Git & GitHub for the first time (not just watching tutorials).
We will go very slowly, command by command, with real outputs, explanations of why we do each step, what can go wrong, and what you actually see on screen. By the end you will have:
- Git installed & configured
- Your first local repository
- Several commits
- A branch + merge
- Everything pushed to GitHub
- A clean daily workflow you can repeat forever
Ready? Let’s begin.
Phase 1 – Prerequisites (do this first – 5 minutes)
-
Check if Git is installed
Open terminal / Git Bash / PowerShell / Command Prompt:
Bash0123456git --versionYou should see something like:
text01234567git version 2.53.0.windows.1 ← Windowsgit version 2.53.0 ← macOS/LinuxIf not → install it now. On Windows choose Git from Git Bash and Command Prompt during install.
-
Set your identity (appears on every commit – do once per computer)
Bash01234567git config --global user.name "Webliance"git config --global user.email "your-real-email-you-use-for-github@gmail.com" -
Modern defaults (very important in 2026)
Bash01234567git config --global init.defaultBranch maingit config --global alias.lg "log --oneline --graph --decorate --all"Quick check:
Bash0123456git config --global --listYou should see your name, email, and init.defaultBranch=main.
Phase 2 – Create Your First Local Repository (no internet yet)
|
0 1 2 3 4 5 6 7 8 9 10 11 |
# 1. Make a new folder & enter it mkdir my-first-github-project cd my-first-github-project # 2. Tell Git: "start tracking this folder" git init |
You see:
|
0 1 2 3 4 5 6 |
Initialized empty Git repository in .../my-first-github-project/.git/ |
→ A hidden .git/ folder appeared — that’s your entire version history.
Phase 3 – First commits (the sacred cycle)
-
Create first file
Bash01234567echo "# My First GitHub Project 2026" > README.mdecho "- Learning Git properly" >> README.md -
See what’s happening (most important command!)
Bash0123456git statusOutput:
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 -
Stage the file (prepare for snapshot)
Bash01234567git add README.md# or git add . ← everythingBash0123456git status # now green!text01234567891011On branch mainNo commits yetChanges to be committed:new file: README.md -
Commit (take the snapshot!)
Bash0123456git commit -m "Initial commit: add README with project title"Output:
text012345678[main (root-commit) a1b2c3d] Initial commit: add README with project title1 file changed, 2 insertions(+)create mode 100644 README.md🎉 First commit done!
-
Make more realistic changes
Edit README.md (add lines):
text01234567- Buy new notebook- Finish Git getting startedThen:
Bash01234567git add README.mdgit commit -m "Add two more personal goals to README" -
See your history
Bash01234567git lg # our pretty alias# or git log --oneline --graph --decorate --alltext01234567* def5678 (HEAD -> main) Add two more personal goals to README* a1b2c3d Initial commit: add README with project title
Phase 4 – Create a branch & merge (safety net)
|
0 1 2 3 4 5 6 7 8 |
# Create and switch to new branch git switch -c feature/add-list-item # or old way: git checkout -b feature/add-list-item |
Now edit README.md again:
|
0 1 2 3 4 5 6 |
- Add dark mode toggle (future idea) |
|
0 1 2 3 4 5 6 7 |
git add README.md git commit -m "Add future dark mode idea on feature branch" |
Switch back:
|
0 1 2 3 4 5 6 |
git switch main |
→ The new line disappears! (safe)
Merge when ready:
|
0 1 2 3 4 5 6 |
git merge feature/add-list-item |
Clean up:
|
0 1 2 3 4 5 6 |
git branch -d feature/add-list-item |
Now:
|
0 1 2 3 4 5 6 |
git lg |
|
0 1 2 3 4 5 6 7 8 |
* abc9999 (HEAD -> main) Add future dark mode idea on feature branch * def5678 Add two more personal goals to README * a1b2c3d Initial commit: add README with project title |
Phase 5 – Connect to GitHub & push (make it live!)
-
Go to github.com → log in → + → New repository
- Name: my-first-github-project
- Keep public (for learning)
- Do NOT check “Add a README file” or anything else
- Create repository
-
Copy the commands GitHub shows you (they look like this):
Bash012345678git remote add origin https://github.com/Webliance/my-first-github-project.gitgit branch -M maingit push -u origin mainPaste them one by one.
First time → browser login or Personal Access Token (GitHub will guide you).
-
Refresh the GitHub page → your README & commit history are now online! 🌐
From now on you just do:
|
0 1 2 3 4 5 6 7 8 |
git add . git commit -m "feat: add new section" git push |
Phase 6 – Your First Real Daily Workflow (memorize this)
Morning / after break:
|
0 1 2 3 4 5 6 7 |
git switch main git pull origin main |
New work:
|
0 1 2 3 4 5 6 7 8 9 10 |
git switch -c feat/DEV-123-add-search-bar # work... git add . git commit -m "feat(ui): add search input with debounce" git push -u origin feat/DEV-123-add-search-bar |
→ Go to GitHub → create Pull Request → wait for review/merge
After merge:
|
0 1 2 3 4 5 6 7 8 |
git switch main git pull git branch -d feat/DEV-123-add-search-bar |
Quick Troubleshooting Table (common first-day issues)
| Problem | Fix / Check |
|---|---|
| git push asks password every time | Use Personal Access Token or Git Credential Manager |
| “src refspec main does not match” | You forgot git branch -M main or repo is empty |
| Merge conflict after pull | Edit conflicted files → git add → git commit |
| Git Bash opens in wrong folder | Set Windows env var HOME = D:\Code |
| Nothing happens after git push | Check GitHub page — sometimes needs refresh |
You did it! You now have a real Git + GitHub repository with commits, branches, merge, and remote sync.
Next class?
- How to handle real merge conflicts?
- Create your first Pull Request live?
- Add .gitignore + conventional commits?
- Or fix any error you hit during this?
Just tell me what felt tricky or what you want to practice next — we’ll continue together. You’re officially “getting started” now — very proud of you! 🚀
