DEV Community

Bidut Sharkar Shemanto
Bidut Sharkar Shemanto

Posted on • Updated on

Git And Github Interview Questions (& Answer) For Beginners

Question-1: What is Git? What are the advantages of using Git?

Answer:
Git is a distributed version control system used to track changes in source code during software development. It allows multiple developers to work on a project simultaneously. Advantages include version tracking, branching and merging capabilities, collaboration facilitation, and offline work support.

Question-2: What do you understand by the term "Version Control System"?

Answer:
A Version Control System (VCS) is software that helps manage changes to documents, computer programs, large websites, and other collections of information. It allows multiple users to collaborate, track history, revert to previous versions, and manage branches of projects.

Question-3: What is the difference between Git and GitHub?

Answer:
Git is a version control system used for tracking changes in files, while GitHub is a web-based platform that uses Git for version control and provides a collaborative environment for hosting Git repositories, project management, and other features.

Question-4: Name a few Git commands with their functions.

Answer:

  • git init: Initializes a new Git repository.
  • git clone: Clones an existing repository.
  • git add: Adds changes to the staging area.
  • git commit: Records changes to the repository.
  • git push: Uploads local repository content to a remote repository.
  • git pull: Fetches and merges changes from a remote repository to the local repository.
  • git status: Shows the status of changes in the working directory and staging area.
  • git branch: Lists, creates, or deletes branches.

Question-5: What is the difference between git fetch and git pull?

Answer:
git fetch downloads changes from a remote repository but does not merge them into the local repository. It updates the remote tracking branches. git pull fetches changes from a remote repository and immediately merges them into the local branch.

Top comments (0)