1. What is Git?
Git is a distributed version control system used to track code changes and collaborate with teams.
2. What is version control?
Version control manages changes to files over time and allows rollback to previous versions.
3. Difference between Git and GitHub?
Git is a tool; GitHub is a cloud platform that hosts Git repositories.
4. What is a repository in Git?
A repository is a storage area for project files and their version history.
5. What is a commit?
A commit is a snapshot of changes saved in the Git history.
6. What is a branch?
A branch is an independent line of development in a repository.
7. What is the default branch in Git?
Traditionally master, now commonly main.
8. What is HEAD in Git?
HEAD points to the current branch or commit you are working on.
9. What is Git clone?git clone creates a local copy of a remote repository.
10. What is Git status?
Shows the current state of files in the working directory.
11. What is Git add?
Adds changes to the staging area before committing.
12. What is the staging area?
It is an intermediate area where changes are prepared for commit.
13. What is Git commit?
Saves staged changes with a message in the repository history.
14. What is Git push?
Uploads local commits to a remote repository.
15. What is Git pull?
Fetches and merges changes from a remote repository.
16. Difference between git pull and git fetch?
Pull fetches and merges; fetch only downloads changes.
17. What is a merge in Git?
Merge combines changes from one branch into another.
18. What is a merge conflict?
Occurs when Git cannot automatically combine changes.
19. What is Git rebase?
Rebase reapplies commits on top of another branch.
20. Difference between merge and rebase?
Merge preserves history; rebase rewrites commit history.
21. What is Git stash?
Temporarily saves uncommitted changes.
22. What is Git reset?
Moves HEAD and optionally changes staging or working files.
23. What is Git revert?
Creates a new commit that undoes a previous commit.
24. What is .gitignore?
Specifies files Git should not track.
25. What is a remote repository?
A repository hosted on a server like GitHub or GitLab.
26. What is origin in Git?
Default name for the remote repository.
27. What is Git log?
Displays commit history of the repository.
28. What is Git diff?
Shows differences between files or commits.
29. What is a fast-forward merge?
A merge without creating a new commit when no divergence exists.
30. What is detached HEAD?
HEAD points directly to a commit instead of a branch.
31. What is Git fork?
A copy of a repository under a different user account.
32. What is Git tag?
A reference to mark specific commits, usually for releases.
33. What is Git cherry-pick?
Applies a specific commit from another branch.
34. What is Git blame?
Shows who last modified each line of a file.
35. What is Git checkout?
Switches branches or restores files.
36. What is Git branch command?
Used to create, list, or delete branches.
37. What is Git clean?
Removes untracked files from the working directory.
38. What is Git fetch used for?
Downloads changes from remote without merging.
39. What is Git hook?
Scripts that run automatically on Git events.
40. What is Git workflow?
A set of rules defining how teams use Git.
41. What is GitHub?
A platform for hosting and collaborating on Git repositories.
42. What is a pull request?
A request to merge changes into another branch.
43. What is code review in Git?
Reviewing code changes before merging.
44. What is Git squash?
Combines multiple commits into one.
45. What is Git conflict resolution?
Manually fixing conflicting changes in files.
46. What does git init do?
Initializes a new Git repository.
47. What is Git upstream?
A remote branch that your local branch tracks.
48. What is Git bare repository?
A repository without a working directory.
49. What is Git versioning used for?
Tracking changes and managing releases.
50. Why is Git important for DevOps?
It enables collaboration, automation, and CI/CD workflows.
Conclusion.
Git is one of the most important tools every fresher must understand before entering the software or DevOps industry. These Git interview questions cover the core concepts that interviewers commonly expect, from basic commands to collaboration workflows.
Practicing these questions regularly will help you build confidence, answer clearly in interviews, and work effectively in real-world projects. Keep using Git hands-on, explore advanced features gradually, and you’ll be well prepared for your first technical interview.
- This tutorial is your first step. Our complete DevOps course takes you all the way.



