Search code examples
gitintellij-idea

How to see pull request like changes in intellij Idea


We are using Bitbucket in our project and reviewing large pull requests in the browser is pain, I find it difficult to understand, what happened. I find it way easier to review the changes in directly in the Intellij Idea. If a feature branch is forked from develop (we are using git flow) and nobody has merged anything into the develop branch then I can use Compare with local feature after clicking on the commit I've made branch out of. However this doesn't work well, when someone merges anything into develop branch - the comparison tool obviously shows all the differences between branches, that means irrelevant changes for the feature I'm reviewing. Is there a way, how to compare two branches in Intellij Idea using some "pull request like" diff?


Solution

  • I found what I was looking for. Assuming there are no conflicts, I need to create local merge with --no-ff and --no-commit options like this:

    git checkout develop
    git merge --no-ff --no-commit origin/my-feature-branch
    

    And then I can see the changes I need as local changes in the Intellij Idea window. Finally I can abort my changes by git merge --abort