Set the GIT status color.
Git config -- Global color. Status auto
1. Git is already in your system, and you will do something to customize your git environment. You only need to make these settings once. Even if you upgrade, they will be bound to your environment. You can also change these settings at any time by running the command.
Git has a tool called git config that allows you to get and set configuration variables. These variables can control the appearance and operations of git. These variables can be stored in three different locations:
1./etc/gitconfig file: contains values applicable to all users and libraries of the system. If you pass the parameter option '-- system' to git config, it will explicitly read and write the file.
2 .~ /. Gitconfig file: specific to your user. You can enable git to read or write this specific file by passing the -- global option.
3. the config file (that is,. Git/config) in the GIT Directory: No matter what library you are currently using, it points to this single library. Each level overrides the value of the previous level. Therefore, the value in. Git/config overwrites the same value in/etc/gitconfig.
In Windows, git searches for the. gitconfig file in the $ home directory (for most people, under c: \ Documents ents and Settings \ $ user ). It will also find/etc/gitconfig, although it is relative to the msys root directory. This may be wherever you decide to install git when running the installer in windows.
2. Your Identity (your identity)
2.1 The first thing you need to do after installing git is to set your user name and e-mail address. This is very important because this information is used every time a git commit is made. It is always embedded in your submission:
$ Git config -- global user. Name "John Doe"
$ Git config -- global user. Email johndoe@example.com
Reapply this setting. You only need to perform this setting once. If you pass the -- global option, git will always use this information to process all your operations in the system. If you want to use different names or e-mail addresses in a specific project, you can run the command in the project instead of the -- global option.
2.2. Your editor (your editor)
Now, your ID has been set. You can configure your default text editor. Git will use this text editor when you need to enter some messages. By default, git uses the default editor of your system, which may be 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 tool (your diff tool)
Another useful option you may need to configure is the default comparison tool, which is used to solve conflicts during merge. For example, if you want to use vimdiff:
$ Git config -- Global merge. Tool vimdiff
Git can use kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff as effective merge tools. You can also set up a custom tool. For more information, see Chapter 4.
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 here:
$ Git config -- list
User. Name = Scott Chacon
User. Email = schacon@gmail.com
Color. Status = auto
Color. Branch = auto
Color. Interactive = auto
Color. Diff = auto
...
You may see a keyword appears multiple times, because git uses different files (for example,/etc/gitconfig and ~ /. Gitconfig) read the same keyword. In this case, git uses the last value for each unique keyword.
You can also view the current value of a specific keyword that git deems, and use the following command git config {key }:
$ Git config user. Name
Scott Chacon
2.5 getting help)
If you need help when using git, you can obtain the help information on the manual page (manpage) of any git command in three ways:
$ Git help <verb>
$ Git <verb> -- Help
$ Man Git-<verb>
For example, you can run the following command to obtain help on the config command manual page:
$ Git help config
These commands are very friendly because 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 to use the # git or # GitHub channel (irc.freenode.net) on freenode ircserver ). These channels are regularly maintained by hundreds of professionals familiar with GIT and will be very helpful to you.
2.6 Summary)
You should have a basic understanding of what git is and how git is different from other CVCs you may use. You should also have a git version that can work with your personal identity in your system. It is time to learn some basic git knowledge.