My Hive Posts

    GitHub Pull Request Showing Commits which are already on the Target Branch

    It happens with me sometimes that if I have created a Pull Request which is merged and if I try to create another Pull Request, the commits made in the first Pull Request still shows. Though the code changes in the pull request did not appear, the commits show. For me whenever I create a Pull Request I always check the commits first made only in that Pull Request, so I wanted a way to fix that.

    I have an option of Rebase though which technically GitHub should do whenever the Pull Request is merged. But the problem with rebase is that you need to create an extra commit and I usually want to keep my commits as minimum and meaningful as possible.

    So what I actually do is to run the below commands which delete the branch from Local as well as Remote and then merged the branch from the Remote Repository.

    git push --delete origin develop
    git checkout master
    git branch -D develop
    git checkout -b develop
    git fetch upstream
    git merge upstream/develop
    git push origin develop
    

    I know its not the best solution but it works in my case to keep my Pull Request as clean as possible.