How to Back Up and Restore Your Git Configuration
Your git aliases, commit signing, merge strategies, and global gitignore represent years of workflow refinement. Here's how to sync them everywhere.
What Lives in Your Git Config
Git configuration spans two key files that most developers customize over time:
~/.gitconfig— aliases, user identity, core settings, diff/merge tools~/.gitignore_global— patterns ignored across all repositories
Together these files encode your entire Git workflow. Losing them means reconfiguring your identity, rewriting aliases, and re-specifying your preferred diff tool on every new machine.
Adding Git to ConfigSync
One command captures both files:
This tracks ~/.gitconfig and ~/.gitignore_global. Push to save them, pull on any new machine to restore:
Template for Work vs Personal Email
If you use different Git identities for work and personal projects, ConfigSync templates let you set the right email based on machine tags:
Tag your work machines with configsync tag add work and your personal machines without the tag. Each pull produces the correct .gitconfig for that machine. No more accidentally pushing commits with the wrong email.
Git Aliases Worth Syncing
Aliases are the highest-value part of a Git config. Here are some of the most commonly used aliases that are worth preserving across machines:
Some developers accumulate dozens of aliases over years. Losing them and trying to remember the exact flags for lg or recent is painful. ConfigSync preserves all of them.
Global Gitignore
The global gitignore prevents OS and editor files from cluttering every repository:
Without this file synced, you end up with .DS_Store files in your commits on a new Mac until you remember to set it up again. ConfigSync makes sure it is always in place.
Syncing Global Git Hooks
Git supports a global hooks directory that applies to all repositories. This is useful for company-wide policies or personal automation:
Common global hooks include pre-commit checks for secrets or large files, commit-msg hooks that enforce formatting conventions, and post-checkout hooks that run setup scripts. All of these travel with your ConfigSync snapshot.
Putting It All Together
The complete Git sync setup takes under a minute:
Every alias, every ignore pattern, every hook, and the correct email for each machine. Your Git workflow is fully portable.
Ready to try ConfigSync?
Sync your entire dev environment across machines in minutes. Free forever for up to 3 devices.