Git Essentials

Table of contents
- Setting Up Git
- Everyday Git Commands Cheat‑Sheet
- git status — “What did I change?”
- git log — History of save points
- Paths (branches)
- git merge — Blend paths together
- git diff — Spot the difference
- git add → create the “next save” list
- git commit — Save your files
- git stash — Stuff work into a drawer
- git rebase — Re‑play your changes on top of the latest copy
- SSH keys — Skip typing your password
- git push — Upload your save points
- git pull — Download & blend new saves
- git fetch — Download only (peek, don’t blend)
- Clone vs. Fork

Ever open the Git docs for a “quick” reminder and end up lost in a sea of flags and sub‑commands? Same here. Instead of scrolling through man‑pages, bookmark this post: a no‑fluff cheat‑sheet of the handful of Git commands you’ll hit dozens of times a week.
In the next five minutes, you’ll get:
Plain‑English explanations for each command
Copy‑paste snippets you can drop straight into your terminal
A quick note on when—and why—it matters
Whether you’re committing on the train or rebasing before a pull request, these commands will keep your workflow fast and your history clean.
Ready to turn Git from “ugh, let me check the docs” into second nature? Let’s dive in!
Setting Up Git
Before we get to the commands, make sure Git is on your machine and stamped with your name.
Git vs GitHub (and friends)
Git is the tool that lives on your computer; GitHub, GitLab, and Bitbucket are just places to store and collaborate on your Git repositories online.
1. Install Git https://git-scm.com/downloads
2. Tell Git who you are (once)
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Use --global
once; omit it inside a repo if you need a different identity just for that project.
3. Start a new repo
mkdir my-project
cd my-project
git init
That’s it—Git is ready. Next up: the everyday commands that keep your commits flowing.
Everyday Git Commands Cheat‑Sheet
(Think of Git like a notebook that keeps versions of your project. Commands below are plain‑English—with sample lines you can copy into your terminal.)
git status
— “What did I change?”
- Shows files you touched (red) and files you’ve marked for the next save point (green).
git status
git log
— History of save points
- Lists past versions with date and author. Add
--oneline
for a skim‑friendly list.
git log --oneline
Paths (branches)
- Start a new path to try an idea, jump between paths, list them.
# start a new path
git branch feature-idea
# jump to it
git switch feature-idea # (or git checkout feature-idea)
# see all paths
git branch
git merge
— Blend paths together
- Combine another path into the one you’re on.
git switch main
git merge feature-idea
git diff
— Spot the difference
- Shows exactly what changed line‑by‑line.
git diff # working folder vs. staged area
git diff --staged # staged area vs. last save
git add
→ create the “next save” list
- Tell Git which changed files should be in the next version.
git add index.html style.css
(Everything you add
turns green in git status
.)
git commit
— Save your files
- Records the files you just
add
‑ed as a new save point.
git commit -m "Explain feature X"
git stash
— Stuff work into a drawer
- Save messy changes so you can switch tasks, then pull them back.
git stash # put away
# ...work on something else...
git stash pop # take it out
git rebase
— Re‑play your changes on top of the latest copy
- Makes history look cleaner by pretending you wrote your changes last.
git switch feature-idea
git rebase main
SSH keys — Skip typing your password
Generate once, paste the public key on GitHub/GitLab, and you’re set.
ssh-keygen -t ed25519 -C "you@example.com"
git push
— Upload your save points
git push origin main
git pull
— Download & blend new saves
git pull # same as: git fetch + git merge
git fetch
— Download only (peek, don’t blend)
git fetch
Clone vs. Fork
Clone → just download the code
Use when you already have permission to push to the original repo (or you only need to read it).
Makes a local folder and a remote called origin that points to the real repo.
git clone git@github.com:org/project.git # local copy
Fork → make your own copy, then download
- Use when you don’t have push rights but still want to contribute.
Click Fork on GitHub/GitLab → a new repo under your account.
Clone that copy:
git clone git@github.com:you/project.git
Keep in sync with the original (upstream) repo:
git remote add upstream git@github.com:org/project.git git fetch upstream git rebase upstream/main # or merge if you prefer
Push to your copy and open a Pull Request so maintainers can review your changes.
You just covered the essentials of Git by exploring commands you’ll genuinely use every day. Keep practicing these basics, and you'll quickly find yourself managing your code like a pro.
I'll be writing more about general coding concepts and diving into Golang next. Follow along to level up your coding skills if you enjoyed this!
Got stuck or have a question? Drop a comment, and let's troubleshoot together. Happy coding!
Subscribe to my newsletter
Read articles from Ifedayo Agboola directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ifedayo Agboola
Ifedayo Agboola
Full-stack software engineer specializing in modern JavaScript frameworks (Angular, React, Vue) with strong backend capabilities in Node.js and database systems. Having led projects from concept to production across the UK tech landscape, I've developed a keen understanding of efficient development workflows and tools that make developers more productive. I write about essential programming tools every developer should master and explore the elegant simplicity of Golang. My articles focus on practical, clear explanations of concepts I wish I'd understood better early in my career. Based in Belfast, I'm passionate about helping developers build stronger technical foundations through straightforward, no-fluff content that solves real problems.