Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Updating base branch in PR does not recalculate files in diff #750

Open
beldaGR opened this issue Aug 24, 2016 · 49 comments
Open

Updating base branch in PR does not recalculate files in diff #750

beldaGR opened this issue Aug 24, 2016 · 49 comments
Labels
bug diff parity Features that GitHub is missing, but competitors implement; also, see [Migration] pull-requests

Comments

@beldaGR
Copy link

beldaGR commented Aug 24, 2016

I think there's a bug in your new feature from August 15th. The diff showed 5 file changes but it introduced a lot more. When you revert the merging commit, there are 26 changed files. Causes confusion and headache when investigating. I'd rather not have the feature appear at all, vs. having to solve the mystery of why previously reverted commits are showing up in master.

@TPS
Copy link
Collaborator

TPS commented Aug 24, 2016

@beldaGR Since this isn't @github support, make sure you contact them, & refer back to this issue. It'd be much appreciated to update w/ response & resolution, when there is. Now do as detailed in #750 (comment).

@mihelich
Copy link

I've encountered this in a more specific form:

  1. Close an existing PR.
  2. Change its base branch, while closed.
  3. Reopen the PR.

In that case, GitHub does not update the PR's commits and diffs. In my experience, changing the base branch on a still-open PR does update them as expected.

I have support thread open with GitHub containing a detailed repro case.

@mryellow
Copy link

I'm seeing this where I've made changes to develop and a feature branch continues to show old state. Closing and re-creating the PR continues to show old state without the base branch changes.

@KrisKnabel
Copy link

KrisKnabel commented Jun 1, 2018

I was having the same issue where the PR base branch changed, but the PR diff view was outdated even after multiple browser refreshes. Editing the PR Base to a different branch, then changing it back fixed it.

@alexlevy0
Copy link

Use simple git merge works

@cxw42
Copy link

cxw42 commented Aug 3, 2018

@mihelich Did you ever hear back from GitHub Support?

@Methodician
Copy link

Changing the base branch away from Master then back also worked for me, but this is clearly a bug.
Here's how to reproduce in my case (not sure if my online editor activity did something)

  1. Have multiple PRs submitted by the same person as they go through and change things sequentially (each incorporating their previous PR's changes)
  2. Use the online editor to make changes before merging the first PR into Master
  3. review changes to the next PR and any changes you made in the online editor are not reflected
  4. fix this by changing the base branch (ideally to the last-fixed PR's branch) and then change it back to Master...

This is a heavy work-around that due to my team's workflow I now have to do regularly. Needs to be fixed.

@qci-balagula
Copy link

qci-balagula commented Aug 24, 2018

I am also interested in what's mentioned above, if I may be of use as an additional voice for this issue. Perhaps there should be a hook to regenerate the PR or reload the diff when the base branch changes.

@dato
Copy link

dato commented Mar 3, 2019

Is there an API endpoint or action that could be (ab)used to programmatically force a refresh?

I guess that, as a last resort and as per the comments above, the API could be used to change the base branch to a different one, and then back to the original one. But it'd be ideal to find something less intrusive than that.

@aipirvu
Copy link

aipirvu commented Apr 3, 2019

I am amazed about this bug being reported in 2016 and two years later still not fixed. It seems like a basic feature for pull requests.

@ccemeraldeyes
Copy link

Running into a similar version of this - files changed tab is showing file differences based on commits instead of on the diff.

@jgonzalezd
Copy link

Simply switching base branch back and forth works.
Ex, starting with develop as the base branch which got updated after PR was created:
switch base branch to staging
switch base branch back to develop
Done

@zglennie
Copy link

zglennie commented Jul 8, 2019

I just encountered this on GitHub Enterprise, Version 2.17.1 (sha 4559402).

I used the workaround of switching the target branch and then switching it back real quick, but it's not a very satisfactory solution. If another developer had the page open, and clicked "merge" between my two changes, wouldn't the PR be merged onto the wrong branch?

@monperrus
Copy link

Yes, the diff in a PR should always be recomputed according to the latest version of the base branch.

@monperrus
Copy link

FYI, answer from Matt at Github support:

We show what's called a "three-dot diff" which is the difference between the latest commit on the HEAD branch and the last common ancestor commit with the base branch. So if you forked off of a repo a while ago and things have changed in the parent repo since then, or if you opened a PR from the master branch and then the master branch has changed in the meantime, the diff wouldn't show that.

It sounds like you'd rather see a "two-dot diff", which would show the changes between the two most recent commits on each branch. If you'd like, you can merge the base branch back into the HEAD branch. That updates the last common ancestor and would be more likely to show you what you're expecting to see there.

@gorka-llona
Copy link

Simply switching base branch back and forth works.
Ex, starting with develop as the base branch which got updated after PR was created:
switch base branch to staging
switch base branch back to develop
Done

This worked for me! Thanks!

@julioolvr
Copy link

Just want to add that the three-dot vs two-dot diff behavior mentioned by @monperrus explained, in my case, why I was seeing different diffs locally and on Github - even after changing the base branch to force a refresh. A git merge of the new branch against the base branch finally "fixed" the diff (as in: the three-dot diff became the same as the two-dot diff, which in our case was more convenient for reviewing).

@alekkowalczyk
Copy link

Same here, clearly a bug in github files view on the PR

@moshfeu
Copy link

moshfeu commented Dec 10, 2019

I just experienced that too. But then, I saw a button (can't attach a screenshot because I already clicked on it) with the label update branch. Click on it, fixed the issue (pushed an empty commit - Merge branch 'master' into ...). So maybe GIthub solved that issue after all.

@JoshuaWi
Copy link

JoshuaWi commented Jan 3, 2020

This has been happening with our repo regularly since the new year for some reason.

  1. PR from x -> develop
  2. someone branches off develop (branch y), merges x -> y
  3. PR from y -> develop gets merged
  4. PR from x-> develop still shows all the old commits as if they have not been merged in yet

@kekoziar
Copy link

kekoziar commented Jun 30, 2021

Still a bug, and a big problem with repository maintainers who don't have access to rebase branches/PRs or change the default branch. I wish there were a button/function to update PR diffs.

@aryairani
Copy link

Still a bug, and a big problem with repository maintainers who don't have access to rebase branches/PRs or change the default branch. I wish there were a button/function to update PR diffs.

Open a ticket at https://support.github.com/request and maybe with enough +1's, they will fix it.

@TPS
Copy link
Collaborator

TPS commented Jun 30, 2021

I don't know if that should used for general bug reports. Try searching https://github.com/github/feedback/discussions for this, or filing there if not already there, referring back here.

@aryairani
Copy link

I think we should follow this guy's advice: #750 (comment)

@TPS
Copy link
Collaborator

TPS commented Jul 1, 2021

I think we should follow this guy's advice: #750 (comment)

Actually, my advice there is somewhat outdated. The current best practice is to search https://github.com/github/feedback/discussions: if you find a discussion for this, chime in there, & refer here (if not already linked); else, open 1 up to do that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug diff parity Features that GitHub is missing, but competitors implement; also, see [Migration] pull-requests
Projects
None yet
Development

No branches or pull requests