Study for the Architect Journey – Development Lifecycle and Deployment Exam. Prepare with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

Which Git command undoes changes that have already been merged?

Undoing changes that have already been merged requires a method that preserves history rather than rewriting it. Git revert fits this need because it creates a new commit that negates the effects of a previous commit. This keeps the project’s history intact while effectively “undoing” the change in the codebase. If you’re reverting a merge commit, you can specify which parent to keep with the -m option, telling Git how to apply the reversal. Why not other options? Reset changes the branch tip and can discard commits, which rewrites history and can disrupt shared branches—dangerous on a team project. Commit --amend only alters the most recent commit and doesn’t address changes already merged. Rebase rewrites history by replaying commits, also risky for published branches and requires coordination with others.

Undoing changes that have already been merged requires a method that preserves history rather than rewriting it. Git revert fits this need because it creates a new commit that negates the effects of a previous commit. This keeps the project’s history intact while effectively “undoing” the change in the codebase. If you’re reverting a merge commit, you can specify which parent to keep with the -m option, telling Git how to apply the reversal.

Why not other options? Reset changes the branch tip and can discard commits, which rewrites history and can disrupt shared branches—dangerous on a team project. Commit --amend only alters the most recent commit and doesn’t address changes already merged. Rebase rewrites history by replaying commits, also risky for published branches and requires coordination with others.