But this raises the question of why you are only committing only some of your changes? That means you are working on multiple things at once and only checking in some of them. Which means that the particular batch of changes that you check in has never been built in isolation until the moment you commit. They will only be built once committed. In other words this way of working has a high chance of 'breaking the build'.
I realize that in everyday work, one doesn't always practice feature-branching, but generally one does.
Interested to hear your use case that involves working on multiple units-of-work on the same branch. Maybe it is not code (ie maybe it is a book or something?).