HomeDevopsGit interview questions

Git interview questions

Basic Git Questions:

  1. What is Git?
    • Explain the purpose of version control and Git’s role in it.
  2. What is the difference between Git and GitHub?
    • How is Git different from GitHub or other hosting platforms like GitLab, Bitbucket, etc.?
  3. What are the main features of Git?
    • Mention features like branching, version control, distributed nature, and more.
  4. Explain the Git workflow.
    • Working directory, staging area, and local repository.
  5. What are the basic Git commands?
    • Commands like git init, git add, git commit, git push, and git pull.
  6. What is a Git repository?
    • Differentiate between local and remote repositories.
  7. What is the staging area in Git?
    • Describe how git add works and its role in version control.
  8. What is the difference between git clone and git fork?
    • Explain how cloning duplicates the repository while forking copies it into your own GitHub account.
  9. How do you create a new branch in Git?
    • Explain git branch <branch_name> and git checkout -b <branch_name>.
  10. What is git merge?
    • How does it merge branches, and what is a “fast-forward” merge?

Advanced Git Questions:

  1. What is git rebase, and how does it differ from git merge?
    • Explain both, and discuss scenarios where rebasing is better suited.
  2. What is a git stash?
    • How can you use git stash to temporarily save changes without committing?
  3. What is the difference between git fetch and git pull?
    • Describe how git fetch only updates local metadata while git pull also integrates the changes.
  4. What are git cherry-pick and git revert?
    • How do you selectively apply or undo commits?
  5. What is a “detached HEAD” state in Git?
    • Discuss how this happens and how to resolve it.
  6. How can you undo the last commit?
    • Explain git reset –soft HEAD~1 and git revert.
  7. What is the purpose of .gitignore?
    • Explain how to use this file to prevent unwanted files from being committed.
  8. How do you resolve merge conflicts in Git?
    • Describe the process of conflict resolution and tools that can help (e.g., git mergetool).
  9. What is Git submodule?
    • Describe how you can include another repository inside your project and manage dependencies.
  10. What is git bisect, and how does it help in debugging?
    • Explain how git bisect is used to perform a binary search to identify the commit that introduced a bug.

GitHub-Specific Questions:

  1. How does GitHub handle collaboration?
    • Discuss pull requests, issues, and code reviews.
  2. What are GitHub Actions?
    • Explain CI/CD workflows within GitHub.
  3. What is a GitHub Fork, and when would you use it?
    • How does forking help when contributing to open-source projects?
  4. What is a Pull Request, and how is it different from pushing code?
    • Discuss how pull requests facilitate code reviews and collaboration in GitHub.
  5. What are tags in Git and GitHub?
    • Explain how tags are used for marking releases and important versions.
  6. What are GitHub repositories’ permissions?
    • Explain the difference between owner, collaborator, and other roles.
  7. How can you secure a GitHub repository?
    • Mention strategies like two-factor authentication, branch protection rules, and limiting write access.
  8. How do you squash commits in Git/GitHub?
    • Explain squashing commits into one using git rebase -i and why this might be useful.
  9. How do you link a local Git repository with a remote repository on GitHub?
    • Describe git remote add origin <repository_URL> and git push.
  10. What is the difference between public and private repositories in GitHub?
    • Discuss visibility and accessibility between the two.

These questions span across basic and advanced concepts, providing a solid foundation for Git and GitHub knowledge in an interview.

For Cloud and Devops placement call 9666019191

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In 2025, DevOps and cloud computing certifications are critical for professionals aiming to excel in the rapidly evolving tech landscape....
Introduction The modern DevOps landscape is evolving, with Site Reliability Engineering (SRE) gaining prominence as a core function in high-performing...
Below is a curated list of advanced-level interview questions tailored for Azure Virtual Desktop (AVD) engineers with 3 to 5...