Warm tip: This article is reproduced from stackoverflow.com, please click
git

How to have Github do `git diff ..` (two dots) instead of `git diff ...` (three dots)

发布于 2020-03-27 10:24:24

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.

Questioner
CryHard
Viewed
126
CryHard 2019-07-04 00:33

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:

  1. Go to master and git pull --rebase to make sure you have the latest master.
  2. Create a branch off master with git branch -b temp_master
  3. Checkout feature branch and from here, run git merge -s ours temp_master
  4. You can now delete temp_master and push feature with git push -f origin feature

Your git pull request is now going to display correct diffs.