What is a branch in Git?

What is a branch in Git?

a) A pointer to a specific commit
b) A remote repository
c) A bug fix
d) A tag

Answer:

a) A pointer to a specific commit

Explanation:

A branch in Git is a pointer to a specific commit in the repository. It allows developers to work on different features, bug fixes, or experiments independently without affecting the main project.

For example, when you create a new branch with git branch new-feature, it starts from the current commit. Any changes you make on this branch will not affect the main branch until they are merged.

Branches provide a flexible way to manage multiple streams of work in parallel, making Git a powerful tool for collaborative development.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top