Repository navigation
Remove source-only files when resetting inter-branch merge paths - #17740
Merged
akoeplinger merged 1 commit intoOct 29, 2026
Merged
Conversation
Use non-overlay checkout so reset paths match the target branch, including deleting files introduced only on the source branch. Co-authored-by: Copilot <[email protected]> Copilot-Session: 50a9547c-92ce-4f2e-8ee3-664b5a00f3c0
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the workflow reset-path change.
No open issues 🎉
What changed in this PR
Updates the inter-branch merge workflow so reset paths match the target branch, including removal of files present only on the source branch.
Changes:
- Adds
--no-overlaytogit checkoutinResetFilesToTargetBranch. - Clarifies the comment to describe both restoring target files and removing source-only files.
| File | Description |
|---|---|
.github/workflows/scripts/inter-branch-merge.ps1 |
Removes source-only files when resetting matching paths to the target branch. |
Review effort: Balanced
ViktorHofer
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ResetFilesToTargetBranchusesgit checkoutin its default overlay mode. This restores target-branch files but does not remove files introduced only on the source branch, so reset paths can still differ from the target.Use
git checkout --no-overlayto remove those files too. This fixes the issue observed in dotnet/sourcelink#1787, whereeng/common/run-helix-job-monitor.shsurvived theeng/common/*reset.Validation
Invoked the actual PowerShell helper functions, extracted via the PowerShell AST, against an isolated temporary Git repository. The unchanged script fails the source-only-file regression; the fixed script passes checks for:
PowerShell parsing and
git diff --checkpassed. No .NET build was run; this change only affects the PowerShell workflow script.