Two Git Commands That Incorporate Remote Changes Without Merge Commits
Which TWO Git commands are commonly used to incorporate changes from a remote repository into your local branch while keeping history linear?
Quick Answer
git pull --rebase fetches remote changes and replays local commits on top of them instead of creating a merge commit, and git rebase directly rewrites a branch's base onto another — used together with git fetch, both commands incorporate remote changes while keeping history linear, avoiding the merge commits a plain git pull would create.
⚠ Common exam trap
Candidates often confuse `git fetch` (which only downloads data) with `git pull` (which integrates), or they assume `git merge` always creates a merge commit and forget that fast-forward merges can keep history linear, but the question explicitly asks for commands that keep history linear, and `git merge` does not guarantee that.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
git pull --rebase
`git pull --rebase` (A) is correct because it fetches changes from the remote and then replays your local commits on top of the fetched commits, resulting in a linear history without merge commits. `git rebase` (E) is correct because it directly rewrites commit history by moving or combining a sequence of commits onto a new base, which can be used to incorporate remote changes linearly when combined with `git fetch`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
git pull --rebase
Why this is correct
Fetches and rebases local commits on top of remote branch.
- ✗
git fetch
Why it's wrong here
Only downloads objects, does not integrate.
- ✗
git merge
Why it's wrong here
Creates a merge commit, history not linear.
- ✗
git cherry-pick
Why it's wrong here
Applies a single commit, not for full integration.
- ✓
git rebase
Why this is correct
Reapplies commits on top of another branch.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
Repository
A repository is a central storage location where software packages, code, or configuration files are kept, managed, and distributed for use by IT systems.
Key term
Branch
A branch is a pointer to a specific commit in a version control system that allows you to work on features or fixes in isolation from the main codebase.
About these practice questions
One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on AZ-400
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Which TWO Git operations are considered dangerous and should be used with caution because they rewrite history? (Select TWO.)
easy- A.git fetch
- ✓ B.git push --force
- C.git merge
- ✓ D.git rebase
- E.git revert
Why B: `git push --force` overwrites the remote branch history with the local branch, discarding any commits on the remote that are not in the local history. This can cause other collaborators to lose work if they have based changes on the overwritten commits, making it a history-rewriting operation that must be used with caution.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.