When to Use the Accept Both Strategy
Learn when concatenating both sides of a conflict is the correct resolution. Common for import statements, list additions, and configuration entries.
Detailed Explanation
The Accept Both Strategy
"Accept Both" concatenates both versions in order — your branch's content first, then the incoming branch's content. This is the ideal resolution when both branches added new, non-overlapping content to the same location in a file.
When Accept Both Works Well
New list entries: When both branches add items to the same list:
<<<<<<< HEAD
"lodash": "^4.17.21",
"luxon": "^3.4.0",
=======
"lodash": "^4.17.21",
"moment": "^2.30.0",
>>>>>>> feature/add-dates
Accept Both gives you all three packages.
Import statements: When both branches import different modules, concatenating them is usually correct.
Configuration entries: Adding new routes, menu items, or feature flags from both branches.
CSS rules: When both branches add different CSS classes or selectors that do not overlap.
When Accept Both Is Dangerous
Duplicate declarations: If both sides include overlapping content, Accept Both creates duplicates that may cause errors.
Order-dependent code: If the order of statements matters (e.g., middleware registration, CSS specificity), blindly concatenating may produce incorrect behavior.
Conflicting logic: If both branches modify the same variable or return statement, concatenating produces code with two assignments to the same variable.
Post-Resolution Cleanup
After using Accept Both, always:
- Remove any duplicate lines that appear in both versions.
- Fix any syntax issues (trailing commas, missing semicolons).
- Verify that the concatenated result makes logical sense.
- Run your linter and tests.
Order Considerations
Accept Both places "ours" first and "theirs" second. If you need the incoming branch's content first, use Manual Edit to reverse the order. For alphabetically sorted lists, you may also need to re-sort after concatenation.
Use Case
Two developers added different API route handlers to the same router file. Each handler is independent, so accepting both additions and keeping all the new routes is the correct approach.