Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: A commit in Git is a snapshot of your project at a specific point in time. Explain a bit more It records all the changes you've made to the files and saves them to the repository. Every commit has a unique…
Short answer: A snapshot of your project at a specific point in time, including changes and a message. Real-world example (ShopNest) Prefer clear commits: fix(cart): prevent negative quantities instead of update . Say th…
Short answer: ctions? Security in CI/CD pipelines is crucial — you never want secrets hard-coded in code or workflows. Best practices: Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI che…
Short answer: git stash temporarily saves your uncommitted changes so you can work on something else without committing unfinished work. Example: You’re fixing a login bug but suddenly need to switch branches to fix a pr…
Short answer: Security in CI/CD pipelines is crucial — you never want secrets hard-coded in code or workflows. Best practices: Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so b…
Short answer: When branches diverge, Git can’t automatically merge them — it needs your help. Steps: Pull the latest changes and rebase or merge: git fetch origin git merge origin/main or git rebase origin/main Real-worl…
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: How do you perform a code review using GitHub tools? is a common interview topic in Git & GitHub. Give a clear definition, then one concrete example. Real-world example (ShopNest) ShopNest’s team uses G…
Short answer: Real-world example: If you’re a team lead, you review a PR for a new feature, check coding standards, ensure tests pass, and approve it before merging into main. Say this in the interview Define — one clear…
Short answer: How do you review and approve a Pull Request? 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 P…
Short answer: git stash temporarily saves your uncommitted changes so you can work on something else without committing unfinished work. Example: You’re fixing a login bug but suddenly need to switch branches to fix a pr…
Short answer: git fetch: It retrieves changes from a remote repository but does not apply them to your working directory. Explain a bit more You can think of it as checking for updates without actually installing them. g…
Short answer: git init - creates a new Git repository in the current directory. Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.…
Short answer: Can you give examples? Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing). They live inside .git/hooks/. Common examples: pre-commit: Run linting or uni…
Short answer: time, including changes and a message. Real-world example (ShopNest) Prefer clear commits: fix(cart): prevent negative quantities instead of update . Say this in the interview Define — one clear sentence (t…
Short answer: If you accidentally committed to the wrong branch, you can move those commits cleanly. Steps: Switch to the correct branch: git checkout correct-branch Real-world example (ShopNest) Feature work for “UPI pa…
Short answer: Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing). Explain a bit more They live inside .git/hooks/. Git hooks are scripts that run automatically when s…
Short answer: GitHub Actions is GitHub’s built-in Continuous Integration/Continuous Deployment (CI/CD) platform. Explain a bit more It lets you automate tasks — like running tests, building code, or deploying apps — ever…
Short answer: To bring back your stashed work: git stash apply # reapplies the most recent stash git stash pop # reapplies AND deletes the stash git stash list # shows all stashes git stash show -p # shows what changes a…
Short answer: Merge conflicts occur when two branches modify the same part of a file differently. To resolve: Run the merge command: git merge feature/contact-form Real-world example (ShopNest) Feature work for “UPI paym…
Short answer: To create a new Git repository, navigate to your project directory and use the command: git init This initializes an empty Git repository in that directory. Explain a bit more Now you can start tracking cha…
Short answer: (Duplicate of #4) A snapshot of your project at a specific point in time, including changes and a message. Real-world example (ShopNest) Prefer clear commits: fix(cart): prevent negative quantities instead…
Short answer: Old branches can clutter your repo. You can clean them locally and remotely. Commands: To delete merged branches locally: git branch --merged main | grep -v "main" | xargs git branch -d To prune d…
Short answer: Example: You pushed .env with a production API key. Even after deletion, it’s still in the Git history — so you must clean and rotate keys right away. Real-world example (ShopNest) ShopNest’s team uses GitH…
Short answer: There are several safe rollback methods: Option 1 — Revert to a previous tag (recommended): git revert <commit-hash> git push origin main This creates a new commit that undoes the bad release. Option…
Git & GitHub Developer Essentials · Version Control
Short answer: A commit in Git is a snapshot of your project at a specific point in time.
It records all the changes you've made to the files and saves them to the repository. Every commit has a unique ID, and it's like a save point in a video game—if something breaks, you can go back to any commit. Real-World Example: Let’s say you fixed a bug on the homepage of your app. After completing the fix, you commit the changes to the repository. Later, if the fix causes an issue, you can roll back to the previous commit.
Git & GitHub Developer Essentials · Version Control
Short answer: A snapshot of your project at a specific point in time, including changes and a message.
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: ctions? Security in CI/CD pipelines is crucial — you never want secrets hard-coded in code or workflows. Best practices:
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 stash temporarily saves your uncommitted changes so you can work on something else without committing unfinished work. Example: You’re fixing a login bug but suddenly need to switch branches to fix a production issue. Instead of committing half-done code, you run: git stash git checkout main Later, you can come back and reapply your stashed work.
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: Security in CI/CD pipelines is crucial — you never want secrets hard-coded in code or workflows. Best practices:
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: When branches diverge, Git can’t automatically merge them — it needs your help. Steps: Pull the latest changes and rebase or merge: git fetch origin git merge origin/main or git rebase origin/main
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: 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: How do you perform a code review using GitHub tools? 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: Real-world example: If you’re a team lead, you review a PR for a new feature, check coding standards, ensure tests pass, and approve it before merging into main.
Git & GitHub Developer Essentials · Version Control
Short answer: How do you review and approve a Pull Request? 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: git stash temporarily saves your uncommitted changes so you can work on something else without committing unfinished work. Example: You’re fixing a login bug but suddenly need to switch branches to fix a production issue. Instead of committing half-done code, you run: git stash git checkout main Later, you can come back and reapply your stashed work.
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 fetch: It retrieves changes from a remote repository but does not apply them to your working directory.
You can think of it as checking for updates without actually installing them. git pull: This does two things: it fetches the latest changes and then merges them into your current branch. It's like fetching updates and immediately applying them. Real-World Example: If you're working on a project with teammates, git fetch allows you to see what changes have been made without affecting your code. git pull, on the other hand, will update your local copy and merge those changes with your work, which can sometimes result in merge conflicts.
Git & GitHub Developer Essentials · Version Control
Short answer: git init - creates a new Git repository in the current directory.
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: Can you give examples? Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing). They live inside .git/hooks/. Common examples: pre-commit: Run linting or unit tests before a commit # .git/hooks/pre-commit npm run lint || exit 1 pre-push: Prevent pushes to main if [ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]; then echo "You can't push directly to main!" exit 1 fi…
Example: In a team, we set a pre-commit hook to check code formatting with ESLint before any commit — ensuring consistency across all contributors.
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: time, including changes and a message.
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: If you accidentally committed to the wrong branch, you can move those commits cleanly. Steps: Switch to the correct branch: git checkout correct-branch
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: Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing).
They live inside .git/hooks/. Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing). They live inside .git/hooks/. Common examples: pre-commit: Run linting or unit tests before a commit # .git/hooks/pre-commit npm run lint || exit 1 pre-push: Prevent pushes to main if [ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]; then echo "You can't push directly to main!" exit 1 fi In a team, we set a pre-commit hook to check code formatting with ESLint before any commit — ensuring consistency across all contributors. Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing). They live inside… Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing). They live inside .git/hooks/. Git hooks are scripts that run automatically when specific Git events…
In a team, we set a pre-commit hook to check code formatting with ESLint before any commit — ensuring consistency across all contributors. Git hooks are scripts that run automatically when specific Git events occur (like committing or pushing). They live inside .git/hooks/. Common examples: pre-commit: Run linting or unit tests before a commit # .git/hooks/pre-commit npm run lint || exit 1 pre-push: Prevent pushes to main if [ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]; then echo "You can't push directly to main!" exit 1 fi Example: In a team, we set a pre-commit hook to check code formatting with ESLint before any commit — ensuring consistency across all contributors.
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: GitHub Actions is GitHub’s built-in Continuous Integration/Continuous Deployment (CI/CD) platform.
It lets you automate tasks — like running tests, building code, or deploying apps — every time code is pushed or a PR is opened. Example: You can create a workflow file .github/workflows/test.yml: name: Run Tests on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: uses: actions/checkout@v4 name: Install dependencies run: npm install name: Run tests run: npm test Whenever code is pushed, GitHub automatically runs your tests — ensuring quality 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: To bring back your stashed work: git stash apply # reapplies the most recent stash git stash pop # reapplies AND deletes the stash git stash list # shows all stashes git stash show -p # shows what changes are in a stash Real-world example: After resolving the production issue, you return to your feature branch and restore your previous changes with git stash pop.
Git & GitHub Developer Essentials · Version Control
Short answer: Merge conflicts occur when two branches modify the same part of a file differently. To resolve: Run the merge command: git merge feature/contact-form
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: To create a new Git repository, navigate to your project directory and use the command: git init This initializes an empty Git repository in that directory.
Now you can start tracking changes in your project. Real-World Example: Imagine you're starting a new website project on your computer. You open your terminal, go to your project folder, and type git init. This sets up the Git repository, and you can start tracking your changes immediately.
Git & GitHub Developer Essentials · Version Control
Short answer: (Duplicate of #4) A snapshot of your project at a specific point in time, including changes and a message.
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: Old branches can clutter your repo. You can clean them locally and remotely. Commands: To delete merged branches locally: git branch --merged main | grep -v "main" | xargs git branch -d To prune deleted remote branches: git fetch --prune Example: After several months, your repo has 50 old feature branches. You can prune them automatically in CI or periodically with these commands.
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: You pushed .env with a production API key. Even after deletion, it’s still in the Git history — so you must clean and rotate keys right away.
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: There are several safe rollback methods: Option 1 — Revert to a previous tag (recommended): git revert <commit-hash> git push origin main This creates a new commit that undoes the bad release. Option 2 — Deploy a stable tag: git checkout v1.2.3 git push origin main --force
If version v2.0 introduced a bug in the payment flow, I revert to v1.9.1 (the last stable tag) and redeploy while investigating the issue. In CI/CD pipelines: We often have a ROLLBACK_TAG variable that can deploy a known safe version automatically.
ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.