Git and GitHub interview questions
The Git and GitHub questions interviewers ask most, with short answers you can explain in your own words. Tap a question to see the answer.
01Git vs GitHub?+
Git is the version control tool. GitHub is a hosting platform for Git repositories with pull requests, issues and Actions.
02What are the three areas in Git?+
The working directory, the staging area (index) and the repository (commits).
03git fetch vs git pull?+
fetch downloads changes without merging. pull is fetch plus merge (or rebase).
04merge vs rebase?+
Merge joins branches with a merge commit and keeps history as it happened. Rebase replays commits on a new base for a linear history. Do not rebase shared branches.
05How do you resolve a merge conflict?+
Open the conflicted files, choose the correct content, remove the markers, then git add and commit.
06git reset vs git revert?+
reset moves the branch pointer and can rewrite history. revert creates a new commit that undoes a previous one, safe for shared branches.
07What is a pull request?+
A request to merge a branch, where teammates review code, run checks and discuss before merging.
08What is .gitignore?+
A file listing paths Git should not track, like secrets, virtual environments and build outputs.
09What does git stash do?+
Saves uncommitted changes temporarily so you can switch branches, and restores them later with git stash pop.
10What is a fork?+
Your own copy of someone else's repository on GitHub, used to propose changes via pull requests.
11What is cherry-pick?+
Applying a specific commit from one branch onto another.
12What is HEAD?+
A pointer to the current commit or branch you are on.
13How do you undo the last commit but keep the changes?+
Use a soft reset.
git reset --soft HEAD~114What is a detached HEAD?+
When you check out a commit instead of a branch. New commits there are easy to lose unless you create a branch.
15What is branch protection?+
GitHub rules on a branch like main: required reviews, passing checks and no force pushes.
16What is GitHub Actions?+
GitHub's CI/CD: workflows in YAML that run on events like push or pull request, for tests, linting and deployments.
17What makes a good commit message?+
A short imperative summary like 'Add incremental load for orders', with details in the body if needed.
18What branching strategy do you use?+
Usually GitHub flow: short-lived feature branches from main, pull requests, review and merge.
19Never commit what?+
Passwords, keys, tokens and large data files. Use environment variables, secret stores and .gitignore.
20How is Git used with data tools?+
Databricks Git folders, ADF and Fabric Git integration, and SQL and dbt projects in repositories with CI checks.
More Git and GitHub interview questions
Free PDF downloads and premium packs with scenario questions and detailed model answers.
Coming soon
The premium Git and GitHub interview pack is being prepared.
🎤 Practise with a real mock interview
60 minutes live with Hikmat Ullah, plus written feedback. 30 USD, or 3 for 80 USD.
Git & GitHub
Version control, branching, pull requests and CI, the way real teams work.
Learn it 1:1 → PROJECTSGit & GitHub projects
A free starter project, plus Small, Large and Enterprise projects.
See projects → MOREOther subjects
Free interview questions for all 12 subjects.
All interview questions →