Pull request on github - showing commits rebased from master

git, github

Solution

I used to have the same problem:

If we have `foo` branch, branched from `master`, which is already pushed into `origin`, and on both branches changes were made, then after merging/rebasing I was getting changes from `master` in Pull Request's diff.

I solved it by executing `git fetch` first, updating my local `master` branch, changing local branch to `foo` and then executing commands:

`git rebase master`

`git push -f origin foo:foo`

This is forcing remote branch and then PR's diff contains only proper changes, exactly as the branch would be created based on recent `master`.

Problem

I'm working with a team and we're doing feature branches and pull requests. I created a branch, worked on it a bit while also doing little work on master. Then, I rebased the branch against master. Now I want to do a pull request. However, in GitHub, the pull request shows all the commits that happened between when I first made the branch and now - the commits I did on this feature branch, and the commits that are on master that happened in between. This is noisy clutter - am I doing something wrong? I'd like the pull request to just show the commits that I've made, since the other commits are already on both master and on my branch, no difference. The only suggestion I see is making another branch based on the latest upstream master and cherry picking commits from my branch onto it.

Original source