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

Staged files only #168

Open
alexmiranda opened this issue Mar 2, 2023 · 1 comment
Open

Staged files only #168

alexmiranda opened this issue Mar 2, 2023 · 1 comment

Comments

@alexmiranda
Copy link

Is there any way to apply formatting to git staged files only? e.g. invoked with a pre-commit hook

@klaraward
Copy link
Contributor

I think you should be able to do something with the
fileNamesPattern config option, which is used like this - https://github.com/spotify/fmt-maven-plugin/blob/main/src/main/java/com/spotify/fmt/Formatter.java#L104.

fileNamesPattern is a regex, so something like (path-to-first-file|path-to-second-file....) should do, if you can build up that regex in your pre-commit hook.

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