Git Config (GO)

Source: Internet
Author: User

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:
No matter what library you are currently using, specific points 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, the C:\Documents and Settings\ user name or c:\Users\ user name).
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]
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, which git 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 the 7th chapter for more information about 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 or #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.
http://blog.csdn.net/joe_007/article/details/7276195

Git Config (GO)

Related Article

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.