You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
Repository navigation
This repository was 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
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.
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.
Reacted by beldaGR, Jeremy Mickelson, Jonathan De la Torre, Levon Arakelyan, Chad Norwood, mryellow, Chris White, José Cage , Thaís Vergani, Shunaylov and 13 more
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.
Reacted by Kristopher Knabel, Alex Malz, soerenBoisen, Walker de Paula and Marco Oliveira
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.
Reacted by Yuan Gao, David Mazza, Jiena Gu McLellan, Ivan Posti, Magda, Saurabh Bajaj, obeliaiev and Gregory Alford
Reacted by Andy Ray, soerenBoisen, Alexandru Pirvu, Wildhammer, Alttaf, Walker de Paula , Bexultan Myrzatay, Coe Pinguinos, Yura T, Vadim Miropolskiy and 28 more
Reacted by Alex Lévy, Mike Gillett and Ibrahim Abouzied
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)
Have multiple PRs submitted by the same person as they go through and change things sequentially (each incorporating their previous PR's changes)
Use the online editor to make changes before merging the first PR into Master
review changes to the next PR and any changes you made in the online editor are not reflected
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.
Reacted by Eduardo Esclapés, Daniel Balagula, Trish Ta, Charles Verdad, soerenBoisen, Joao Pedro Pinheiro, Duc Ngo Viet, Jacky Pan, Matthias Vogel, Eugen Wesseloh and 20 more
Reacted by Lucas and Gabriel Martinez
Reacted by Lucas, Jeff Burdges, Markus Fitzner and Gabriel Martinez
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.
Reacted by Charles Verdad, runevalle-cognite, Joao Pedro Pinheiro, Georgi Pandurov and Hudson Ansley
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.
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.
Reacted by Alex Lévy, Tirath Patel, Carson Holzheimer, Zsolti1989, Errol A. Zuñiga Jr., kbray-onica, Teddy Knox, Colleen Briant, Laura Simmons, James Riley and 83 more
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
Reacted by ceisele-r, Darwin Gautalius, Stefan Kleff, saurabhshri-evive, Greg McGrath, Albert Y. Kim, Sean Newell, Nícolas de Araujo, Jalil and Sérgio Ferreira
You just have to merge master(or the base branch you desire) into the branch that has the PR open and then GitHub will recalculate the diffs.
Well, the idea is to not have to do that.
Question: if the base branch introduces a breaking change for the PR, wouldn't it make sense to build and test the new commit before merging the PR? In other words, shouldn't it be up to the PR owner to make the merge themselves?
If the base branch introduces a breaking change for the PR, wouldn't it make sense to build and test the new commit before merging the PR?
Totally! But this thread is not so much about if the base branch introduces a breaking change for the PR, but more when the base branch fast-forwards to a point midway into the PR's history:
base .. a .. b .. c .. d .. e .. f .. g .. topic
Initially, the PR shows a diff including a–g. And if we add to topic:
base .. a .. b .. c .. d .. e .. f .. g .. h .. i .. j .. k .. topic
then the PR diff is updated correctly as a–k.
But if a–e is merged into base, we end up with:
base .. f .. g .. h .. i .. j .. k .. topic
The PR diff should show f–k, but it actually still shows a–k (it's cached, I suppose), which doesn't reflect the current state of the repo, and is unhelpful for reviewing purposes.
In other words, shouldn't it be up to the PR owner to make the merge themselves?
Probably so, but the PR owner and reviewers should have some way of knowing about it, and seeing the updated diff, which is what this PR is about.
I think you're describing this scenario:
.. a .. b .. c .. d .. e .. f .. g .. topic
\
x .. y .. base
which should now be converted to a 3-way diff, which Github supports, except that it doesn't notice that the diff needs to be updated. This should be fixed too. It can still be the PR owner's responsibility to fix a breaking change (CI should detect it and re-run tests on the new merge), but there's no reason for the PR diff to be out of date.
TL;DR: Github recomputes the diff when topic changes, but doesn't recompute it when base changes. It should recompute the diff when either changes.
Hope this helps.
Reacted by TPS, Levi Lesches, mryellow, Alexandru Pirvu and Evan Smith
I like how github ignores this issue, says it's working as intended, and hopes everyone just goes away.
@mryellow This isn’t actually Github Support, so we’re just preaching to the choir here, and/or arguing amongst ourselves. They can be reached at support@github.com, and then if you wanted to quote their reply here so that everyone is brought up to speed, then 👍.
Try to rebase with the target branch.
@aniketrathi The point is that you shouldn’t have to do that or know to do that.
As you correctly stated, what you are describing here often happens when a pull request's base branch is updated. I'm afraid that currently, we do not automatically perform sync pull request or track changes when the base branch is updated.
To avoid confusion, we recommend regularly merging the main branch into the topic branch. Other users have also found this workaround to be effective i.e. switch the base branch of the pull requests to a random branch then switch it back.
I can see how it would be useful to automatically sync the PR when the base is update. We've received similar feedback from other users as well and shared it with our Product team for consideration. I'll add a +1 on it on your behalf.
Please let me know if you have any other questions.
Regards,
Peter
GitHub Support
Reacted by Alexandru Pirvu, mryellow, TPS and Tarek Dinkespiler
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.
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.
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.
Activity
TPS commentedon 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 commentedon Jan 25, 2017
I've encountered this in a more specific form:
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 commentedon May 23, 2018
I'm seeing this where I've made changes to
developand 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 commentedon 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 commentedon Jul 12, 2018
Use simple git merge works
cxw42 commentedon Aug 3, 2018
@mihelich Did you ever hear back from GitHub Support?
Methodician commentedon Aug 5, 2018
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)
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 commentedon 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 commentedon 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 commentedon 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 commentedon May 2, 2019
Running into a similar version of this - files changed tab is showing file differences based on commits instead of on the diff.
jgonzalezd commentedon May 16, 2019
Simply switching base branch back and forth works.
Ex, starting with
developas the base branch which got updated after PR was created:switch base branch to
stagingswitch base branch back to
developDone
23 remaining items
aryairani commentedon Jun 2, 2021
Well, the idea is to not have to do that.
Levi-Lesches commentedon Jun 3, 2021
Question: if the base branch introduces a breaking change for the PR, wouldn't it make sense to build and test the new commit before merging the PR? In other words, shouldn't it be up to the PR owner to make the merge themselves?
aryairani commentedon Jun 4, 2021
Totally! But this thread is not so much about if the base branch introduces a breaking change for the PR, but more when the base branch fast-forwards to a point midway into the PR's history:
Initially, the PR shows a diff including a–g. And if we add to topic:
then the PR diff is updated correctly as a–k.
But if a–e is merged into base, we end up with:
The PR diff should show f–k, but it actually still shows a–k (it's cached, I suppose), which doesn't reflect the current state of the repo, and is unhelpful for reviewing purposes.
Probably so, but the PR owner and reviewers should have some way of knowing about it, and seeing the updated diff, which is what this PR is about.
I think you're describing this scenario:
which should now be converted to a 3-way diff, which Github supports, except that it doesn't notice that the diff needs to be updated. This should be fixed too. It can still be the PR owner's responsibility to fix a breaking change (CI should detect it and re-run tests on the new merge), but there's no reason for the PR diff to be out of date.
TL;DR: Github recomputes the diff when
topicchanges, but doesn't recompute it whenbasechanges. It should recompute the diff when either changes.Hope this helps.
aniketrathi commentedon Jun 4, 2021
What happens if we merge that PR.
mryellow commentedon Jun 6, 2021
I like how github ignores this issue, says it's working as intended, and hopes everyone just goes away.
aniketrathi commentedon Jun 6, 2021
Try to rebase with the target branch.
aryairani commentedon Jun 9, 2021
@mryellow This isn’t actually Github Support, so we’re just preaching to the choir here, and/or arguing amongst ourselves. They can be reached at support@github.com, and then if you wanted to quote their reply here so that everyone is brought up to speed, then 👍.
@aniketrathi The point is that you shouldn’t have to do that or know to do that.
mryellow commentedon Jun 9, 2021
Someone did so earlier.
"Working as intended"
#750 (comment)
aryairani commentedon Jun 14, 2021
@mryellow The three-dot diff also doesn't work, isn't brought up to date when the base branch ref moves.
aryairani commentedon Jun 15, 2021
from Github support re. Ticket 1192918:
kekoziar commentedon 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 commentedon Jun 30, 2021
Open a ticket at https://support.github.com/request and maybe with enough +1's, they will fix it.
TPS commentedon 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 commentedon Jul 1, 2021
I think we should follow this guy's advice: #750 (comment)
TPS commentedon Jul 1, 2021
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.