Git Merge Conflict Resolution Prompt

Resolve Git merge conflicts safely by comparing both branches' intent, proposing per-file edits, preserving behavior, and verifying the result before commit.

Prompt Template

You are a senior software engineer helping me resolve a Git merge conflict without discarding either branch's intended behavior.

Repository context: [language, framework, application purpose]
Merge or rebase operation: [command run]
Current branch goal: [what this branch changes]
Incoming branch goal: [what the other branch changes]
Git status output: [paste output]
Conflicted files: [list]
Conflict blocks: [paste complete sections including <<<<<<<, =======, and >>>>>>>]
Relevant surrounding code: [paste enough context]
Recent commits from both sides: [summaries or git log output]
Tests and validation commands: [commands]
Generated or lock files involved: [list]
Constraints: [API compatibility, formatting, migrations, security, release deadline]

For each conflict:
1. Explain the intent of the current side and incoming side in plain language.
2. Identify whether the changes are independent, competing, or order-dependent.
3. Propose the smallest resolved version that preserves compatible intent.
4. Show the exact replacement block with no conflict markers.
5. Flag assumptions, missing context, semantic risks, and any file that should be regenerated instead of hand-edited.
6. List follow-up files that may need coordinated changes.

Then provide:
7. Safe Git commands to inspect, stage, continue, or abort the operation, tailored to whether this is a merge or rebase.
8. Formatting, type-check, test, and behavior checks.
9. A final diff-review checklist before committing.
10. A concise commit-message suggestion.

Do not recommend destructive reset, force push, or choosing an entire side blindly. If the intent cannot be determined from the supplied context, ask for the specific missing code or commit diff before proposing a resolution.

Example Output

Conflict Diagnosis

The current branch renames the configuration field from `url` to `baseUrl`. The incoming branch adds a `timeoutMs` field while still using `url`. These changes are compatible, but the new timeout must be added to the renamed shape and every caller must use `baseUrl`.

Proposed Replacement

export const apiConfig = {

baseUrl: process.env.API_BASE_URL ?? "/api",

timeoutMs: 8000,

};

Verification

1. Search for remaining `apiConfig.url` references.

2. Run formatting and the TypeScript check.

3. Run configuration and request-timeout tests.

4. Inspect `git diff --check` and `git diff --staged` before continuing.

Risk

The environment variable fallback was present on only one side; confirm that keeping it matches deployment behavior.

Tips for Best Results

  • ๐Ÿ’กPaste complete conflict blocks plus surrounding code; isolated marker lines rarely reveal both branches' intent.
  • ๐Ÿ’กInclude whether you are merging or rebasing because the safe continue and abort commands differ.
  • ๐Ÿ’กReview generated files and lockfiles separately; regenerating them is often safer than hand-merging.

Frequently Asked Questions

What is the Git Merge Conflict Resolution Prompt prompt?

Resolve Git merge conflicts safely by comparing both branches' intent, proposing per-file edits, preserving behavior, and verifying the result before commit. It's a free ChatGPT prompt template from our Coding collection โ€” copy it, fill in the bracketed variables, and paste it into your AI tool.

Which AI tools work with this prompt?

It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.

How do I customize this ChatGPT prompt?

Replace the bracketed variables โ€” such as [language, framework, application purpose], [command run], [what this branch changes] โ€” with your own details before running it. Paste complete conflict blocks plus surrounding code; isolated marker lines rarely reveal both branches' intent.

Is this prompt free to use?

Yes. Every prompt on PromptAtlas is free to copy, customize, and use โ€” no signup required.