fix: fetch before merging in Update from Default Branch#111
Conversation
Without a fetch, the operation compared against the stale local ref for the default branch, causing it to incorrectly report "already up to date" when remote had unpulled commits. Fixes pol-rivero#110 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Additional contextThis is a known issue in the upstream A GitHub Desktop team member responded saying the behavior is intentional and pointed users to the manual Fetch button. The community is unhappy with that answer, with comments as recent as January 2026 still expressing frustration. Why silently fetch (no popup)The action is named "Update from Main" — the implicit contract is "give me the latest from main", which requires a fetch. The mental model doesn't include "...but only if I've already fetched recently". Adding a confirmation dialog or a "fetch + update" / "update only" split would add friction to every use of a very common action, for the benefit of a narrow edge case (offline, metered connection). Background fetch already runs silently — this should be consistent with that. If the fetch fails, |
|
this is big, too many times I merged into a stale main/develop branch - one note shouldn't it also pull fast-forward? because fetch updates |
|
@guplem That's a nice and clean fix, thanks!
Yeah, I was thinking the same thing but then saw that |
|
I actually didn't realize the fast-forward was being done inside the fetch. I actually lean towards not liking it (I didn't think local files/branches should be altered without user intent) but I can live with that |
|
@guplem A possible alternative would be to merge the remote branch (for example |
|
@pol-rivero
EDIT: Ignore me, see discussion below |
I'm not sure if I follow. You can absolutely do |
|
Here's what I meant: 2026-03-28.12-47-14.mp4 |
|
Right - sorry, I was mixed up for a second about direction. Ok, so if the goal is to "Update from Main" meaning the remote main, I propose to change the label to do "Update from Origin Main" (or from whatever remote is configured) so that it's the actual |
|
Exactly. The only note I would add is that the |
|
Follow-up PR implementing the improvement suggested by @pol-rivero: #113 It merges |
Summary
Closes #110
await this.props.dispatcher.fetch(repository, FetchType.UserInitiatedTask)before themergeBranchcall inupdateBranchWithContributionTargetBranch().asyncto allow awaiting the fetch.FetchTypewas already imported; no additional imports needed.Root cause
updateBranchWithContributionTargetBranch()merged directly against the local ref for the default branch without fetching from remote first. If the local ref was stale, git would correctly report "already up to date" relative to the cached local state — even though the remote had new commits.Test plan