Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Create a branch to restore it: git checkout -b recovery-branch <commit-hash> Example code Create a branch to restore it: git checkout -b recovery-branch <commit-hash> Real-world example (ShopNes…
Short answer: If you deleted a branch accidentally but haven’t run garbage collection yet, it can be recovered using the commit log. Steps: Find the last commit of that branch: git reflog Example output: abc1234 refs/hea…
Short answer: <<<<<<< HEAD Your changes ======= Incoming changes >>>>>>> main Real-world example (ShopNest) Feature work for “UPI payment” lives on feature/upi-payment . Open a P…
Short answer: Large binary files (like images, videos, or data models) bloat Git repositories since Git stores every version. Explain a bit more To handle them efficiently, I use Git LFS (Large File Storage). Setup: git…
Short answer: If a commit has been pushed to a shared branch, the safest way is to revert it — not remove it. Explain a bit more git revert <commit-hash> This creates a new commit that undoes the changes from the o…
Short answer: You can create and switch to a new branch using: git checkout -b feature/login-page This creates a branch named feature/login-page and switches you to it immediately. Explain a bit more Alternatively, you c…
Short answer: A system where every developer has a full copy of the repository, including its entire history, allowing for offline work and decentralized collaboration. Real-world example (ShopNest) ShopNest’s team uses…
Short answer: (Working Directory, Staging Area, Repository) Working Directory: This is where you make changes to the files. Explain a bit more It's your local workspace where you're actively editing code. Staging Area (I…
Short answer: Signed commits ensure authenticity — they’re cryptographically verified with a GPG or SSH key, proving the commit really came from you and wasn’t tampered with. Setup: Generate a GPG key: gpg --full-generat…
Short answer: Both commands integrate changes from one branch into another, but they work differently: git merge combines the histories of two branches, creating a new “merge commit.” git rebase rewrites history by placi…
Short answer: rea, Repository) 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 w…
Short answer: next commit), Local Repository (committed files). 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…
Short answer: Mask secrets automatically using: run: echo "Deploying..." && echo "${{ secrets.AWS_SECRET_KEY }}" GitHub automatically redacts these values from logs. Real-world example (ShopNe…
Short answer: You’ll see a green “Verified” badge on signed commits. Why it matters: Verifies authorship for open-source contributions. Helps in regulated environments (e.g., fintech, healthcare). Prevents supply chain a…
Short answer: Signed commits ensure authenticity — they’re cryptographically verified with a GPG or SSH key, proving the commit really came from you and wasn’t tampered with. Setup: Generate a GPG key: gpg --full-generat…
Short answer: git remote add origin git push --all origin git push --tags origin Real-world example (ShopNest) ShopNest’s team uses GitHub PRs with reviews and CI checks so broken builds never reach production unnoticed.…
Short answer: Prune and repack: git gc --prune=now --aggressive Real-world example (ShopNest) Feature work for “UPI payment” lives on feature/upi-payment . Open a PR to main ; resolve conflicts before merge. Say this in…
Short answer: A force push can rewrite history and make commits disappear from the remote branch — but they’re often recoverable. Steps: Run git reflog locally to view all commit references: git reflog show origin/main R…
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: 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…
Git & GitHub Developer Essentials · Version Control
Short answer: Create a branch to restore it: git checkout -b recovery-branch <commit-hash>
Create a branch to restore it: git checkout -b recovery-branch <commit-hash>
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: If you deleted a branch accidentally but haven’t run garbage collection yet, it can be recovered using the commit log. Steps: Find the last commit of that branch: git reflog Example output: abc1234 refs/heads/feature/login: commit: Add login validation
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: <<<<<<< HEAD Your changes ======= Incoming changes >>>>>>> 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: Large binary files (like images, videos, or data models) bloat Git repositories since Git stores every version.
To handle them efficiently, I use Git LFS (Large File Storage). Setup: git lfs install git lfs track "*.psd" git add .gitattributes git commit -m "Track Photoshop files with Git LFS" Explanation: Git LFS replaces large files with lightweight text pointers inside Git, while the actual binary files are stored on a separate LFS server. Example: If a game project has large texture files, Git LFS prevents the repo from becoming gigabytes in size, improving clone and fetch performance.
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: If a commit has been pushed to a shared branch, the safest way is to revert it — not remove it.
git revert <commit-hash> This creates a new commit that undoes the changes from the old one, without rewriting history. Example: If you pushed a buggy commit that broke the login page, git revert creates a new commit that removes those buggy changes while keeping the history intact. ⚠ Avoid git reset on shared branches because it rewrites history — it can mess up others’ work.
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: You can create and switch to a new branch using: git checkout -b feature/login-page This creates a branch named feature/login-page and switches you to it immediately.
Alternatively, you can do it in two steps: git branch feature/login-page git checkout feature/login-page Real-world example: If your team assigns you to build a login page, you can create a branch feature/login-page to isolate your changes from the main code.
Git & GitHub Developer Essentials · Version Control
Short answer: A system where every developer has a full copy of the repository, including its entire history, allowing for offline work and decentralized collaboration.
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, Staging Area, Repository) Working Directory: This is where you make changes to the files.
It's your local workspace where you're actively editing code. Staging Area (Index): This is like a holding area where you prepare files before committing them to the repository. You can choose which changes to add here. Repository: This is where Git stores the project’s history (commits). It's the permanent record of your project's evolution. Real-World
When you're editing code, it starts in the working directory. After editing, you "stage" your changes (using git add), which moves them to the staging area. Once you're ready to save your changes permanently, you commit them to the repository using git commit.
Git & GitHub Developer Essentials · Version Control
Short answer: Signed commits ensure authenticity — they’re cryptographically verified with a GPG or SSH key, proving the commit really came from you and wasn’t tampered with. Setup: Generate a GPG key: gpg --full-generate-key
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: Both commands integrate changes from one branch into another, but they work differently: git merge combines the histories of two branches, creating a new “merge commit.” git rebase rewrites history by placing your branch’s commits on top of another branch, making it look like you developed your changes sequentially.
Real-world analogy: Merge: Like combining two storylines into one — you keep both histories. Rebase: Like rewriting your story so it appears you followed the main storyline all along. Example: If your feature branch has diverged from main, merging will keep both timelines, while rebasing will make it look like your branch was based on the latest main version all along.
Git & GitHub Developer Essentials · Version Control
Short answer: rea, Repository) 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: 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: Mask secrets automatically using: run: echo "Deploying..." && echo "${{ secrets.AWS_SECRET_KEY }}" GitHub automatically redacts these values from logs.
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: You’ll see a green “Verified” badge on signed commits. Why it matters: Verifies authorship for open-source contributions. Helps in regulated environments (e.g., fintech, healthcare). Prevents supply chain attacks via spoofed commits. Real-world example: In a security-conscious org, all commits to the main branch are required to be GPG-signed — GitHub enforces this with branch protection rules.
Git & GitHub Developer Essentials · Version Control
Short answer: Signed commits ensure authenticity — they’re cryptographically verified with a GPG or SSH key, proving the commit really came from you and wasn’t tampered with. Setup: Generate a GPG key: gpg --full-generate-key
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Git & GitHub Developer Essentials · Version Control
Short answer: git remote add origin git push --all origin git push --tags origin
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: Prune and repack: git gc --prune=now --aggressive
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: A force push can rewrite history and make commits disappear from the remote branch — but they’re often recoverable. Steps: Run git reflog locally to view all commit references: git reflog show origin/main
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
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: 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.
Install Toolliyo like an app Free
Home-screen access to tutorials, coding practice & career tools — no app store needed.
On iPhone/iPad: tap Share then Add to Home Screen.