Working mostly as a C# developer, I usually spent my day on Windows. To easily replicate my default Git configuration across all the computer I work with, I created a tiny GitHub repository.
I’m a very bad typist. Every time I type a Git command on the Bash shell, I need at least two attempts to get on the command line what I want.
Fortunately there are Bash aliases, Git aliases and auto-correction; so now the only think I have to take care while typing are branch names :)
To easily move my environment from a PC to another, I created a GitHub repository to clone: GitEnvironment.
As you probably know, Git configuration has three different layers: system, user, and repository; cloning this repository you will obtain a default per-user configuration.
In Windows, the user configuration files are stored in C:\Users\<Username> folder, so the trick is to clone the repository in that folder:
$ git clone https://github.com/jesuswasrasta/GitEnvironment C:\Users\Nando
At this point you will get there these files:
- Bash profile files
- .bash_profile, for Windows 7 and previous
- .bashrc for Windows 8
- Git config files
- .gitconfig file
With Bash configuration files I was able to define an alias for the git command, considering that I type “gti” instead of “git” for 90% of times… You can then enrich your Bash profile wit other aliases and other configurations you like.
There are two different Bash configuration file because I discovered that in Windows 7 configurations are loaded form .bash_profile, while in Windows 8 the they are loaded from .bashrc; the content of files is the same.
Adopting a common per-user Git configuration instead, I’m able to replicate my aliases on all my Git boxes; the .gitconfig-vs2013 file is just a copy of the default .gitconfig file, where I set to use the diff and merge tools included in Visual Studio.
Feel free to fork my repository, make me pull requests and adjust your fork to fit your needs :)