GIT
31 bites tagged GIT: interview questions with model answers, and 60-second explainers.
Test yourself: Top 30 GIT interview questions →Multiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.Deploying to Heroku via Git
Push to the remote, a buildpack detects the language, builds a slug, and runs the Procfile process.
Minimizing Storyboard merge conflicts
Split into many small storyboards or xibs, or move to programmatic or SwiftUI layout; process-wise coordinate ownership and merge often.
Write a conventional commit for a non-US date sorting bug
Pick fix(locale): imperative subject; body explains root cause, impact, and SemVer mapping.
Explain .gitignore and its impact on faster, reliable, secure CI builds
Exclude build artifacts to shrink clones and stabilize cache keys; block secrets from runners.
Committed an API key to Git. Describe two automated CI/CD prevention methods.
This tests layered secret protection in Git workflows. A strong answer names pre-commit scanning and server-side push protection or pipeline scanning. Mention rotating that key. A weak answer only suggests manual review without automated gates.
Why avoid committing secrets to Git, and secure local alternatives?
This tests basic secret hygiene and environment isolation. A strong answer notes Git history is immutable and distributed, so secrets persist in forks forever, and proposes environment variables or gitignored dotenv files.
Compare git submodules and git subtree for CI/CD
Tests dependency integration trade-offs in CI. Submodules need recursive clones and pinned commits, complicating checkout; subtree inlines code, simplifying clone but bloating history. Red flag: omitting submodule detached HEAD pain or calling subtree free.
How do you fully remove leaked credentials from Git history?
This tests Git history rewriting and incident response. Rotate the secret first, then use git-filter-repo to purge the file, force-push main, and require all teammates to re-clone before resuming. A red flag is recommending git revert or skipping rotation.
How do you safely merge a 50-commit stale branch with conflicts?
Assess relevance, merge main locally, validate via draft PR and tests, merge off-peak with rollback ready.
Describe using a pre-push Git hook for checks and its CI limitations.
It tests client-side automation versus server-side policy. An executable .git/hooks/pre-push script runs tests and exits non-zero to block, noting hooks are not cloned, skipped via --no-verify, and local-only. A red flag is treating them as policy gate.
Difference between git merge and git rebase before a pull request
Rebase rewrites SHAs, duplicating CI builds; merge keeps identity and triggers one build.
Git Tags: Immutable Milestones for Release History
A Git tag is a permanent bookmark on a commit, usually marking releases like v2.0. Annotated tags store author, date, and GPG signatures to anchor deploy pipelines.
Trunk-Based Development vs. GitFlow for High-Frequency Releases
This tests your grasp of modern release strategy. Explain how TBD enables frequent merges to main, while feature toggles decouple deployment from release for safety. Contrast this with GitFlow's versioned release model.
Trunk-Based Development vs. GitFlow for High-Frequency Releases
This tests your grasp of modern CI/CD trade-offs. A great answer explains how TBD's frequent merges to main, decoupled from release by feature flags, enable velocity. Then, contrast this with GitFlow's complexity.
Git-Based CI Triggers: Automating on Events
Think of Git events like push or pull_request as the "play" button for your automation. This is how CI systems automatically run tests on new code. The footgun is using broad triggers, like push on all branches, which causes costly and redundant runs.
DVC: Git for Data and ML Models
DVC extends Git to version large data files and models without bloating your repo. It stores small pointer files in Git that reference large files in cloud storage.
Semantic Release: Automate Versioning with Commit Messages
Semantic Release automates versioning by reading your commit messages. It decides if a change is a fix, feature, or breaking change and bumps the version for you. It's used in CI/CD to publish packages automatically.
Pre-commit Hooks: Your Code's Quality Gatekeeper
Think of a pre-commit hook as a bouncer for your codebase. It's a script that runs before Git finalizes a commit, checking your changes against project rules. Use it to automatically lint code, run formatters, or check for secrets before they enter history.
Hotfix Deployment: Emergency Production Patches
A hotfix addresses an urgent production defect in a focused change. After testing and releasing it, bring the fix into the ongoing development branches too, so a later release does not reintroduce the same bug.
Git LFS: Versioning Large Files Without Bloating Your Repo
Git LFS replaces large files with text pointers in your repo, storing the actual data on a remote server. This keeps clones fast when versioning videos, datasets, or graphics. Footgun: git lfs track only affects new files, not existing ones.
Git Cherry-Pick: Copy a Commit to Another Branch
Think of git cherry-pick as copying a single commit's changes from one branch and reapplying them as a new commit on another. It's for backporting a bug fix without merging an entire feature branch.
GitFlow: A Branching Model for Versioned Releases
GitFlow organizes your repo around two main branches: master for production and develop for integration. It's designed for projects with distinct, numbered releases, like desktop apps, not for continuously delivered web apps where simpler models are…
GitHub Flow: A Simple, Branch-Based Workflow
GitHub Flow is a simple workflow where main is always stable and new work happens on a feature branch. It's used for continuous delivery, from code to documentation.
Git Rebase: Rewriting History for a Cleaner Timeline
Git rebase rewrites history by transplanting your commits onto a new base, creating a clean, linear project history instead of a merge bubble. It's used to catch a feature branch up with main. Never rebase a branch others are using; it rewrites history.
Get GIT bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.