17

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
anthony sottile
  • 61,815
  • 15
  • 148
  • 207
kuanb
  • 1,618
  • 2
  • 20
  • 42

2 Answers2

19

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
Jean-Christophe
  • 485
  • 4
  • 7
4

How about this:

curl http://pre-commit.com/install-local.py | python - uninstall
anthony sottile
  • 61,815
  • 15
  • 148
  • 207
madebydavid
  • 6,457
  • 2
  • 21
  • 29
  • 1
    So that resulted in the following note: `Cleaned ~/.pre-commit-venv ~/bin/pre-commit`. But pre-commit still seems to be installed. Any reason that you could think of that would keep it from being fully uninstalled with the above command? – kuanb Jun 02 '17 at 17:59
  • 1
    Not sure, I tried on my machine and it seemed to remove it? https://gist.github.com/madebydavid/1e225ef912984044e02996993b5f269e – madebydavid Jun 02 '17 at 18:28
  • 4
    @kuanb maybe you also ran `pre-commit install` which you'd want to `pre-commit uninstall` to undo? (or `rm .git/hooks/pre-commit` if you've already purged it as per above) – anthony sottile Sep 03 '19 at 00:27