All questions
Showing of 50What is Git and how does it differ from centralized version control systems
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Git is a distributed version control system that tracks changes to files over time. Every clone holds the full history, not just the latest snapshot. You commit, branch, and inspect history entirely offline.
Centralized systems like Subversion or CVS keep the whole history on one server. Your working copy is thin. Most operations need a network round trip, and the server is a single point of failure.
That distribution changes daily work. Branching is cheap and local, so you experiment freely. If the server dies, any clone can restore the project. The cost is a steeper mental model: you juggle local and remote state, and pushing is a separate deliberate step.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between Git and GitHub, and why does it matter
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
GitHub hosts your repositories on the web, while Git is the software that tracks changes on your machine. They are often confused but do different jobs.
Git handles commits, branches, and history locally. GitHub stores a copy of your repository remotely and adds pull requests, issue tracking, access control, and code review. GitLab and Bitbucket play the same role.
The distinction matters because people blur them. You can use Git alone with no account anywhere, pushing to a plain server. You can also swap GitHub for a competitor without touching a single Git command. Treating pull requests as a Git feature, when they are really GitHub's addition, leads to confusion about what each layer provides.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the staging area, and why does Git separate it from commits
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The staging area, also called the index, is a middle layer between your working files and committed history. When you run git add, you copy a file's current state into staging. A commit then records exactly what is staged, nothing more.
Git separates it so you control what each commit contains. You might edit five files but commit only two related ones. You can even stage part of a file with git add -p, splitting messy work into clean commits.
The cost is one more step to remember. Beginners forget to stage and wonder why a commit missed their edits. The payoff is deliberate, reviewable history instead of dumping every change together.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you undo your most recent commit without losing the work
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Run a soft reset to move the branch back one commit while keeping your edits in place.
git reset --soft HEAD~1 # commit undone, changes stay staged
git commit -m "better message" # recommit cleanly
The commit disappears from history, but every file change stays exactly as it was. Soft leaves them staged, ready to recommit. Swap in --mixed if you want them unstaged instead, back in the working directory.
This is the fix when you committed too early, wrote a bad message, or forgot a file. Avoid --hard here, because that throws the work away, which is the one thing you are trying not to do. If you already pushed, reach for git revert or a follow-up commit instead; reset and amend both rewrite shared history.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
When should you use git merge versus git rebase to combine branches
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Use merge when you want to preserve the true shape of history, and rebase when you want a clean straight line. Both combine work from two branches; they just record it differently.
Merge creates a new commit that ties two branch tips together. Nothing moves, so the record stays honest about when work diverged. Rebase instead replays your commits on top of the other branch, as if you had started from its latest state.
A simple rule works well. Rebase your own local branch to tidy it before sharing. Merge when combining branches other people already pulled. The danger is rebasing shared commits, which rewrites history others depend on and creates painful duplicates. When unsure, merge is the safer default.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you resolve a merge conflict, step by step, without panicking
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Stay calm; a conflict just means Git could not decide between two edits to the same lines. Nothing is broken, and nothing is lost.
Work through it in order:
- Run git status to see which files conflict.
- Open each one and find the
<<<<<<<,=======,>>>>>>>markers. - Edit the region to the correct final result, deleting all three markers.
- Stage the fixed file with git add.
- When every file is done, run git commit to finish the merge.
The mistake people make is leaving a marker behind or picking one side blindly. Read both versions and keep what the code actually needs. If it goes wrong, git merge --abort returns you to the state before you started, so you can retry fresh.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between git fetch and git pull
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Fetch downloads new commits from the remote but leaves your working branch untouched. Pull does the same download, then immediately merges those commits into your current branch.
Think of fetch as looking before you leap. It updates your remote-tracking branches, like origin/main, so you can inspect what changed with git log or a diff. Your own work stays exactly where it was.
Pull is the convenience combo: git fetch followed by git merge in one command. It is faster for routine updates but can surprise you with an unexpected merge or conflict mid-task. Many people fetch first, review the incoming changes, then decide whether to merge or rebase. That habit avoids pulling half-finished work on top of your own.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What actually happens under the hood when you run git commit
What is a branch in Git, and how do you create and switch one
How do you throw away uncommitted local changes you no longer want
What is a .gitignore file, and how does Git decide what to ignore
How do you clone a repository and connect it to a remote
Is a Git commit a full snapshot or a diff, and why
How do commits, trees, and blobs fit together in Git's object model
What is a branch really, just a movable pointer to a commit
What does detached HEAD mean, and how do you end up there
What is the difference between reset --soft, --mixed, and --hard
When do you reach for reset versus revert versus checkout
What does git stash do, and when does it come back to bite you
When is git cherry-pick the right tool, and what are its dangers
What is the difference between a fast-forward merge and a merge commit
What can interactive rebase do, and how do you squash commits safely
Why should you never rebase commits you have already pushed and shared
How does git reflog let you recover commits you thought were lost
What is the difference between lightweight and annotated tags, and when use each
What is an upstream tracking branch, and how does it shape push and pull
Why prefer git push --force-with-lease over a plain force push
What makes a good commit message, and why does it matter later
What does git commit --amend do, and when is it unsafe
Squash, merge commit, or rebase merge, which pull-request strategy and why
How does Git store objects as loose files and later pack them
How does Git hash content, and should you worry about SHA collisions
How does git bisect find a bad commit across thousands of revisions
How does Git detect file renames when it stores no rename history
What is the index file, and how does it make git status fast
How do you recover cleanly after a rebase goes badly wrong
What is git rerere, and how does it help with repeated conflict resolution
Submodules versus subtrees for vendoring code, what tradeoffs do you weigh
How do you keep Git fast in a huge monorepo with millions of files
Why do large binary files hurt a Git repo, and how does LFS help
What happens during git gc, and when can it delete unreachable commits
When is a shallow or partial clone worth its later limitations
How does a three-way merge work, and what is the merge base
How do you rewrite history across an entire repo, and what breaks downstream
What are Git hooks, and where do client-side and server-side ones differ
How do you sign commits and verify who actually authored them
A secret got committed and pushed, how do you fully remediate it
What is a bare repository, and why do servers host repos that way
How do refspecs control what fetch and push actually map between repos
How do you keep a long-lived feature branch healthy against a moving main
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
Git & Version Control cheatsheet
- 30-second mental model01
- Stage & commit02
- Undo & recover03
- Branch & switch04
- Stash (shelve dirty work)05
- Merge vs rebase06
- Remotes: fetch / pull / push07
- Move & inspect commits08
- Tags09
- gitignore10
- Commit hygiene11
- Common pitfalls12
- + 6 more inside
43 of 50 Git & Version Control answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.