Pretty frequently I start writing some code, when I realise there's another change I need to make before I can continue. I like to make lots of small atomic changes to a code base because it lets me test more quickly and catch errors earlier. I used to do this by saving my changes in a temporary file, but this was clunky. A better way is with git stash. But git stash reverts all files; and very often I want to keep some, especially configuration parameters.
I keep my personal configuration files in a public dotfiles repository. This means that whenever I'm on a new machine it's very easy to get comfortable in a new environment. However I find I often need machine specific configuration, so I provide ways to override them with local configuration. When I get to a new machine I'll pretty quickly want some of my usual configuration (although I don't need it). I can clone or download a zipfile of my dotfiles and then install it via some symlinks via a bootstrap bash script.
Sometimes you want a different git configuration in different contexts. For example you might want different author information, or to exclude files for only some kinds of projects, or to have a specific template for certain kinds of projects. The easiest way to do this consistently is with a includeIf statement. For example to have custom options for any git repository under a folder called apache add this to the bottom of your ~/.