On the PyCharm Help Website I see you can use PyCharm as a diff tool from the Command Line to compare two files. That's awesome! However is there a way to take it a step further and use it as a git diff tool.
So I can just type pycharm diff file_name.py
and get the GIT differences same way you would if you were on PyCharm have setup the GIT integration and press CTRL + D
to see the differences.
To open the Diff & Merge page, open settings by pressing Ctrl+Alt+S and navigate to Tools | Diff & Merge. Click this button to scroll both differences panes simultaneously.
PyCharm 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.
Yes you can.
First you need to enable the command-line launcher:
To enable invoking PyCharm operations from the command line, follow these steps
On macOS or UNIX:
- Make sure PyCharm is running.
- On the main menu, choose Tools | Create Command-line Launcher. The dialog box Create Launcher Script opens, with the suggested path and name of the launcher script. You can accept default, or specify your own path. Make notice of it, as you'll need it later.
- Outside of PyCharm, add the path and name of the launcher script to your path.
On Windows:
- Specify the location of the PyCharm executable in the
Path
system environment variable. In this case, you will be able to invoke the PyCharm executable and other PyCharm commands from any directory.
https://www.jetbrains.com/help/pycharm/running-pycharm-as-a-diff-or-merge-command-line-tool.html
Then add the following lines to your ~/.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
(for Windows users these details might be slightly different)
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