Skip to content

Conversation

Copy link

Copilot AI commented Jan 12, 2026

Short description of changes

Adds .gitattributes with merge=ours strategy to preserve customized autobuild.yml when merging from master into custom branches. Includes comprehensive documentation (MERGE_SOLUTION.md) with manual conflict resolution instructions for GitHub web interface and command line.

CHANGELOG: SKIP

Context: Fixes an issue?

Prevents merge conflicts on .github/workflows/autobuild.yml for users maintaining custom build branches with modified workflow configurations when merging updates from master.

Does this change need documentation? What needs to be documented and how?

No website documentation needed. MERGE_SOLUTION.md provides complete instructions for:

  • Manual conflict resolution on GitHub's web interface (editing conflict markers directly)
  • Manual conflict resolution via command line (using "Accept Current Change")
  • Automated setup using .gitattributes and git config for future merges

Status of this Pull Request

Working implementation for personal branch maintenance.

What is missing until this pull request can be merged?

Nothing. Ready to merge.

Implementation

The .gitattributes file marks autobuild.yml with merge=ours, which requires local git config:

git config --local merge.ours.driver "true"

Once both are in place, merges from master automatically preserve the custom branch's workflow version without conflicts.

Manual Conflict Resolution on GitHub Web Interface

When merging a PR from master to my-build on GitHub:

  1. Click "Resolve conflicts" button
  2. In the conflict editor, you'll see conflict markers
  3. Keep ONLY your custom autobuild.yml content (between <<<<<<< my-build and =======)
  4. Delete all conflict markers (<<<<<<<, =======, >>>>>>>) and the incoming content from master
  5. Click "Mark as resolved" then "Commit merge"

Result: Your custom autobuild.yml is preserved in my-build. The merge commit is created on the my-build branch (the target branch).

Manual Conflict Resolution via Command Line

  1. Ensure you're on your custom branch: git checkout my-build
  2. Merge from master: git merge master
  3. When conflict appears, choose "Accept Current Change" (or "Keep Ours" in some Git tools)

Result: Your custom autobuild.yml is preserved in your custom branch.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above
Original prompt

I don't want PRs from master targeting my my-build branch to have conflicts because of changes I made to the autobuild.yml file - I want to keep my version of this file. So I created a .gitattributes file with this content: # This prevents incoming PRs from overwriting customized workflow configurations
.github/workflows/autobuild.yml merge=ours
But I'm still getting conflicts. How to solve this?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update .gitattributes to prevent conflicts for autobuild.yml Add .gitattributes merge strategy for custom workflow files Jan 12, 2026
Copilot AI requested a review from ignotus666 January 12, 2026 15:54
@ignotus666
Copy link
Owner

@copilot I'd even prefer if you could just tell me what to choose between "Accept current change | Accept incoming change | Accept both changes" in order to manually resolve the conflicts and preserve my original file

Copy link
Author

Copilot AI commented Jan 12, 2026

@copilot I'd even prefer if you could just tell me what to choose between "Accept current change | Accept incoming change | Accept both changes" in order to manually resolve the conflicts and preserve...

Choose "Accept Current Change" (or "Keep Ours" in some Git tools). This keeps your my-build version and discards the incoming changes from master.

Updated in commit dae352a.

@ignotus666
Copy link
Owner

@copilot When I click on "Accept Current Change" it says it'll commit changes to master - that's not what I want

Copy link
Author

Copilot AI commented Jan 12, 2026

@copilot When I click on "Accept Current Change" it says it'll commit changes to master - that's not what I want

That's actually correct! When you're on my-build and merge from master, the changes commit to your my-build branch (where you are), not to master.

Make sure you're ON the my-build branch first:

git checkout my-build
git merge master

Then "Accept Current Change" keeps your my-build version, and the merge commits to my-build. This is what you want.

Clarified in commit 9d36d61.

@ignotus666
Copy link
Owner

@copilot I'm doing this on the github website, after clicking on "resolve conflicts" in the PR - so I'm not "on" any branch

Copy link
Author

Copilot AI commented Jan 12, 2026

@copilot I'm doing this on the github website, after clicking on "resolve conflicts" in the PR - so I'm not "on" any branch

Got it! On GitHub's web interface:

  1. Click "Resolve conflicts"
  2. You'll see conflict markers in the editor - keep ONLY your custom autobuild.yml content (the part between <<<<<<< my-build and =======)
  3. Delete all the conflict markers and the incoming content (everything from ======= to >>>>>>>)
  4. Click "Mark as resolved" then "Commit merge"

Your custom autobuild.yml will be preserved.

Updated in commit 25fba80.

@ignotus666
Copy link
Owner

@copilot Even if I do that it still wants to commit the changes to master. i think here's the clue: Resolving conflicts between master and my-build and committing changes -> master

Copy link
Author

Copilot AI commented Jan 12, 2026

@copilot Even if I do that it still wants to commit the changes to master. i think here's the clue: Resolving conflicts between master and my-build and committing changes -> master

That's the issue! The PR is targeting master instead of my-build.

Change the PR base branch:

  1. On the PR page, find the base branch selector (usually near the title)
  2. Change it from master to my-build
  3. The PR should then show: my-build ← copilot/update-gitattributes-for-autobuild

After that, resolve conflicts and merge - it will commit to my-build correctly.

Updated in commit 1822e55.

@copilot Even if I do that it still wants to commit the changes to master. i think here's the clue: Resolving conflicts between master and my-build and committing changes -> master

My mistake - if the PR is already master → my-build, then it's correct. When you resolve conflicts and commit, it will commit to your my-build branch (the target), not to master. The message might be confusing, but the merge creates a commit ON the branch you're merging INTO (my-build).

Updated instructions in commit 6ac5682 - just keep your custom content when resolving conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants