What does the command git pull --rebase do?

What does the command git pull --rebase do?

a) Fetches and rebases changes from the remote branch
b) Fetches and creates a new branch
c) Deletes remote changes
d) Creates a new commit on the remote repository

Answer:

a) Fetches and rebases changes from the remote branch

Explanation:

The git pull --rebase command fetches changes from the remote repository and rebases them onto your local branch instead of merging them. This ensures a linear commit history by applying your local commits on top of the fetched changes.

This is useful when you want to avoid merge commits and keep the project history cleaner.

Rebasing during a pull avoids unnecessary merge conflicts and ensures that your local changes are reapplied after the latest remote updates.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top