Global Git Parameters

There are a couple of files that git uses to do its thing. The two main ones are the .gitconfig to configure the git client, the other is the .gitignore file that is uses to determine which files get included in the repository and which do not. If you do not want to recreate these files each time, or want to change any global values you can always edit the global files directly.

For .gitignore the file is in the users base folder, in my case C:\Users\Robert, so the file is C:\Users\Robert\.gitignore. For *nix users the file will be ~/.gitignore. Since I often use Visual Studio as we as VS Code, I have added entries for folders and file specific to those programs. So I do not have to edit the .gitignore for each project, I have added the exceptions to my global file.

Likewise, any global config options I have added to my C:\Users\Robert\.gitconfig file. I can go into there to add any global aliases for example. Of course there are ways to add these things from the command prompt, such as git config –global alias.ci commit, to alias the commit command, I would have to do this each time I used another machine. By being able to copy files around, I can have a consistent experience.

No Comments

Add a Comment