Other people’s commit in my Pull Request(Github)?
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:
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.
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.
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.
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.