---
title: "Comment by Ahmad Wehbe on \"How To Format Only Staged Files With Spotless\" | Hashnode"
description: "Hey Joe. This runs spotlessApply on all the project. but it only adds and commits staged files. Is there a way to run spotless only on staged files?"
url: "https://hashnode.com/posts/how-to-format-only-staged-files-with-spotless/6436ccfbcf248f86fdaa2b11/comment/673b1b9b240c50807a5e85b7"
---

[Discussion](https://hashnode.com/posts/how-to-format-only-staged-files-with-spotless/6436ccfbcf248f86fdaa2b11)

Comment [How To Format Only Staged Files With Spotless](https://hashnode.com/posts/how-to-format-only-staged-files-with-spotless/6436ccfbcf248f86fdaa2b11)

[Ahmad Wehbe](https://hashnode.com/@ahmadwehbe)

[Nov 18, 2024](https://hashnode.com/posts/how-to-format-only-staged-files-with-spotless/6436ccfbcf248f86fdaa2b11/comment/673b1b9b240c50807a5e85b7)

Hey Joe. This runs spotlessApply on all the project. but it only adds and commits staged files. Is there a way to run spotless only on staged files?

[Joe Roskopf](https://hashnode.com/@joetr)

[Nov 18, 2024](https://hashnode.com/posts/how-to-format-only-staged-files-with-spotless/6436ccfbcf248f86fdaa2b11/comment/673b1b9b240c50807a5e85b7#reply-673ba119be2177a59c6988c8)

Hey! This definitely assumes the rest of the project already has spotless applied to it.

You could consider modifying the script / your project with the following: [github.com/diffplug/spotless/tree/main/plugin-gra…](https://github.com/diffplug/spotless/tree/main/plugin-gradle#ratchet)
