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

Remove implict git add when running pre-commit hooks #1260

Merged
merged 2 commits into from
Mar 22, 2022

Conversation

glensc
Copy link
Contributor

@glensc glensc commented Mar 18, 2022

The original code (before this PR) breaks the intended behavior committing staged changes.

I strive for atomic commits:

so, I make changes, git add -p to stage changes for intended commit, and then do git commit. now the pre-commit hook will override my git add -p staging adding all modified files to commit.

this is unexpected and even hidden, so wouldn't even know something override my staging.

combining lint-staged update to v10, would have the best experience as it will automatically stage the changes, made in scripts ran by lint staged:

This breaks intended behavior of adding to commit unstaged changes
@glensc glensc self-assigned this Mar 18, 2022
@glensc glensc mentioned this pull request Mar 18, 2022
@orta
Copy link
Member

orta commented Mar 22, 2022

Yeah, this seems reasonable to me 👍🏻

@orta orta merged commit 0007ac4 into danger:main Mar 22, 2022
@glensc glensc deleted the no-implicit-git-add branch March 22, 2022 22:06
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

Successfully merging this pull request may close these issues.

2 participants