How to use PyCharm as a GIT diff command line tool?

On the PyCharm help page, I see that you can use PyCharm as a command-line comparison tool to compare two files. This is amazing! However, is there a way to do this even further and use it as a git diff tool.

So I can just type pycharm diff file_name.pyand get the git differences just as if you were on PyCharm, set up git integration and click CTRL + Dto see the differences.

+4
source share
1 answer

Yes, you can.

First you need to enable the command line launcher:

PyCharm ,

  • macOS UNIX:

    • , PyCharm .
    • | . Launcher Script, script. . , .
    • PyCharm script .
  • Windows:

    • PyCharm Path. PyCharm PyCharm .

https://www.jetbrains.com/help/pycharm/running-pycharm-as-a-diff-or-merge-command-line-tool.html

~/.gitconfig:

[diff]
        tool = pycharm
[difftool "pycharm"]
        cmd = /usr/local/bin/charm diff "$LOCAL" "$REMOTE" && echo "Press enter to continue..." && read
[merge]
        tool = pycharm
[mergetool "pycharm"]
        cmd = /usr/local/bin/charm merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
        keepBackup = false

( Windows )

0

Source: https://habr.com/ru/post/1616365/


All Articles