Assume I have two branches, master
and feature
.
The goal is to have a visual way to see the entire diff between master
and feature
on Github. This is not possible by default because Github uses git diff ...
(three dots), which takes the most recent common ancestor when doing diffs between two branches. This means diffs that were introduces into master
after that common parent will not show up in the diff with feature
, hence making the diff wrong.
I am looking for a solution to this problem.
Here's the actual answer which people here seem not to want to give. Please use at your own risk.
Assuming we want to update the common ancestor between master
branch and feature
branch, proceed as follows:
master
and git pull --rebase
to make sure you have the latest master.master
with git branch -b temp_master
feature
branch and from here, run git merge -s ours temp_master
temp_master
and push feature
with git push -f origin feature
Your git pull request is now going to display correct diffs.
You would never be able to submit such a pull request to an upstream repo. Because your commit is now essentially removing all changes from the upstream master. At some point, before you submit the pull request, you would need to properly resolve the conflicts.
@Alderath like I said, the purpose of this is to just show the diffs on github as doing
git diff master..feature
, which github doesn't do by default.The reason people might "not want to give" this answer is likely because it only thinks of the current repo. Who'd want to contribute to a repo if the owner is only going to completely wipe out any changes except their own?