Michael Scheper
Michael Scheper

Reputation: 7038

diffing unstaged or uncommitted changes in IntelliJ Idea

In the IntelliJ Idea IDE, how do I do the equivalent of plain ol' git diff (ideally git diff -w) or git diff --staged, so I can view my changes side-by-side with my branch's HEAD? I basically want the same thing as Project Explorer → Compare With → HEAD Revision in Eclipse Juno.

I've found out how to compare different branches in IntelliJ, but I haven't worked out how to do this basic thing―the current branch does not appear as an option in Project tree → Git → Compare with Branch.... An answer below explains how to do it for one file, but this doesn't work for the whole project or even an individual directory, only individual files.

I'm using IntelliJ for the first time in 8 years, so I'm probably missing something obvious. Unfortunately, the resident IntelliJ expert is completely new to Git. ;-)

Upvotes: 15

Views: 12150

Answers (3)

Kasun Pathirana
Kasun Pathirana

Reputation: 81

Press Alt+9 to get the "Local Changes" view that has the information you required

https://www.jetbrains.com/help/idea/version-control-tool-window-local-changes-tab.html

Upvotes: 2

fedorn
fedorn

Reputation: 484

You can use Version Control window to see all changed files (⌘-9). Then you can select file and press ⌘-D to view diff for it.

Upvotes: 3

msfk
msfk

Reputation: 137

You can see the diff of the opened file by going to Main Menu -> VSC -> GIT -> Compare with same Repository Version.

There is also a shortcut enter image description here in the toolbar, using which you can directly view the diff of the opened file.

Upvotes: 3

Related Questions