Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diff in PhpStorm

Tags:

diff

phpstorm

How can I compare a document in the current project with one that is not part of the project? How can I compare two arbitrary files on my computer with phpStorm?

like image 787
Handsome Nerd Avatar asked Sep 11 '12 07:09

Handsome Nerd


2 Answers

Currently, the easiest way that I found to compare a project file with a non-project file is by copying the external file to the clipboard and clicking on "View-> Compare with clipboard".

like image 83
Handsome Nerd Avatar answered Sep 23 '22 17:09

Handsome Nerd


MacOS

Create a file in /usr/local/bin/ named PhpStorm

Paste this

#!/bin/sh

open -na "PhpStorm.app" --args "$@"

And make it executable

chmod +x /usr/local/bin/PhpStorm

And now you can do this

PhpStorm diff <path1> <path2>

Windows

Add PhpStorm bin to your PATH

setx PATH=%PATH%;C:\Program Files\JetBrains\PhpStorm\bin

Now you can do this

phpstorm.bat diff <path1> <path2>

Linux

Create a link to your PhpStorm launcher script :

# Path to PhpStorm installation may differ
ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm

Now you can do

phpstorm diff <path1> <path2>

Sources from jetbrains werbsite :

https://www.jetbrains.com/help/phpstorm/command-line-differences-viewer.html

https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html

like image 25
ReaperSoon Avatar answered Sep 23 '22 17:09

ReaperSoon