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. ;-)
IntelliJ IDEA allows you to review all changes made to the project sources that match the specified filters. For distributed version control systems, such as Git and Mercurial, you can view project history in the Log tab of the Version Control tool window Alt+9 (see Investigate changes in Git repository).
Revert uncommitted changes You can always undo the changes you've made locally before you commit them: In the Commit tool window Alt+0 , select one or more files that you want to revert, and select Rollback from the context menu, or press Ctrl+Alt+Z .
IntelliJ IDEA lets you review the state of your project at a selected revision. Open the Git tool window Alt+9 and switch to the Log tab. Select a commit and choose Show Repository at Revision from the context menu.
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 in the toolbar, using which you can directly view the diff of the opened file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With