The inspect-conflict.sh script compares a single file on two branches to find out which branch introduced a specific code changes. This documentation explains, how the log inside the script evolved and what it does.
- Resolve one file at a time
- First, apply the upstream version
- Unstage all changes of that file
- RESOLVE: Review each change one-by-one and either stage or discard
Reason for accepting the upstream version:
This step turns the 3-way-merge into a more digestible 2-way changeset
When code exists in the working branch but not in upstream, we need to find out what happened:
- A) It was removed from upstream → discard it
- B) it was added in the working branch → keep it
But how to find out which strategy is the correct one?
1. Check Upstream History
git log main -S"method_name" -- path/to/file- Shows commits → Go to step 3
- No results → Likely option B, verify with step 2
2. Check Feature Branch History
git log feature-branch -S"method_name" -- path/to/file- Shows commit → Option B (keep it)
- No results → Check merge base
3. Verify Current State
# Confirm presence in each branch
git show main:path/to/file | grep -A5 "method_name"
git show feture-branch:path/to/file | grep -A5 "method_name"4. Inspect Addition Context (if keeping)
# See why it was added
git show $(git log feature-branch -S"method_name" --format=%H -1)
# Find usage
git grep "method_name" feature-branch# Check upstream (no results = not in upstream)
git log develop -S"api.subscription_mode" -- modules/ppcp-api-client/services.php
# Control: verify search works
git log develop -S"api.helpers.paymentLevelHelper" -- modules/ppcp-api-client/services.php
# Returns 1 commit ✓
# Check current branch (found it)
git log remove-legacy-ui -S"api.subscription_mode" -- modules/ppcp-api-client/services.php
# Returns 1 commit → Option B: Keep the serviceResult: Service added in current branch, keep it in merge resolution.