Interview Questions & Answer for Git

How do you know if a certain directory is a git repository?

How to check if a file is tracked and if not, then track it?

What is the difference between git pull and git fetch?

Explain the following: git directory, working directory and staging area

How to resolve git merge conflicts?

What is the difference between git reset and git revert?

You would like to move forth commit to the top. How would you achieve that?

In what situations are you using git rebase?

What merge strategies are you familiar with?

How can you see which changes have done before committing them?

How do you revert a specific file to previous commit?

How to squash last two commits?

What is the .git directory? What can you find there?

What are some Git anti-patterns? Things that you shouldn’t do

How do you remove a remote branch?

Are you familiar with gitattributes? When would you use it?

How do you discard local file changes? (before commit)

How do you discard local commits?

True or False? To remove a file from git but not from the filesystem, one should use git rm

Explain Git octopus merge

Rajesh Kumar
Follow me