CareerLesson 9 of 9

Interview Preparation

Consolidate Git and GitHub fundamentals with targeted interview questions across concepts, commands, workflows, and troubleshooting.

Simple Explanation (ELI5)

Interviews check if you can work safely with a team, not just memorize commands. You need to explain what you do when things go wrong and why your workflow avoids risk.

Technical Explanation

Strong candidates demonstrate command fluency, branching strategy rationale, PR and review discipline, CI awareness, and recovery techniques for merge/conflict/history mistakes.

Rapid Revision Sheet

text
Core ideas:
- Git = local distributed VCS
- GitHub = remote collaboration platform
- Branch strategy = main + short-lived feature branches
- PRs = review, checks, controlled merge
- Merge conflicts = overlapping edits resolved manually
- CI checks = quality gates before merge

Essential commands:
- git status, git add, git commit, git log
- git checkout -b, git branch -d
- git fetch, git pull --rebase, git push
- git rebase, git revert, git restore
- git reflog, git cherry-pick

Mock Practical Round

  1. Create a feature branch, commit two changes, and open a PR-ready branch.
  2. Resolve a simulated merge conflict and explain your decision.
  3. Recover a lost commit using reflog.
  4. Write a basic GitHub Actions workflow for PR checks.
  5. Explain how you would rollback a bad merge in production.

Interview Questions

Beginner

What is version control and why is it used?

It tracks file changes over time, enabling collaboration, history, and rollback for safe development.

Git vs GitHub?

Git is the underlying VCS tool; GitHub is a hosted collaboration platform around Git repositories.

What is a branch?

An isolated line of development that allows safe work without affecting main.

What is a pull request?

A merge proposal with review and automated checks before integration.

What is a merge conflict?

A conflict when Git cannot auto-merge overlapping changes in same file sections.

Intermediate

When would you rebase instead of merge?

Rebase to keep feature branch history linear and current with main before PR merge.

How do branch protections improve quality?

They require checks/reviews and block risky direct pushes to critical branches.

What is force-with-lease and why safer?

It force-pushes only if remote hasn’t changed unexpectedly, reducing accidental overwrite.

How do you structure a good PR?

Clear purpose, linked issue, test evidence, risk notes, and scoped diff.

How does GitHub Actions fit in PR workflow?

It runs CI checks automatically and acts as merge gate via required status checks.

Scenario-based

Main is broken after merge. What are your immediate steps?

Identify bad merge, revert quickly, restore green CI, then apply corrected fix via new branch.

A teammate rewrote branch history and your PR is messy.

Fetch latest, rebase onto updated target, clean commits, then push with force-with-lease.

You discover secrets committed in branch history.

Rotate secrets immediately, rewrite history, run secret scanning, and document incident.

Two urgent fixes in parallel conflict with each other.

Prioritize one fix path, merge it first, then rebase the second and retest.

You need to prove who introduced a regression.

Trace release window commits, inspect PR discussions and CI logs, identify root commit and merge context.

Debugging Scenarios

Real-world Use Case

A candidate shared a concrete story: resolved a high-pressure merge conflict during a release incident, reverted safely, and restored service in minutes. This practical narrative carried more weight than memorized definitions.

Summary

Interview strength comes from combining concepts with operational judgment. Show that you can collaborate safely, troubleshoot quickly, and keep delivery reliable under pressure.