問題文
A developer needs to undo a change that has already been pushed to a branch that colleagues have pulled. Which approach keeps the shared history intact?
選択肢
- Delete the branch and recreate it from an earlier point, so that the unwanted commit is gone and colleagues pull the corrected line.
- Record a new commit that reverses the effect of the earlier one, leaving the existing commits in place.
- Edit the earlier commit's message to note the mistake, so that anyone reading the history learns that the change was withdrawn.
- Move the branch pointer back to the commit before the mistake and push the result, because the shared branch then matches the state everyone wants and colleagues can simply pull again to pick up the corrected history.