How do you fetch all remote branches without merging them into your local branches?

How do you fetch all remote branches without merging them into your local branches?

a) git fetch
b) git pull --no-merge
c) git fetch --merge
d) git clone --all

Answer:

a) git fetch

Explanation:

The git fetch command retrieves all remote branches, tags, and commits without merging them into your local branches. It updates your local repository with new information from the remote repository but doesn’t affect your working directory.

For example, running git fetch will download all changes from the remote, allowing you to review or merge them later.

This command is important for synchronizing your local repository with the remote without making any immediate changes to your local branches.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top