How do you pull changes from a remote repository and merge them into your local branch?

How do you pull changes from a remote repository and merge them into your local branch?

a) git fetch
b) git pull
c) git merge
d) git checkout

Answer:

b) git pull

Explanation:

The git pull command is used to fetch changes from a remote repository and automatically merge them into your local branch. It combines the functionality of git fetch and git merge in a single step.

For example, git pull origin main will pull the latest changes from the main branch of the origin remote repository and merge them into your local branch.

Using git pull ensures that your local branch stays up-to-date with the remote repository, especially when working collaboratively on shared projects.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top