Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
git init - creates a new Git repository in the current directory. What interviewers expect A clear definition tied to Version Control in Git & GitHub projects Trade-offs (performance, maintainability, security, cost)…
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 What interviewers expect A clear definition tied to Version…
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/…
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…
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…
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 What interviewers expect A clear definition tied to Version Co…
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…
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:…
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. What interviewers expect A clear definition tied to Version C…
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 s…
You can enforce reviews and branch protection rules in repository settings under Settings → Branches → Branch protection rules. You can require: Pull requests before merging At least one approval Passing CI checks (e.g.,…
Use git diff with two commit hashes: git diff <commit1> <commit2> This shows line-by-line changes between the two commits. Example: If you want to compare how your project changed between version 1.0 and vers…
Locally: git branch -d feature/old-branch (-D for force delete if it’s not merged) Remotely: git push origin --delete feature/old-branch Real-world example: fter merging your feature branch into main, you can safely dele…
To clone an existing repository, you use the git clone command followed by the URL of the remote repository: git clone This command creates a copy of the repository on your local machine, including all its files nd histo…
git add: This command stages changes, telling Git which modifications you want to include in the next commit. It doesn't save the changes to the repository yet, just prepares them. git commit: This actually saves the cha…
&lt;branch-name&gt; - moves your HEAD pointer to another branch. What interviewers expect A clear definition tied to Version Control in Git & GitHub projects Trade-offs (performance, maintainability, security…
Answer: To slim down a bloated repository: Remove large unnecessary files: git filter-repo --path path/to/largefile --invert-paths What interviewers expect A clear definition tied to Version Control in Git & GitHub p…
In CI/CD, I automate version tagging to keep releases consistent and traceable. Example pipeline step (GitHub Actions): name: Tag release run: | VERSION=$(node -p "require('./package.json').version") git tag -a "v$VERSIO…
Answer: git checkout &lt;branch-name&gt; or git switch &lt;branch-name&gt; - moves your HEAD pointer to another branch. What interviewers expect A clear definition tied to Version Control in Git & Git…
Answer: Migrating involves preserving history, branches, and tags. Steps (SVN example): Install Git SVN: git svn clone -trunk=trunk -branches=branches --tags=tags What interviewers expect A clear definition tied to Versi…
A protected branch (like main) restricts direct commits or merges unless specific rules are met. You can configure: Require pull request reviews Require status checks (tests) to pass Restrict who can push Prevent force p…
Answer: When two branches modify the same part of a file, Git can’t automatically decide which version to keep — this creates a conflict. Git will: What interviewers expect A clear definition tied to Version Control in G…
git cherry-pick lets you apply a specific commit from one branch to another, without merging the entire branch. Example: Imagine you fixed a typo in the develop branch but need that same fix in main immediately. Instead…
Key practices I Branch-per-feature model – Each developer works on isolated branches. Pull Requests (PRs) for merging into main. Code reviews + CI tests required before merging. Protected branches prevent direct commits.…
A protected branch (like main) restricts direct commits or merges unless specific rules are met. You can configure: Require pull request reviews Require status checks (tests) to pass Restrict who can push Prevent force p…
Git & GitHub Developer Essentials · Version Control
git init - creates a new Git repository in the current directory.
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
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
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
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
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 & GitHub Developer Essentials · Version Control
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:
run: npm install
run: npm test
Whenever code is pushed, GitHub automatically runs your tests — ensuring quality before
merging.
Git & GitHub Developer Essentials · Version Control
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:
fter 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
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
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
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
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
git fetch --prune
fter several months, your repo has 50 old feature branches. You can prune them
utomatically in CI or periodically with these commands.
Git & GitHub Developer Essentials · Version Control
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.
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
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
Example:
If version v2.0 introduced a bug in the payment flow, I revert to v1.9.1 (the last stable tag)
nd redeploy while investigating the issue.
In CI/CD pipelines:
We often have a ROLLBACK_TAG variable that can deploy a known safe version
utomatically.
Git & GitHub Developer Essentials · Version Control
You can enforce reviews and branch protection rules in repository settings under
Settings → Branches → Branch protection rules.
You can require:
Example:
Your team sets a rule that all PRs must be reviewed by at least one other developer and
must pass automated tests before merging.
Git & GitHub Developer Essentials · Version Control
Use git diff with two commit hashes:
git diff <commit1> <commit2>
This shows line-by-line changes between the two commits.
Example:
If you want to compare how your project changed between version 1.0 and version 1.1:
git diff v1.0 v1.1
You’ll see added, removed, and modified lines across files.
Git & GitHub Developer Essentials · Version Control
Locally:
git branch -d feature/old-branch
Remotely:
git push origin --delete feature/old-branch
fter merging your feature branch into main, you can safely delete it to keep your repository
clean.
Git & GitHub Developer Essentials · Version Control
To clone an existing repository, you use the git clone command followed by the URL of
the remote repository:
git clone
This command creates a copy of the repository on your local machine, including all its files
nd history.
Real-World Example:
If you're joining an open-source project on GitHub, you can clone the repository to your
machine by running the git clone command. This gives you access to the full codebase
to start contributing.
Git & GitHub Developer Essentials · Version Control
include in the next commit. It doesn't save the changes to the repository yet, just
prepares them.
in your project’s history.
Real-World Example:
You’ve edited a few files in your project. First, you use git add . to stage all changes,
nd then you use git commit -m "Fixed bug in homepage" to save those changes
to the repository.
Git & GitHub Developer Essentials · Version Control
<branch-name> - moves your HEAD pointer to another branch.
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
Answer: To slim down a bloated repository: Remove large unnecessary files: git filter-repo --path path/to/largefile --invert-paths
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
In CI/CD, I automate version tagging to keep releases consistent and traceable.
Example pipeline step (GitHub Actions):
run: |
VERSION=$(node -p "require('./package.json').version")
git tag -a "v$VERSION" -m "Release version $VERSION"
git push origin "v$VERSION"
Versioning style:
I use Semantic Versioning (SemVer) → MAJOR.MINOR.PATCH
Example: v2.1.4
This helps CI/CD pipelines automatically trigger deployments for new versions.
Git & GitHub Developer Essentials · Version Control
Answer: git checkout <branch-name> or git switch <branch-name> - moves your HEAD pointer to another branch.
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
Answer: Migrating involves preserving history, branches, and tags. Steps (SVN example): Install Git SVN: git svn clone -trunk=trunk -branches=branches --tags=tags
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
A protected branch (like main) restricts direct commits or merges unless specific rules are
met.
You can configure:
Example:
You protect the main branch to ensure developers can only merge code through PRs that
have passed CI checks and received approval — preventing accidental overwrites.
Git & GitHub Developer Essentials · Version Control
Answer: When two branches modify the same part of a file, Git can’t automatically decide which version to keep — this creates a conflict. Git will:
In a production Git & GitHub application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Git & GitHub Developer Essentials · Version Control
git cherry-pick lets you apply a specific commit from one branch to another, without
merging the entire branch.
Example:
Imagine you fixed a typo in the develop branch but need that same fix in main
immediately. Instead of merging all of develop, you can just cherry-pick that commit:
git cherry-pick 1a2b3c4
Real-world use case:
Useful when you want to apply a hotfix or small bug fix without merging unrelated feature
work.
Git & GitHub Developer Essentials · Version Control
Key practices I
conflicts.
Example:
t a fintech startup, 8 engineers worked on a single monorepo. We used short-lived
branches and daily merges, with GitHub Actions running automatic tests for every PR — this
reduced integration headaches.
Git & GitHub Developer Essentials · Version Control
A protected branch (like main) restricts direct commits or merges unless specific rules are
met.
You can configure:
Example:
You protect the main branch to ensure developers can only merge code through PRs that
have passed CI checks and received approval — preventing accidental overwrites.