100 Git Interview Questions and Answers
DevOps, Cloud & Tools · 100 questions, each with a full written answer — free, no sign-up.
Reading is step one. Saying it out loud is the interview.
Our AI interviewer calls your phone and runs a realistic Git interview — then scores it.
📞 Practice Git — free 15 min
📕 Buy this interview preparation book: 100 Git questions & answers — PDF + EPUB for $5
Basic
- What is Git?
- What is version control, and why is it important?
- Can you explain the difference between centralized and distributed version control systems?
- How do you initialize a new Git repository?
- What is the purpose of the .gitignore file, and how do you create one?
- What are the basic Git workflow stages?
- What is the difference between ’git add’ and ’git commit’ commands?
- Can you explain the difference between ’git fetch’ and ’git pull’?
- What is a branch in Git, and how do you create one?
- How do you switch between branches in Git?
- What is the purpose of ’git merge’, and how do you use it?
- What is a ’git rebase’, and when would you use it?
- Can you explain the difference between ’git stash’ and ’git stash apply’?
- How do you view the commit history in Git?
- What is the purpose of the ’git remote’ command, and how do you use it?
- How do you clone a repository in Git?
- How do you create and apply a patch in Git?
- What is the purpose of ’git revert’ and ’git reset’, and what are the differences between them?
- How do you resolve merge conflicts in Git?
- What are the best practices for writing a good commit message?
Intermediate
- What is the difference between a "fast-forward" and a "recursive" merge in Git?
- How can you view the differences between the working directory and the most recent commit?
- How do you remove untracked files from your working directory?
- What is a detached HEAD in Git, and how do you deal with it?
- How do you use ’git bisect’ to find a specific commit that introduced a bug?
- What is the purpose of ’git cherry-pick’, and how do you use it?
- How do you use ’git reflog’, and when would you need it?
- Can you explain the difference between a shallow clone and a deep clone in Git?
- How do you create and use Git aliases to simplify your workflow?
- What are Git submodules, and how do you use them?
- How do you squash multiple commits into a single commit using ’git rebase’?
- What is the purpose of ’git blame’, and how do you use it?
- How do you sign your commits with GPG in Git, and why is it important?
- Can you explain the difference between ’git push –force’ and ’git push –force-with-lease’?
- How do you set up a Git hook, and what are some common use cases?
- How do you manage multiple remote repositories in a single local Git repository?
- What is the purpose of ’git tag’, and how do you create and use tags in Git?
- How do you configure Git to use a specific text editor or diff tool?
- How do you use ’git clean’ to remove untracked files and directories?
- What is a Git bare repository, and when would you use one?
Advanced
- Can you explain the Git object model, including blobs, trees, and commits?
- How does Git store data internally, and what is the role of the Git object database?
- What are Git’s packfiles, and how do they optimize repository storage?
- Can you explain the concept of a "rebase conflict" and how to resolve it?
- How do you interact with Git’s staging area without using ’git add’ and ’git rm’ commands?
- How do you split a repository into multiple smaller repositories while preserving history?
- Can you describe the process of rebasing an entire branch onto another branch, including resolving conflicts?
- How do you use ’git filter-branch’ or ’git filter-repo’ to modify the history of a Git repository?
- How do you use ’git refspec’ to configure advanced push and fetch behaviors?
- What is the Git garbage collection process, and when should it be run manually?
- How do you configure a Git repository to use Large File Storage (LFS)?
- How do you use ’git rerere’ to reuse resolved merge conflicts, and what are the potential risks?
- What are some advanced techniques for searching Git commit history, such as using ’git log’ with custom formats and filters?
- Can you explain the purpose of ’git notes’, and how do you use them?
- How do you implement a custom merge strategy in Git?
- What is the Git ’replace’ command, and what are some use cases for it?
- How do you use ’git worktree’ to manage multiple working directories for a single Git repository?
- How do you use ’git bundle’ to share a repository without using a remote server?
- Can you describe Git’s internal mechanisms for handling file renames and moves?
- What are some best practices for managing large-scale Git repositories with multiple teams and projects?
Expert
- Can you discuss Git’s internal storage mechanism, including the role of loose objects and packfiles?
- How does Git’s content-addressable storage work, and how does it contribute to Git’s performance?
- How do you recover lost commits or branches in Git using the ’git reflog’ and ’git fsck’ commands?
- Can you explain Git’s three-way merge algorithm and its handling of merge conflicts?
- How do you design and implement a custom Git workflow tailored to a specific development team’s needs?
- How do you configure and manage access control in a Git repository, including using Gitolite or other access management tools?
- What are some strategies for maintaining a healthy Git repository, including periodic maintenance tasks and performance optimizations?
- How do you use ’git bisect run’ to automate the process of finding a commit that introduced a bug?
- Can you discuss some advanced techniques for dealing with large binary files in a Git repository?
- How do you use ’git rerere’ to handle repeated merge conflicts in long-lived branches?
- How do you perform advanced Git history rewriting, such as reordering commits, changing commit messages, or modifying the authorship of a commit?
- How do you deal with Git submodules when merging, rebasing, or bisecting?
- What are the security implications of Git’s SHA-1 hashing algorithm, and how does the transition to SHA-256 affect Git workflows?
- How do you set up and manage a Git server, such as GitLab or GitHub Enterprise, to meet the needs of a large organization?
- What are some advanced techniques for managing Git hooks, including sharing hooks across a team or organization?
- Can you explain the concept of "grafts" in Git and provide some use cases for them?
- How do you implement continuous integration and deployment workflows using Git?
- What are some strategies for using Git with other version control systems, such as SVN or Mercurial, in a mixed environment?
- How do you use ’git subtree’ to manage large projects with multiple components and their dependencies?
- Can you discuss the limitations of Git’s distributed model and propose solutions for dealing with issues like repository size, performance, and collaboration in large teams?
Guru
- How do you handle repositories with extremely large files, and what are the performance implications of such repositories in Git?
- Can you discuss the trade-offs between using a monorepo versus a multi-repo setup in a large organization?
- What are some advanced Git branching models and best practices for managing complex projects with multiple releases and parallel development?
- How do you set up and manage Git LFS (Large File Storage) at scale for a large organization?
- How do you design and enforce policies for commit signing and verification in a large organization?
- Can you discuss the internals of Git’s transfer protocols (smart HTTP, SSH, Git protocol), and their performance implications?
- What are the security concerns and best practices for managing access to a large-scale Git-based infrastructure?
- How do you handle and recover from Git repository corruption, and what are the common causes of corruption?
- Can you discuss techniques for optimizing Git performance, such as reducing repository size, improving network efficiency, and speeding up common operations?
- How do you set up and manage Git mirroring and replication for high availability and improved performance in a distributed environment?
- How do you create and manage custom Git commands and extensions to address unique requirements within an organization?
- Can you discuss techniques for advanced conflict resolution in Git, including resolving complex merge conflicts in large-scale projects?
- How do you implement and enforce code review policies and practices using Git and Git-based platforms like GitHub, GitLab, or Bitbucket?
- How do you integrate Git with other development tools and platforms, such as continuous integration systems, project management tools, and code review tools?
- How do you manage and enforce branch protection policies in a Git repository to ensure code quality and prevent unintended changes?
- Can you discuss strategies for managing Git’s configuration settings at the user, repository, and organization levels to enforce best practices?
- How do you manage and recover from issues with Git submodules or subtrees in a large-scale project?
- How do you troubleshoot and resolve performance issues with Git operations, such as slow clone, fetch, or push operations?
- How do you handle and mitigate security vulnerabilities in Git itself and Git-based platforms like GitHub, GitLab, or Bitbucket?
- What are the challenges and best practices for managing Git repositories in a geographically distributed team or organization?
📕 Buy this interview preparation book: 100 Git questions & answers — PDF + EPUB for $5
Reading is step one. Saying it out loud is the interview.
Our AI interviewer calls your phone and runs a realistic Git interview — then scores it.
📞 Practice Git — free 15 min