Merge Conflict Resolver
Automate the resolution of Git merge conflicts by iteratively detecting conflicts, resolving them, and retrying the merge until successful.
Goal
Automatically resolve merge conflicts in a Git repository by iteratively fixing conflicted files and re-attempting the merge until completion.
How to Run
Initiate the loop to automatically resolve Git merge conflicts through iterative detection and resolution.
- 01
Start Merge Conflict Loop
Run the kickoff prompt to begin detecting and resolving conflicts in the repository.
- 02
Iterate Until Merge Success
The loop will automatically check for merge conflicts, resolve them, and retry the merge command up to 10 times.
Workflow Steps
- 01
Detect merge conflicts using 'git status' or 'git diff --check'
Check if there are unresolved conflicts in the working directory.
- 02
For each conflicted file, analyze the conflict markers and resolve the differences.
Verify that conflict markers (<<<<<<<, =======, >>>>>>>) are removed and the code is syntactically valid.
- 03
Stage the resolved files using 'git add <file>'
Confirm the file is staged and marked as resolved in Git.
- 04
Run 'git merge' to attempt to complete the merge process.
Check if the merge command exits successfully and without remaining conflicts.
- 05
If merge fails and iterations remain, repeat the workflow from step 1.
Evaluate whether the exit condition has been met (merge succeeded).
Kickoff Prompt
Start the "Merge Conflict Resolver" loop. Goal: Automatically resolve merge conflicts in a Git repository by iteratively fixing conflicted files and re-attempting the merge until completion. Max iterations: 10 Between iterations run: git merge Exit when: Merge completes successfully without conflicts You are in a Git repository where a merge operation has encountered conflicts. Your task is to automatically detect and resolve these conflicts. Begin by running 'git status' to identify conflicted files. For each file with conflicts, carefully analyze the conflict markers and determine the correct merged code. After resolving, stage the files with 'git add', then retry the merge with 'git merge'. If the merge still reports conflicts, repeat the process until it succeeds or until you reach 10 iterations. Do not modify unrelated files or make changes outside the conflict resolution scope. Self-pace this loop. After each iteration, run `git merge` and evaluate the output, and only continue if the exit condition is not met (Merge completes successfully without conflicts). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Do not modify files outside the scope of the merge conflict resolution.
- ·Ensure that resolved conflicts do not break the integrity of the codebase.
- ·Limit iterations to prevent infinite loops in persistent conflict scenarios.
- ·Verify the merge result after each resolution to confirm progress.
Flow Diagram
Related loops — Git
Git
Conventional Commit Enforcer
This loop ensures all Git commits follow the Conventional Commits specification by using commitlint to validate commit messages. It automatically detects non-compliant commits, suggests fixes, and guides the user through correcting them until all commits pass validation.
Git
Large Commit Splitter
Automatically splits large, monolithic Git commits into smaller, more reviewable units while preserving logical code boundaries and maintaining clean history.
Git
Git Hygiene Loop
This loop helps maintain a clean Git repository by identifying and removing stale or outdated branches that are no longer needed. It ensures your branch list remains manageable and reduces clutter in collaborative environments.