merge_conflict_handling — Claude Code prompt: what it does
merge_conflict_handling is a Claude Code prompt that forces branch synchronisation before editing code. It prevents agents from overwriting pushed remote changes.
MIT ★ 341 updated 2026-11-17
.claude/commands/merge_conflict_handling.mdWhat merge_conflict_handling does
The prompt enforces a strict pre-edit sequence across all involved repositories. It starts with git fetch origin to inspect differences between the local branch and upstream.
When the remote simply advanced, it applies a fast-forward. If both branches contain distinct commits, it integrates them through merge or rebase without dropping changes. After deliberately resolving conflicts to preserve both intents, the agent must run builds and tests before applying edits.
What it helps with
- fetch and compare local branch against upstream before editing
- integrate diverging commits without discarding work
- verify build and tests before writing new changes
Example prompts for the agent
- Sync this repository before making any edits
- Resolve pending upstream conflicts following merge_conflict_handling
How to install merge_conflict_handling
Manually: put the files in place
.claude/commands/merge_conflict_handling.mdHow to use
Paste the text at the start of a chat or into project instructions
Questions about merge_conflict_handling
How to install merge_conflict_handling in Claude Code?
Place the prompt content into .claude/commands/merge_conflict_handling.md in your project folder.
What does merge_conflict_handling do?
It directs the agent to fetch upstream, integrate divergent histories, resolve conflicts cleanly, and verify tests before editing.
What is required to run merge_conflict_handling?
A local Git checkout connected to an origin remote.
Source text
merge_conflict_handling.md · MIT
# Pulling and resolving conflicts before you work Before editing for an item, sync each repository you will touch so you build on the latest branch state and never clobber pushed work: 1. **Fetch.** `git fetch origin` and compare your branch to its upstream tip. 2. **Fast-forward** when the branch only advanced on the remote; **integrate** (merge/rebase onto the latest tip) when local and remote both have commits — never discard either side. 3. **Resolve conflicts deliberately**, preserving both the intent already on the branch and the new request; never drop committed work to clear a conflict. 4. **Re-validate** — re-run the relevant build / tests so you start green. Do this first; only then edit, commit, and push.
© rudderlabs · MIT · rudderlabs/devbox