Managing multiple Git Identities

If you want to use a different email address between your company repo and your GitHub repo, this configuration will ask you to set your name/email before the first commit.

First, make sure there is are no global username or email set.

1
2
git config --global --unset user.name
git config --global --unset user.email

user.useConfigOnly prevents commits without setting username or email first.

1
git config --global user.useConfigOnly true

Alternative you could configure identities based on filesystem path. How to use multiple GPG identities

Migrating code style without breaking git blame

You can tell git blame to ignore your formatting commits.

Create a .git-blame-ignore-revs containing the commit identifiers, for example:

1
2
# Migrate code style
5b4ab991dede475d393e9d69ec388fd6bd949699

and configure it with git config blame.ignoreRevsFile .git-blame-ignore-revs. more