If you have more than one GitHub account — and at this point, who doesn't — you've probably pushed a commit with the wrong email at least once. Maybe it was a personal project that went out under your work email. Maybe it was the other way around. Either way, Git didn't warn you, GitHub didn't warn you, and you found out when you looked at the commit history and saw someone who isn't quite you taking credit for the work.

And if you're like me, it's not just two identities and two repos. It's work, personal, side projects, client work, experiments you're not ready to explain — each tied to its own GitHub account, its own email, its own SSH key. The number of repos grows, the number of identities grows, and the odds of pushing under the wrong one keep going up with them.

The standard fix is to run git config user.email in each repo. That works. It also relies on you remembering to do it every single time, which — let's be honest — you're not going to do. Not consistently. Not when you're in the middle of fixing something and just want to commit and move on.

There's a better way, and it's been in Git since 2017.

includeIf: the feature you probably don't know about