After a failed merge attempt, a developer needs to undo the merge to maintain project stability while resolving conflicts. What Git feature or command should they use?

  • git reset --hard HEAD
  • git revert HEAD
  • git checkout -b new-branch
  • git clean -df
The git reset --hard HEAD command is used to undo the last commit and return the repository to the state of the last successful merge. This allows the developer to start fresh and reattempt the merge while resolving conflicts. Other options like git revert and git clean have different purposes and do not address the need to undo the merge.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *