Git Interview Questions

Last Updated: Nov 10, 2023

Table Of Contents

Git Interview Questions For Freshers

What are the advantages of using Git?

Summary:

Detailed Answer:

How do you initialize a Git repository?

Summary:

Detailed Answer:

What is the purpose of a .gitignore file?

Summary:

Detailed Answer:

Explain the concept of branching in Git.

Summary:

Detailed Answer:

How do you create a new branch in Git?

Summary:

Detailed Answer:

What is the command to check the status of your Git repository?

Summary:

Detailed Answer:

How do you stage changes in Git?

Summary:

Detailed Answer:

What is a commit message in Git?

Summary:

Detailed Answer:

What is the difference between 'git pull' and 'git fetch'?

Summary:

Detailed Answer:

What is a merge conflict in Git?

Summary:

Detailed Answer:

How do you resolve a merge conflict in Git?

Summary:

Detailed Answer:

What is Git?

Summary:

Detailed Answer:

Git Intermediate Interview Questions

Explain the differences between git reset and git revert.

Summary:

Detailed Answer:

What is the purpose of 'git log' command?

Summary:

Detailed Answer:

What is the purpose of 'git tag' command?

Summary:

Detailed Answer:

What is a remote in Git?

Summary:

Detailed Answer:

How do you push changes to a remote repository?

Summary:

Detailed Answer:

What is the purpose of 'git stash' command?

Summary:

Detailed Answer:

How do you remove a file from a Git repository?

Summary:

Detailed Answer:

Explain the difference between 'git rebase' and 'git merge'.

Summary:

Detailed Answer:

What is the purpose of 'git cherry-pick' command?

Summary:

Detailed Answer:

What is the purpose of 'git blame' command?

Summary:

Detailed Answer:

How do you list all the branches in a Git repository?

Summary:

Detailed Answer:

What is a bare repository in Git?

Summary:

Detailed Answer:

Git Interview Questions For Experienced

Explain the purpose of the 'git rebase' --onto option.

Summary:

Detailed Answer:

What is the purpose of 'git submodule' command?

Summary:

Detailed Answer:

What is rebasing in Git and when should it be used?

Summary:

Detailed Answer:

How do you create an alias for a Git command?

Summary:

Detailed Answer:

Explain the concept of 'git rebase' interactive mode.

Summary:

Detailed Answer:

What is the purpose of 'git reflog' command?

Summary:

Detailed Answer:

How do you set up a Git server?

Summary:

Detailed Answer:

What is the purpose of 'git cherry' command?

Summary:

Detailed Answer:

Explain the difference between 'git pull' and 'git rebase'.

Summary:

Detailed Answer:

How do you recover a deleted branch in Git?

Summary:

Detailed Answer:

What is the difference between 'git stash pop' and 'git stash apply'?

Summary:

Detailed Answer:

What is the purpose of 'git worktree' command?

Summary:

Detailed Answer:

How do you configure a global Git username and email?

Summary:

Detailed Answer:

How do you squash multiple commits into a single commit in Git?

Summary:

Detailed Answer:

What is the purpose of 'git filter-branch' command?

Summary:

Detailed Answer:

How do you sign off a commit in Git?

Summary:

Detailed Answer:

Explain the difference between 'git revert' and 'git reset --hard'.

Summary:

Detailed Answer:

What is the purpose of 'git merge --no-ff' command?

Summary:

Detailed Answer:

How do you set up Git hooks?

Summary:

Detailed Answer:

Explain the purpose of 'git log --graph' command.

Summary:

Detailed Answer:

What is the purpose of 'git blame -L' command?

Summary:

Detailed Answer:

How do you delete a remote branch in Git?

Summary:

Detailed Answer:

What is the purpose of 'git stash branch' command?

Summary:

Detailed Answer:

Explain the concept of 'git rebase' onto a remote branch.

Summary:

Detailed Answer:

How do you revert a specific file to a previous commit in Git?

Summary:

Detailed Answer:

What is the purpose of 'git format-patch' command?

Summary:

Detailed Answer:

Explain the Git workflow using branches and pull requests.

Summary:

Detailed Answer:

What is the purpose of 'git bisect' command?

Summary:

Detailed Answer: