Search code examples
intellij-ideapycharmwebstormjetbrains-ide

how to make the editor gutter show lines changes against another branch, such as origin/main?


As shown in the screen cap below, the gutter to the left of the editor shows line numbers and color indicators for which lines have changed (and what kind of change):

enter image description here

It shows the changes against the current HEAD.

How could I make it show changes against another branch, such as main or even a remote branch such as origin/main?

For example, if the same change was already made on origin/mainline, I want no color indicator to show at all.

Thank you!!!!!


Solution

  • You can do this with the Git Scope plugin

    It adds a Git Scope tool window that looks much like the built-in Git tool window (or the Commit tool window if you have the Git non-modal interface enabled). In the Git Scope window you can select a different branch to be the basis of file change indicators: screen cap showing Git-Scope tool window

    Not only that:

    • If you click on the color indicators, you can see the actual diff against the chosen branch.
    • The Git Scope window shows all changed files against the chosen branch (much like the built-in git window shows all changed files against HEAD).
    • As with the built-in window, you can right click on any file to or press ⌘D to see a full diff, or the Show Diff button to iterate over all file changes.
    • In fact, as far as I can tell, Git-Scope changes the diff context for even the built-in commands for showing the diff of the currently open file.
    • The Git Scope window has a toggle button to conveniently switch back and forth between normal mode (diffs against HEAD) and the Git Scope mode.