Search code examples
pythonuninstallationpre-commit.com

How to uninstall pre-commit


Following the "non administrative installation" instructions on Pre-Commit's website, I ran the following command:

curl http://pre-commit.com/install-local.py | python

These instructions provide the following note: "(To upgrade: run again, to uninstall: pass uninstall to python)."

Right now, I want to uninstall pre-commit. I am trying to understand how to pass uninstall to Python. I'm not sure what passing uninstall entails.

I've tried:

curl http://pre-commit.com/install-local.py | python --uninstall
curl http://pre-commit.com/install-local.py | --uninstall python
curl http://pre-commit.com/install-local.py | uninstall | python

..and a couple other probably even more nonsense variations. All of which result in:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Unknown option: -n
usage: /usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
100  2590  100  2590    0     0  14175      0 --:--:-- --:--:-- --:--:-- 14230
(23) Failed writing body

Solution

  • There are very granular options -> pre-commit uninstall -h

    To remove every hook:
    pre-commit uninstall -t pre-commit -t pre-merge-commit -t pre-push -t prepare-commit-msg -t commit-msg -t post-commit -t post-checkout -t post-merge -t post-rewrite

    Idiot-proof uninstall:

    pip install pre-commit \
    && pre-commit uninstall -t pre-commit -t pre-merge-commit -t pre-push -t prepare-commit-msg -t commit-msg -t post-commit -t post-checkout -t post-merge -t post-rewrite \
    && pip uninstall pre-commit -y