350-901 practice question 3 of 35

A developer is working on an enhancement for an application feature and has made changes to a branch called ‘devcor-432436127a-enhance4‘. When merging the branch to production, conflicts occurred. Which Git command must the developer use to recreate the pre-merge state?

Full set: 430 questions

Domain Infrastructure and Automation

Answer options
A: git merge -no-edit
B: git merge -abort Correct answer
C: git merge -revert
D: git merge —comrmt
Correct Answer:
B. git merge -abort
Explanation

When a git merge operation results in conflicts, Git pauses the process, leaving the repository in a special "merging" state. The developer must manually resolve the conflicts before committing. If the developer decides to abandon the merge attempt entirely, the git merge --abort command is used. This command aborts the conflict resolution process and restores the repository and working directory to the state they were in just before the merge was initiated.

Why Incorrect

A. git merge -no-edit is incorrect because it is used to accept the auto-generated merge commit message without opening an editor. It does not abort a merge with conflicts.
C. git merge -revert is incorrect because -revert is not a valid option for the git merge command. git revert is a separate command used to undo a previously committed merge.
D. git merge --commit is incorrect because this is the default behavior to finalize a successful merge by creating a merge commit. It cannot be used when conflicts are present.

References

1. Official Git Documentation: The git-merge command documentation explicitly states the function of the --abort option.

Source: git-scm.com

Official Git Documentation

Reference: git-merge Documentation

OPTIONS section. " --abort Abort the current conflict resolution process

and try to reconstruct the pre-merge state."

Link: https://git-scm.com/docs/git-merge#options

2. MIT Courseware: University course materials on version control confirm this usage for handling merge conflicts.

Source: MIT Missing Semester of Your CS Education

Reference: Version Control (Git) Lecture Notes. "If at any point you want to give up and get back to the state before you started the merge

you can do that with git merge --abort."

Link: https://missing.csail.mit.edu/2020/version-control/ (Under the "Merge Conflicts" section).

Scroll to Top