Git and Version Control interview questions
100 Cloud & DevOps practice questions. Read what a strong answer covers, then practise it out loud against the clock.
Practise Git and Version Control questionsBeginner
- .gitignore isn't ignoring a file
- Accidentally committed a password
- Branch protection rules
- Branches in Git
- Cloning a repository
- Committed to the wrong branch
- Configuring your Git identity
- Exploring history with git log
- Fixing a typo in the last commit message
- Forks vs branches
- Git hosting platforms
- Keeping a fork up to date
- Merging branches
- Monorepo vs multiple repositories
- Pull request has merge conflicts
- Pull requests
- Push rejected because remote has new commits
- Putting an existing project under version control
- Recovering work after a bad reset
- Remotes, push, pull and fetch
- Repository is huge because of large files
- Resolving merge conflicts
- Semantic versioning
- Tags and releases
- The .gitignore file
- Undoing a bad commit that is already deployed
- Undoing changes in Git
- Updating a pull request after review comments
- Using git stash
- Viewing differences with git diff
- What Git is and why teams use it
- What HEAD and detached HEAD mean
- Working directory, staging area and repository
- Writing good commit messages
Intermediate
- A contractor needs access to only part of the code
- A long-lived feature branch is painful to merge
- A release was tagged on the wrong commit
- Applying an urgent fix to an older release
- Cherry-picking commits
- Choosing a branching strategy for a team
- CI is slow in a growing monorepo
- Cleaning up a messy commit history before merging
- CODEOWNERS files
- Commits show the wrong author
- Committing only part of your changes
- Conventional Commits
- Designers keep overwriting each other's files
- Every line shows as changed after a Windows developer's commit
- Finding bugs with git bisect
- Finding which commit broke the build
- Git branching strategies
- Git hooks and pre-commit
- Git submodules and alternatives
- Git worktrees
- GitOps with Git as the source of truth
- How Git stores data internally
- Interactive rebase
- Merge commit vs squash vs rebase merge
- Re-merging a feature after reverting it
- Rebase vs merge
- Rebasing a branch with many conflicts
- Release branches and hotfixes
- Removing a secret from the entire Git history
- Signing commits
- Someone force-pushed over shared history
- Standardising formatting and checks across a team
- Trunk-based development
Experienced
- Automated dependency update pull requests
- Automating releases from Git history
- Build tooling for monorepos
- CI pipeline exposed to malicious pull requests
- Consolidating many repositories into a monorepo
- Dependency confusion attack risk
- Git hosting platform outage blocks deployments
- Git LFS in depth
- Git workflows in regulated environments
- Hotfixes in a trunk-based workflow
- Hundreds of abandoned repositories
- Inner source practices
- Main branch is broken several times a week
- Maintaining several supported product versions
- Merge queues
- Migrating from SVN to Git
- Migrating repositories between Git platforms
- Open-sourcing an internal repository
- Optimising Git operations in CI
- Partial clone and sparse checkout
- Proving every production change was reviewed
- Pull requests wait days for review
- Reviewing infrastructure changes safely in Git
- Rolling out secret scanning across the organisation
- Scaling Git for very large repositories
- Securing source code repositories
- Security-sensitive changes slip through code review
- Shrinking a bloated repository history
- Structuring a GitOps repository for many environments
- Suspicious commit found in a critical repository
- Tracing what code is running in production
- Using Git data to measure delivery performance
- When rewriting history is acceptable