git config configuration file (three profiles in total)

Source: Internet
Author: User

Sets the color of the git status.

git config--global color.status auto

One. Git is already in your system, and you will do something to make your git environment more customized . You only need to do these settings once, and even if you upgrade, they will bind to your environment. You can also re-change these settings at any time by running commands.

Git has a tool called git config that allows you to get and set configuration variables that control all aspects of Git's look and operation. These variables can be stored in three different locations:

1./etc/gitconfig file: Contains values that apply to all users of the system and to all libraries.  If you pass the parameter option '--system ' to git config, it will explicitly read and write this file.

2.~/.gitconfig file: Specific to your users. You can make Git Read or write this particular file by passing the--global option.

3. config file (i.e.. git/config) in the git directory : Regardless of what library you are currently using, point to that single library. Each level overrides the value of the previous level. Therefore, the value in. git/config overrides the same value in the/etc/gitconfig.

in Windows systems,git looks for . gitconfig files in the $HOME directory (for most people, under C:\Documents and Settings\ $USER). It will also look for /etc/gitconfig, although it is relative to the Msys root directory. This could be anywhere you decide to install git when you run Setup in Windows .

Two. Your identity (Your identity)

2.1 The first thing to do when you install Git is to set your user name and e-mail address. This is important because each git commit uses that information. It is permanently embedded in your submission:

$ git config--global user.name "John Doe"

$ git config--global user.email [email protected]om

Again, you just need to do this one time setting. If you pass the --global option, git will always use that information to handle everything you do in the system. If you want to use a different name or e-mail address in a particular project , you can run the command in that project without --global the option.

2.2 Your editor (Your editor)

Now that your logo is set, you can configure your default text editor, whichgit will use when you need to enter some messages. By default,git uses your system's default editor, which is usually either VI or vim. If you want to use a different text editor, such as Emacs, you can do the following:

$ git config--global core.editor emacs

2.3 Your comparison tools (Your Diff tool)

Another useful option that you might want to configure is the default comparison tool, which is used to resolve conflicts when merging. For example, you want to use Vimdiff:

$ git config--global merge.tool vimdiff

git can accept kdiff3, Tkdiff, meld, Xxdiff, emerge, Vimdiff, Gvimdiff, Ecmerge, and Opendiff as valid merge tools. You can also set up a customized tool, and see Chapter 7 For more information on this.

2.4 Check your settings (Checking Your Settings)

If you want to check your settings, you can use the git config--list command to list all the settings that git can find there :

$ git config--list

User.name=scott Chacon

[Email protected]

Color.status=auto

Color.branch=auto

Color.interactive=auto

Color.diff=auto

...

You might see a keyword appear multiple times, because git reads the same keyword from different files (for example:/etc/gitconfig and ~/.gitconfig). In this case, Git uses the last value for each unique keyword.

You can also look at the current value of a particular keyword that git believes to be, using the following command git config {key}:

$ git config user.name

Scott Chacon

2.5 Get Assistance (Getting help)

If you need help with Git, there are three ways to get the manual page (manpage) help for any git command:

$ git help <verb>

$ git <verb>--help

$ mans git-<verb>

For example, you can run the following command to get the manual pages Help for the config command :

$ git help config

These commands are very friendly, as you can access them anywhere, even if they are not online. If the manual page and the book are still insufficient and you need personal help, you can try using the #git或#github channel (irc.freenode.net) on the freenode ircserver. These channels are regularly maintained by hundreds of professionals who are very familiar with git and will be happy to help you.

2.6 Summary (Summary)

You should have a basic understanding of what git is and how git differs from other cvcs you might use . You should also have a git version that works with your personal identity in your system . It's time to learn some basics about git.

git config configuration file (three profiles in total)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.