Using IntelliJ to diff two arbitrary files

后端 未结 10 1453
感动是毒
感动是毒 2020-12-24 11:42

I\'m really liking the IntelliJ diff tool. I\'m wondering if it is possible to use this tool to diff two arbitrary files. I.e. files NOT in an IntelliJ project. Just pick tw

10条回答
  •  时光取名叫无心
    2020-12-24 12:00

    From the terminal, you can use the idea launcher directly like so:

    # Windows
    idea.exe diff path1 path2
    
    # MacOS/Linux
    idea diff path1 path2
    

    At least for MacOS (I'm not certain of Windows), if you've created the Command-line Launcher via "Tools -> Create Command-line Launcher..." it's as simple as the following:

    # Create some files to diff
    echo "This is line 1" > file1.txt
    echo "This is line 2" > file2.txt
    
    # Diff with IntelliJ
    idea diff file1.txt file2.txt
    

    Note this works with other JetBrains applications as well; for example, using WebStorm or PyCharm:

    # Diff with WebStorm
    webstorm diff file1.txt file2.txt
    # Diff with PyCharm
    charm diff file1.txt file2.txt
    

    Reference

提交回复
热议问题