That seems like a bug. You might want to report that here: https://github.com/contact.
Yes, I agree. GitHub seems to think this is a design feature, however. Their response when I posted via that form, below. From my persepctive though it's still giving an incorrect answer. It’s showing a difference when there actually isn’t one, and then offering to do a merge assuming that difference, which ultimately results in a no-op because there actually isn't one. Definitely feels like a bug to me too!
"When you merge commits from a Pull Request into a branch, the commit SHA changes from what the original commit SHA's were.
This means when you compare the same two branches again, the diff will show those commits again because those specific commit SHA's don't exist on the branch you're merging into.
This is a result of the type of diff we use on GitHub. We use git's 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.
This workflow is designed for a topic branch model. The presumption with the topic branch flow is that a branch is created to merge in a specific feature. Once the branch has been merged it would be deleted and further development would be made on a new branch.
A lot of teams use a master > dev branch model though and for this, once a Pull Request is merged, the master branch would be merged back onto dev using the command line:
git checkout devgit rebase master Rebasing the master back onto dev updates dev with the latest commits from master and should give you a clean diff again.!"
Just checked this locally by:
1. creating a repo with 1 file and committing it to commit "A", in master
2. Checkout to a new branch called "mybranch" and do a `git reset head~1`
3. Make a new commit to commit "B" with the exact same content as "A"
4. `git diff master` (on mybranch) gives no results, as expected.