Other people’s commit in my Pull Request(Github)?

Surajudeen Akande
2 min readSep 12, 2018


Version control makes Software development and teamwork much more productive. But sometimes, it can very challenging especially when learning the ropes. Sometimes, I encounter a problem like working on a branch for a very long time without rebasing with the base branch e.g (master), only to get ready to deploy to production and get into a rebase hell(I am not sure there is anything like that.). It could look like something below:

Other commits on a PR

Definitely, you do not want to merge other people’s commit with yours especially when those commits are already part of the target branch(master) in this case.

Solution 1

Before now, (I should be ashamed to say I did this) I try to check into a commit of mine, then use interactive rebase over and over until everything is fine like I expected it.

An easier hack is to click on the edit button on the PR.

click the Edit button on the right

Change the target branch into any other one. Then change it back into the target branch again. There you go, all the other commits are cleared and left with yours alone.

Caveat on Solution 1

I am not sure if this is a bug on the side of Github, but as at September 2018 this hack saved my life. It could save yours too.

Solution 2

Squash and Merge! I just learnt about this from a colleague. This is a lot cleaner. Choose this option on the Pull request call to action button.