Skip to main content
US Army Corps of EngineersInstitute for Water Resources, Risk Management Center

Conflict Resolution

Preventing Conflicts

Best practices:

  1. Pull from main frequently (at least daily)
  2. Keep feature branches short-lived (< 1 week ideal)
  3. Communicate when working on shared files
  4. Break large features into smaller PRs

Resolving Merge Conflicts

When conflicts occur:

# Update the feature branch with main
git checkout main
git pull origin main
git checkout feature/your-feature
git merge main

# Git will mark conflicts in files
# Open conflicted files and resolve manually
# Look for conflict markers: <<<<<<<, =======, >>>>>>>

# After resolving all conflicts
git add .
git commit -m "merge: resolve conflicts with main"
git push origin feature/your-feature

Conflict resolution strategy:

  1. Understand both changes - what was each trying to do?
  2. Preserve both intentions when possible
  3. Test thoroughly after resolving
  4. Ask the other developer if uncertain
  5. Request re-review of PR after conflict resolution

Large Conflicts

If there are many conflicts:

  • Consider rebasing instead of merging (discuss with team first)
  • Pair with another developer to resolve together
  • May indicate feature branch was too long-lived