![]() Setup your global gitignore file to avoid creating local gitignore files for each individual project.Lg = log -graph -date=relative -pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an ?)%Creset' -20 A few useful common git alias’ are listed below: You can add several alias’ by directly updating the global gitconfig file. So henceforth, you could simply type git co (instead of git checkout) to check out a branch. It comes handy when you don’t want to type the entire text of each of the Git commands.īy executing git config -global checkout in the terminal, you effectively add an alias for git checkout in your global gitconfig file. Using Alias makes your Git experience simpler, easier, and more familiar. Feel free to fork it and use it as your own global gitconfig. Diff: Allows you to specify your custom diff tool.Īs an example, you can check out this global .gitconfig file.Core: Helps you to customize core options like providing the path to your global.Credential helpers: You can setup credential helpers that would eliminate the need to even enter your password.Check out Git Prompt for having git branch information directly in your terminal. Colors: You can customize the color schemes used by default.Alias: Aliases can be used to shorten git commands and help you be more productive.User Details: You can provide your name, email to ensure that all your repositories have the same details.If you use Cygwin Git, then the file is located at C:\cygwin(64)\home\%USERPROFILE%\.gitconfig.If you use TortoiseGit, you can access the file directly from the Menu – Settings/Git/Config/Edit global. ![]() ![]() Windows Vista,7,8,10 : C:\Users\%USERPROFILE%\.gitconfig.Windows XP: C:\Documents and Settings\%USERPROFILE%\.gitconfig.For Windows based Systems, this file is located differently depending on the OS Version.For *NIX Systems, the file is located at ~/.gitconfig (i.e.Git looks for the global gitconfig file in the following locations: Where to find your global gitconfig file? For GIT v2.8 and above:Įxecute git config -list -show-origin that will list all the configurations with the corresponding filenames as shown below:įile:$HOME/.gitconfig user.global=true // global gitconfig fileįile:$HOME/.gitconfig user.override=globalįile:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.includeįile.git/config user.local=true // local gitconfig fileįile.git/config include.path=./include/relative.include To access the file, try searching for it in its usual location as described below. If the file exists already, the previous step will show you the contents of the global.gitconfig in that expected location and save it with your custom configuration. Executing git config -global -list will show you where the global gitconfig file is expected to be only when it does not exist yet.You can then update the file with your custom configurations. From the Terminal, execute git config -global -e which will open up a text editor with the contents of the file (only if it has some content already, else it would be empty).There are several ways in which you can create your global gitconfig file. If you have never set a system variable, it will not be on your file system. This file is not created until it is written to for the first time. Git does not automatically create the global. But what if you could have a global git configuration to avoid redundant tasks? That’s where global gitconfig comes in. Getting more productive needs setting up of user credentials, alias’ and other git configurations for every new project. Developers using GIT as their Source Version Control know the troubles in setting it up for new projects.
0 Comments
Leave a Reply. |