Implement Merge conflict resolution
Implement Merge Conflict resolution
Since the automate tech docs fork have been experiencing quite a high number of merge conflicts, we're no implementing automation merge conflict resolution to reduce manual intervention at every conflicts. Here's what's been implemented:
Automatic Conflict Detection
After a merge fails, the script now checks if there are conflicting files using git diff --name-only --diff-filter=U
Conflict Logging
When conflicts are detected, the script logs the following:
- Project name
- Source and destination branches
- Complete list of conflicted files
- Line numbers of the conflicts
Strategy=theirs resolution
If conflicts are found, the script:
- Aborts the failed merge
- Retries with
--strategy-option theirs(accepts all incoming changes from source)
Status Tracking
The script tracks whether the merge succeeded normally or required conflict resolution, and reports this in the final success message
Better Error Handling
Distinguishes between:
- Merge conflicts (which are now auto-resolved)
- Other merge failures (which still exit with error)
- Push failures (which still retry)
References: Implement automatic merge conflict resolution i... (#6 - closed) • Rasam Hossain
Testing
Validate: You can use pipeline validator to validate the pipeline syntax.
Test: To perform a test run,
- Go to pipeline schedules,
- Create a new pipeline schedule,
- In the Select Branch or Tag, select this branch "rasamhossain/merge-conflict-resolution"
- Uncheck it from being "Activated",
- Then manually run it once to verify if it's running as expected.
Is the merge conflict resolution working? This will be a little hard to test as until there's a merge conflict, we may not be able to test it. Since the changes need to be on upstream for a merge conflict, it's probably best to test live while a merge conflict occurs.