Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

running `pre-commit autoupdate` fails because tip of HEAD is missing hook #1708

theod07 opened this issue Nov 22, 2020 · 1 comment


Copy link

@theod07 theod07 commented Nov 22, 2020

Hello 馃憢
I'm setting up pre-commit on a project and came across an issue when adding hook destroyed-symlinks. The error message suggested running pre-commit autoupdate. I ran that and saw that it cannot update because the tip of HEAD is missing that hook. I'm not sure what that means so posting here.

$ echo '    -   id: destroyed-symlinks' >> .pre-commit-config.yaml
$ git add -p !$
git add -p .pre-commit-config.yaml
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index bfde4717..949f3ffc 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,3 +21,4 @@ repos:
     -   id: check-vcs-permalinks
     -   id: check-xml
     -   id: debug-statements
+    -   id: destroyed-symlinks
(1/1) Stage this hunk [y,n,q,a,d,e,?]? y

$ git commit -m 'new hook destroyed-symlinks'
[ERROR] `destroyed-symlinks` is not present in repository  Typo? Perhaps it is introduced in a newer version?  Often `pre-commit autoupdate` fixes this.
$ git status
On branch pre-commit
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   .pre-commit-config.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)

$ pre-commit autoupdate
Updating ... [INFO] Initializing environment for
Cannot update because the tip of HEAD is missing these hooks:
$ git checkout .
Updated 0 paths from the index
$ pre-commit autoupdate
Updating ... Cannot update because the tip of HEAD is missing these hooks:
$ pre-commit --version
pre-commit 2.9.0
Copy link

@asottile asottile commented Nov 22, 2020

ah the error message never got updated from when the default behaviour of autoupdate switched from what is now --bleeding-edge to picking tags. pre-commit autoupdate --bleeding-edge can get you to that not-yet-released hook if you need it

this should mention instead of "tip of HEAD" "update target" or "latest tag" or something of the sort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants