200-901 Question 32
Select 3You are collaborating with a team on a Git repository for a DevNet project. During a git pull operation, you encounter a merge conflict in the app.py file. What steps should you follow to resolve the conflict and complete the merge?
- A
Open the
app.pyfile and manually resolve the conflicts by editing the file to keep the desired changes. - B
Use the
git merge --abortcommand to discard the merge and start over. - C
After resolving the conflicts, use
git add app.pyto stage the resolved file. - D
Run
git committo complete the merge after staging the resolved conflicts. - E
Delete the
app.pyfile and pull the changes again to avoid the conflict.
Show answer and explanation
Correct answers: A, C, D
Explanation
When a merge conflict occurs, it must be resolved manually by editing the conflicting files and deciding which changes to keep. After resolving the conflicts, the resolved files must be staged with git add and then committed with git commit to complete the merge process. Using commands like git merge --abort or deleting files is not appropriate for resolving conflicts in most scenarios.
- A. Correct.
Correct. When you encounter a conflict, you must manually edit the file to resolve the conflicting changes.
- B. Incorrect.
Incorrect. While
git merge --abortcan undo the merge, it is not necessary if you intend to resolve the conflict and proceed with the merge. - C. Correct.
Correct. After resolving the conflicts, you must stage the resolved file using
git addbefore committing. - D. Correct.
Correct. Once the conflicts are resolved and staged,
git commitfinalizes the merge process. - E. Incorrect.
Incorrect. Deleting the file is not a recommended way to resolve a conflict, as it leads to data loss and does not address the root issue.