LearnThatStack Ace your next interview
Computer Science Fundamentals
Git & Version Control.
Change topic Change
Practice · Questions

All questions

Showing of 50
Beginner 12
01

What is Git and how does it differ from centralized version control systems

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What is the difference between Git and GitHub, and why does it matter

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

What is the staging area, and why does Git separate it from commits

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

How do you undo your most recent commit without losing the work

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

When should you use git merge versus git rebase to combine branches

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

How do you resolve a merge conflict, step by step, without panicking

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What is the difference between git fetch and git pull

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

What actually happens under the hood when you run git commit

Part of Pro
09

What is a branch in Git, and how do you create and switch one

Part of Pro
10

How do you throw away uncommitted local changes you no longer want

Part of Pro
11

What is a .gitignore file, and how does Git decide what to ignore

Part of Pro
12

How do you clone a repository and connect it to a remote

Part of Pro
Intermediate 18
13

Is a Git commit a full snapshot or a diff, and why

Part of Pro
14

How do commits, trees, and blobs fit together in Git's object model

Part of Pro
15

What is a branch really, just a movable pointer to a commit

Part of Pro
16

What does detached HEAD mean, and how do you end up there

Part of Pro
17

What is the difference between reset --soft, --mixed, and --hard

Part of Pro
18

When do you reach for reset versus revert versus checkout

Part of Pro
19

What does git stash do, and when does it come back to bite you

Part of Pro
20

When is git cherry-pick the right tool, and what are its dangers

Part of Pro
21

What is the difference between a fast-forward merge and a merge commit

Part of Pro
22

What can interactive rebase do, and how do you squash commits safely

Part of Pro
23

Why should you never rebase commits you have already pushed and shared

Part of Pro
24

How does git reflog let you recover commits you thought were lost

Part of Pro
25

What is the difference between lightweight and annotated tags, and when use each

Part of Pro
26

What is an upstream tracking branch, and how does it shape push and pull

Part of Pro
27

Why prefer git push --force-with-lease over a plain force push

Part of Pro
28

What makes a good commit message, and why does it matter later

Part of Pro
29

What does git commit --amend do, and when is it unsafe

Part of Pro
30

Squash, merge commit, or rebase merge, which pull-request strategy and why

Part of Pro
Expert 20
31

How does Git store objects as loose files and later pack them

Part of Pro
32

How does Git hash content, and should you worry about SHA collisions

Part of Pro
33

How does git bisect find a bad commit across thousands of revisions

Part of Pro
34

How does Git detect file renames when it stores no rename history

Part of Pro
35

What is the index file, and how does it make git status fast

Part of Pro
36

How do you recover cleanly after a rebase goes badly wrong

Part of Pro
37

What is git rerere, and how does it help with repeated conflict resolution

Part of Pro
38

Submodules versus subtrees for vendoring code, what tradeoffs do you weigh

Part of Pro
39

How do you keep Git fast in a huge monorepo with millions of files

Part of Pro
40

Why do large binary files hurt a Git repo, and how does LFS help

Part of Pro
41

What happens during git gc, and when can it delete unreachable commits

Part of Pro
42

When is a shallow or partial clone worth its later limitations

Part of Pro
43

How does a three-way merge work, and what is the merge base

Part of Pro
44

How do you rewrite history across an entire repo, and what breaks downstream

Part of Pro
45

What are Git hooks, and where do client-side and server-side ones differ

Part of Pro
46

How do you sign commits and verify who actually authored them

Part of Pro
47

A secret got committed and pushed, how do you fully remediate it

Part of Pro
48

What is a bare repository, and why do servers host repos that way

Part of Pro
49

How do refspecs control what fetch and push actually map between repos

Part of Pro
50

How do you keep a long-lived feature branch healthy against a moving main

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for Git & Version Control? Send them this set.
Pro · $10/mo

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.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git