Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Running pre-commit on all files in git beyond HEAD

I have already made git commits, but want to re-run pre-commit on files above a current Git HEAD commit. I intend to do this in CI with a second, more feature-full pre-commit configuration called .pre-commit-other-config.yaml.

I can accomplish this like so:

git show --name-only --format="" HEAD | pre-commit run --config .pre-commit-other-config.yaml

I am wondering: is there a built-in option for this in pre-commit?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Asides

I am not interested in all files (pre-commit run -a).

>Solution :

surprised you didn’t check the docs for pre-commit run

you’re looking for --from-ref and --to-ref


disclaimer: I wrote pre-commit

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading