AZ-400 Practice Question: Design and implement a source control strategy
Which TWO Git operations are considered dangerous and should be used with caution because they rewrite history? (Select TWO.)
⚠ Common exam trap
Many candidates confuse `git revert` with `git reset` or think `git merge` rewrites history, but the key distinction is that only operations that change existing commit SHAs (like rebase and force push) are considered history-rewriting and dangerous.
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 push --force
`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.
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 fetch
Why it's wrong here
git fetch is safe because it only downloads new objects and updates remote-tracking branches without touching your local working tree, local branches, or commit history. It never rewrites or discards existing commits, so it cannot cause data loss or divergence with collaborators.
- ✓
git push --force
Why this is correct
git push --force is dangerous because it replaces the remote branch's ref, forcibly overwriting the remote history and potentially discarding commits that other team members have already based work on. This rewrites shared history and can permanently destroy others' changes; --force-with-lease provides a safer alternative by refusing to overwrite if the remote has moved.
- ✗
git merge
Why it's wrong here
git merge is safe because it integrates histories by creating a new merge commit that preserves the existing commit graph, branch topology, and all original commits. It does not rewrite or delete any existing commits, so it never destroys history, though it can introduce merge conflicts that must be resolved.
- ✓
git rebase
Why this is correct
git rebase is dangerous because it rewrites commit history by extracting commits from one branch and reapplying them onto a new base, producing new commit hashes and altering the original branch's timeline. If the branch has already been pushed or shared, this can cause significant divergence, confusion, and lost work for anyone who has pulled the old history.
- ✗
git revert
Why it's wrong here
git revert is safe because it creates a new commit that undoes the changes introduced by a specific commit, leaving the original commit and all other history completely intact. This non-destructive approach is the recommended way to undo changes on shared branches because it does not rewrite history or require a force push.
Go deeper
Related to this question
Learn chapter
Implementing Work Item Management and Agile Planning
Key term
Git
Git is a version control system that tracks changes to files so multiple people can work on the same project without overwriting each other's work.
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
Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.