Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/codex/prompts/fix_merge_conflicts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Fix Merge Conflicts

This PR has **merge conflicts** that must be resolved before CI can run or the PR can be merged.

## Your Task

Resolve all merge conflicts by integrating changes from the base branch with this PR's changes.

## Conflict Detection

{{#if conflict_files}}
**Potentially conflicting files:**
{{#each conflict_files}}
- `{{this}}`
{{/each}}
{{else}}
Check `git status` to identify files with conflicts.
{{/if}}

## Resolution Steps

1. **Fetch latest base branch:**
```bash
git fetch origin {{base_branch}}
```
> Note: Replace `{{base_branch}}` with the actual base branch name (e.g., `main` or `master`)

Copilot AI Jan 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template variable {{base_branch}} is used but may not be replaced in all contexts. On line 26, the note says "Replace {{base_branch}} with the actual base branch name" which suggests manual replacement is expected. However, this contradicts the templating syntax which typically expects automatic substitution. Clarify whether this is a Handlebars/Mustache template that will be processed, or if users should manually replace these placeholders.

Suggested change
> Note: Replace `{{base_branch}}` with the actual base branch name (e.g., `main` or `master`)
> Note: `{{base_branch}}` will be automatically set to the PR's base branch (e.g., `main` or `master`).

Copilot uses AI. Check for mistakes.

2. **Attempt merge:**
```bash
git merge origin/{{base_branch}}
```

3. **For each conflicting file:**
- Look for conflict markers: `<<<<<<<`, `=======`, `>>>>>>>`
- Understand what each side (HEAD vs incoming) intended
- Combine the changes intelligently:
- If changes are to different parts: keep both
- If changes conflict: prefer the newer/more complete version
- If changes are incompatible: adapt the PR's code to work with new base
- Remove all conflict markers

4. **Verify resolution:**
```bash
# Check no conflict markers remain
git diff --check

# Run the project's test suite (language-specific)
# For Python: pytest
# For JavaScript: npm test
# For other: check the project's README or CI config
```

5. **Commit the resolution:**
```bash
git add .
git commit -m "fix: resolve merge conflicts with {{base_branch}}"
```

## Resolution Guidelines

### When to prefer PR changes:
- PR adds new functionality not in main
- PR fixes a bug that main doesn't address
- PR has more complete implementation

### When to prefer main changes:
- Base branch has breaking API changes PR must adapt to
- Base branch has bug fixes PR should incorporate
- Base branch renamed/moved files PR still references

### When to combine:
- Both sides add different functions/methods
- Both sides add different imports
- Both sides modify different parts of the same function

## Common Conflict Patterns

### Import conflicts (Python example):
```python
<<<<<<< HEAD
from module import foo, bar
=======
from module import foo, baz
>>>>>>> origin/{{base_branch}}

Copilot AI Jan 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template placeholder {{base_branch}} appears in the code comment within the example conflict marker. If this template is processed by a templating engine, this will be replaced even within the example code block, which could confuse the example. Consider escaping the placeholder or using a literal example like "origin/main" instead to ensure the example remains clear and unmodified.

Suggested change
>>>>>>> origin/{{base_branch}}
>>>>>>> origin/main

Copilot uses AI. Check for mistakes.
```
**Resolution:** Combine imports: `from module import foo, bar, baz`

### Function modification conflicts:
Keep the more complete/correct version, or merge logic if both changes are needed.

### Test file conflicts:
Usually keep both sets of tests unless they're duplicates.

## Exit Criteria

- All conflict markers removed from all files
- Code compiles/parses without syntax errors
- Tests pass (at least the ones that were passing before)
- Changes committed with descriptive message

---

**Focus solely on resolving conflicts. Do not add new features or refactor code beyond what's needed for resolution.**
Loading
Loading