pre-commit is meant for validation. Not for changing the commit.
Using pre-commit to delete or add files is effectively undefined behavior. It may or may not work.