Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: git filter-repo (preferred) git filter-repo --path path/to/file --invert-paths Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach productio…
Short answer: git add . git commit git push Real-world example (ShopNest) Prefer clear commits: fix(cart): prevent negative quantities instead of update . Say this in the interview Define — one clear sentence (the short…
Short answer: A Git submodule is a repository inside another repository — useful for including shared components or libraries. Example code You have multiple microservices that share a common authentication library. Inst…
Short answer: Forking is when you create your own copy of someone else’s GitHub repository. Explain a bit more You do this directly on GitHub by clicking the “Fork” button on the top right of the repository page. Example…
Short answer: Add the resolved file: git add <file> git commit # or continue the rebase Real-world example (ShopNest) Feature work for “UPI payment” lives on feature/upi-payment . Open a PR to main ; resolve confli…
Short answer: Comman Description Safe for shared repos? git revert Creates a new commit that undoes changes from a previous commit ✅ Yes git reset Moves the branch pointer back to a previous commit, potentially removing…
Short answer: Mark conflicts as resolved: git add <filename> git commit Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed. Sa…
Short answer: Working Directory: This is where you make changes to the files. It's your local workspace where you're actively editing code. Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and C…
Short answer: Working Directory (modified files), Staging Area (files marked for next commit), Local Repository (committed files). Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks…
Short answer: Conventional Commits define a standard format for commit messages, such as: feat: add new user registration flow fix: correct login validation chore: update dependencies To enforce this automatically, use c…
Short answer: nother to “v2.0.” Git will stop and ask you to pick which to keep. Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.…
Short answer: Reset Type What It Does Example Scenario -soft Moves HEAD to a previous commit but keeps your changes staged You committed too early and just want to edit the message or add more changes. Explain a bit more…
Short answer: nother changes the same header), Git won’t know which to keep — you decide manually. Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach pro…
Short answer: Instead of long-lived access keys, use federated identity: ■ AWS/GCP trusts GitHub’s identity token. ■ Short-lived credentials are issued dynamically. Example for AWS: permissions: id-token: write contents:…
Short answer: Conventional Commits define a standard format for commit messages, such as: feat: add new user registration flow fix: correct login validation chore: update dependencies To enforce this automatically, use c…
Short answer: git push origin --force Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed. Say this in the interview Define — one cle…
Short answer: A detached HEAD means Git’s HEAD points to a specific commit instead of a branch — commits made now won’t belong to any branch. To fix it: Check what commit you’re on: git status Real-world example (ShopNes…
Short answer: Example: If your teammate accidentally ran git push origin main --force, you can still restore your lost commits using your local reflog if you had pulled the branch before the overwrite. Real-world example…
Short answer: Example: Before approving a PR for a new payment API, I check: Code readability and naming consistency Proper test coverage Security considerations (e.g., no API keys in code) Bonus: I sometimes use Suggest…
Short answer: When GitHub reports conflicts in a PR: Fetch and switch to your branch locally: git fetch origin git checkout feature/new-ui Real-world example (ShopNest) Feature work for “UPI payment” lives on feature/upi…
Short answer: Add comments or suggestions.? is a common interview topic in Git & GitHub. Give a clear definition, then one concrete example. Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews…
Short answer: A Pull Request is a request to merge your changes from one branch or fork into another repository or branch — typically to propose new code, bug fixes, or improvements. Example: You fixed a typo or added a…
Short answer: Example: If you merge feature/login into main, Git finds the last point they shared code, applies your login branch changes, and creates a new commit that connects both histories. Intermediate / Advanced Gi…
Short answer: If two developers change the same line in index.html (e.g., one changes the header text, another changes the same header), Git won’t know which to keep — you decide manually. Say this in the interview Defin…
Short answer: Aspect Merging Rebasing History Keeps all commits, including merge commits Creates a linear, cleaner history Safety Safe for shared/public branches Risky for shared branches (rewrites history) Use Case When…
Git & GitHub Developer Essentials · Version Control
Short answer: git filter-repo (preferred) git filter-repo --path path/to/file --invert-paths
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: git add . git commit git push
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: A Git submodule is a repository inside another repository — useful for including shared components or libraries.
You have multiple microservices that share a common authentication library. Instead of duplicating it, you include it as a submodule: git submodule add libs/auth Pros: Keeps shared code centralized. Cons: Requires careful syncing; new contributors must initialize submodules using: git submodule update --init --recursive
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Forking is when you create your own copy of someone else’s GitHub repository.
You do this directly on GitHub by clicking the “Fork” button on the top right of the repository page. Example: You want to contribute to a public project like freeCodeCamp. You click Fork, creating your own version under your account. You can modify it freely and then make pull requests to the original project. Command-line analogy: Forking is like cloning, but on the GitHub server level — it gives you your own remote repository to push to.
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Add the resolved file: git add <file> git commit # or continue the rebase
Feature work for “UPI payment” lives on feature/upi-payment. Open a PR to main; resolve conflicts before merge.
Git & GitHub Developer Essentials · Version Control
Short answer: Comman Description Safe for shared repos? git revert Creates a new commit that undoes changes from a previous commit ✅ Yes git reset Moves the branch pointer back to a previous commit, potentially removing commits ❌ No (rewrites history)
If you realize a commit caused an error: git revert will make a new commit that undoes it. git reset will erase it as if it never happened (good for local cleanup).
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Mark conflicts as resolved: git add <filename> git commit
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Working Directory: This is where you make changes to the files. It's your local workspace where you're actively editing code.
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Working Directory (modified files), Staging Area (files marked for next commit), Local Repository (committed files).
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Conventional Commits define a standard format for commit messages, such as: feat: add new user registration flow fix: correct login validation chore: update dependencies To enforce this automatically, use commitlint with husky: Setup: npm install --save-dev @commitlint/{config-conventional,cli} husky Create a commitlint.config.js: module.exports = { extends: ['@commitlint/config-conventional'] }; Then add a Git…
hook: npx husky install npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"' Now every commit is checked — bad messages are rejected. Example: ✅ feat: add password reset feature ❌ Added new password reset → ❌ rejected Why this matters: Enables automatic changelog and versioning. Keeps Git history consistent. Works well with tools like semantic-release.
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: nother to “v2.0.” Git will stop and ask you to pick which to keep.
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Reset Type What It Does Example Scenario -soft Moves HEAD to a previous commit but keeps your changes staged You committed too early and just want to edit the message or add more changes.
-mixed (default) Moves HEAD and unstages files but keeps your changes in the working directory You want to redo your git add selections. -hard Completely resets everything — deletes all local changes You want to discard all work and return to a clean state. Example: git reset --soft HEAD~1 # undo last commit, keep staged git reset --mixed HEAD~1 # undo last commit, unstage files git reset --hard HEAD~1 # undo last commit and delete changes
Git & GitHub Developer Essentials · Version Control
Short answer: nother changes the same header), Git won’t know which to keep — you decide manually.
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Instead of long-lived access keys, use federated identity: ■ AWS/GCP trusts GitHub’s identity token. ■ Short-lived credentials are issued dynamically. Example for AWS: permissions: id-token: write contents: read Real-world example: In one project, we replaced static AWS keys with OIDC-based auth in GitHub Actions — no more long-lived tokens, and access was automatically scoped per workflow.
Git & GitHub Developer Essentials · Version Control
Short answer: Conventional Commits define a standard format for commit messages, such as: feat: add new user registration flow fix: correct login validation chore: update dependencies To enforce this automatically, use commitlint with husky: Setup: npm install --save-dev @commitlint/{config-conventional,cli} husky Create a commitlint.config.js:… module.exports = {……… extends: ['@commitlint/config-conventional'] }; Then add a Git…
hook: npx husky install npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"' Now every commit is checked — bad messages are rejected.
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: git push origin --force
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: A detached HEAD means Git’s HEAD points to a specific commit instead of a branch — commits made now won’t belong to any branch. To fix it: Check what commit you’re on: git status
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Example: If your teammate accidentally ran git push origin main --force, you can still restore your lost commits using your local reflog if you had pulled the branch before the overwrite.
Feature work for “UPI payment” lives on feature/upi-payment. Open a PR to main; resolve conflicts before merge.
Git & GitHub Developer Essentials · Version Control
Short answer: Example: Before approving a PR for a new payment API, I check: Code readability and naming consistency Proper test coverage Security considerations (e.g., no API keys in code) Bonus: I sometimes use Suggested Changes in GitHub comments to make small fixes easier for contributors.
Before approving a PR for a new payment API, I check: Code readability and naming consistency Proper test coverage Security considerations (e.g., no API keys in code) Bonus: I sometimes use Suggested Changes in GitHub comments to make small fixes easier for contributors.
Git & GitHub Developer Essentials · Version Control
Short answer: When GitHub reports conflicts in a PR: Fetch and switch to your branch locally: git fetch origin git checkout feature/new-ui
Feature work for “UPI payment” lives on feature/upi-payment. Open a PR to main; resolve conflicts before merge.
Git & GitHub Developer Essentials · Version Control
Short answer: Add comments or suggestions.? is a common interview topic in Git & GitHub. Give a clear definition, then one concrete example.
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: A Pull Request is a request to merge your changes from one branch or fork into another repository or branch — typically to propose new code, bug fixes, or improvements. Example: You fixed a typo or added a feature in your fork of a project. You create a PR asking the original maintainers to “pull” your changes into their main branch. PRs enable: Code review Automated testing Discussion before merging
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.
Git & GitHub Developer Essentials · Version Control
Short answer: Example: If you merge feature/login into main, Git finds the last point they shared code, applies your login branch changes, and creates a new commit that connects both histories. Intermediate / Advanced Git Concepts
Feature work for “UPI payment” lives on feature/upi-payment. Open a PR to main; resolve conflicts before merge.
Git & GitHub Developer Essentials · Version Control
Short answer: If two developers change the same line in index.html (e.g., one changes the header text, another changes the same header), Git won’t know which to keep — you decide manually.
Git & GitHub Developer Essentials · Version Control
Short answer: Aspect Merging Rebasing History Keeps all commits, including merge commits Creates a linear, cleaner history Safety Safe for shared/public branches Risky for shared branches (rewrites history) Use Case When collaboration is ongoing When you want a clean, linear history before merging Real-world example: Before merging a feature into main, many teams rebase it to make the commit history cleaner.
But during teamwork, merging is safer because it doesn’t rewrite other people’s work.