
Ever find yourself poking around a Git project wondering “What’s even going on here?” Whether you’re jumping into a new codebase or returning to an old one, Git gives you powerful tools to get oriented quickly.
This short guide will walk you through a handful of essential Git commands that help you understand your repository’s structure, branches, remotes, and commit history.
1. git status
Your starting point. This command tells you:
What branch you’re on
If you have any uncommitted changes
Whether your branch is ahead/behind its remote counterpart
Great for checking the current state of your local repo.
2. git log --oneline
Want a quick summary of recent work? This command shows:
A compact list of commits on the current branch
Commit messages and short hashes
Use this to scan recent changes or compare branches at a glance.
3. git branch
Lists all local branches in your repository. Want more insight?
Try:
git branch -a: Shows both local and remote-tracking branchesgit branch -r: Only shows remote-tracking branches
This helps you discover which branches exist and where they live.
4. git merge-base branch1 branch2
Finds the common ancestor of two branches. Useful for understanding when a branch diverged from another, and how far it’s drifted.
5. git remote -v
Displays the URL of the remote repo (usually called origin) your project is linked to. This is where any pushes and pulls will go.
Why This Matters
These commands help you form a mental model of any Git project—local or remote. They’re especially useful when:
You’ve inherited a codebase
You're reviewing a pull request
You're cleaning up old branches
Or just trying to get your bearings
Learning Git doesn’t have to mean memorizing obscure flags.
Check out the below video for a visual guide to all the commands above:

I attended the University of Maryland where I graduated with a bachelor's degree in Computer Science. Since then, I’ve gathered experience in the tech industry, both as a software engineer and people manager. My longest stint was 7 years at Amazon where I… read more.


