This has come up a lot recently. I see devs fiddling with their Git commits - selectively staging files, stashing etc to get the commit they want.
My instinct has always been - when I find myself looking at unstaged files and thinking "That shouldn't be in there" - to go to the .gitignore file and fix the problem there.
Code works as a whole. Cherry-picking is how our local config can easily drift from the repo's.