Git Merge Conflict Resolution Quiz: Are You Ready to Resolve? Quiz

  1. Understanding Merge Conflicts

    What typically causes a merge conflict in Git?

    1. When two branches have identical changes.
    2. When two branches have committed changes to the same file, and Git cannot automatically determine which changes to incorporate.
    3. When a branch is deleted remotely.
    4. When a new branch is created.
    5. When Git encounters network connectivity issues.
  2. Identifying Conflict Markers

    Which of the following sequences denotes the beginning of a merge conflict marker in a file?

    1. u003Eu003Eu003Eu003Eu003Eu003Eu003E branch_name
    2. =======
    3. u003Cu003Cu003Cu003Cu003Cu003Cu003C HEAD
    4. +++++++ branch_name
    5. ######
  3. Resolving Conflicts Manually

    After manually resolving a merge conflict in a file, what Git command should you use to stage the changes?

    1. git commit
    2. git merge --continue
    3. git add u003Cfilenameu003E
    4. git resolve u003Cfilenameu003E
    5. git push
  4. Using a Merge Tool

    What is the purpose of a merge tool like `meld` or `kdiff3`?

    1. To automatically resolve all merge conflicts.
    2. To visually compare and merge conflicting files, making resolution easier.
    3. To create a backup of your repository.
    4. To delete the conflicting branch.
    5. To display a list of commit hashes.
  5. Abort a Merge

    What git command allows you to abort a merge in progress and return to the state before the merge attempt?

    1. git reset --hard HEAD
    2. git checkout --abort
    3. git merge --abort
    4. git revert
    5. git clean -fd
  6. Conflict Markers Explanation

    Within a merge conflict, what does the section between `======` and `u003Eu003Eu003Eu003Eu003Eu003Eu003E branch_name` typically represent?

    1. The changes from the current branch (HEAD).
    2. The common ancestor version of the file.
    3. The changes from the branch being merged in.
    4. Instructions for resolving the conflict.
    5. The list of conflicting files.
  7. Scenario: Conflicting Modifications

    Two developers modify the same line in the same file on different branches. How will Git handle this during a merge?

    1. Git will automatically accept the changes from the first branch merged.
    2. Git will automatically accept the changes from the last branch merged.
    3. Git will create a merge conflict, requiring manual resolution.
    4. Git will randomly choose one of the changes.
    5. Git will ignore both changes.
  8. Preventing Merge Conflicts

    What is a good strategy for minimizing the occurrence of merge conflicts?

    1. Always commit directly to the main branch.
    2. Deleting remote branches frequently.
    3. Pulling and integrating changes from the remote repository frequently.
    4. Working on very large features in single commits.
    5. Ignoring merge conflicts and pushing anyway.
  9. Merge Conflict Status

    After a merge conflict occurs, which Git command shows the files that need to be resolved?

    1. git status
    2. git log
    3. git diff
    4. git blame
    5. git show
  10. Resolve Conflicts by Choosing One Branch

    You determine that all the changes from your feature branch are incorrect. What is the easiest way to keep only the changes from the 'main' branch and discard the feature branch changes, but still complete the merge?

    1. Manually edit the conflicted files to match the 'main' branch, stage, and commit.
    2. Use 'git checkout --ours u003Cfileu003E' for each conflicted file, stage, and commit.
    3. Use 'git checkout --theirs u003Cfileu003E' for each conflicted file, stage, and commit.
    4. Run 'git reset --hard' to the main branch and start the feature again
    5. Delete all the conflicted files and run 'git clean'.