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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent new files from being staged during pre-commit hook #1571

Open
TheMythologist opened this issue Feb 28, 2025 · 2 comments
Open

Prevent new files from being staged during pre-commit hook #1571

TheMythologist opened this issue Feb 28, 2025 · 2 comments

Comments

@TheMythologist
Copy link

Apologies if this has been asked/raised before, but is it possible to implement a locking mechanism for pre-commits? For example, while running my pre-commit hooks in a terminal, running git add <new_file> shouldn't succeed, because otherwise my hooks wouldn't have run on that new file.

@jefhar
Copy link

jefhar commented Feb 28, 2025

@TheMythologist
Copy link
Author

@jefhar No, I don't want to disable hooks. I still want to run my pre-commit hooks, but while my pre-commit hook is running, disallow git from staging any further files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants