PR diff contains unrelated commits

I was working on a large feature that was splited into two minor features developed on two branches: feature-a and feature-b. feature-b is branched out from feature-a.

My workflow can be described by the following image:

When I created PR from feature-b to feature-a, the changes from master(commit E) was mixed into the PR diff, make it difficult to review.

I reproduced the problem using a simplified model in this repository: GitHub - frankgx97/git-diff

In the PR Feature b by frankgx97 · Pull Request #2 · frankgx97/git-diff · GitHub, the following content

-A, +AE

, which is the changes from commit E was shown in the diff. Since this change was also merged tofeature-a, therefore I did not expect it to be included in the diff.

According to the GitHub document, PR diff uses 3-dot diff. But it does not look like 3-dot diff either and it doesn’t match the three-dot diff from git-cli.

$ git diff feature-a...feature-b

I also uploaded the repo to GitLab and BitBucket, the diff on both of them does not include the -A, +AE changes.

The diff on both GitLab and BitBucket are:


I know that this can be fixed by merging to feature-b from feature-a instead of master, but I’m still wondering what caused this behavior. Is it designed intentionally or it’s a bug?