The last article introduced some basic Git knowledge (http://www.cnblogs.com/jerehedu/p/4582398.html), and introduced the use of GIT init to initialize the repository, using git add to add files to the repository, Use git status to view the repository's status information and use Git commit to finally commit the file to the repository. At the end of the previous commit, there was a problem causing the commit to be unsuccessful because we did not configure Git.
Git configuration
The most important configuration information for Git is the user name and email address. Each time git commits, both messages are used to identify who submitted the update.
Using the command: Git config
$ git config–global user.name "jredu"
$ git config–global user.email[email protected]
With the above two commands you can configure the user name and email information for git, note that the above two commands have "-global" parameter, which means that this configuration is global configuration, all Git projects use the above configured user name and e-mail as the user ID of commit.
If some projects do not want to use global User configuration information, we can configure this project individually, with the following commands:
$ git config user.name "jredu001"
$ git config user.email[email protected]
How to view git configuration information
After the information is configured, how do we view the GIT configuration information? This can be done in the following steps.
Using the command: Git config–list
In addition to using the above command to view, we can also view information by opening the specified configuration file. The global configuration information for git is stored in the "~/.gitconfig" file, which we can view with the following command:
$ cat ~/.gitconfig
The configuration file for a single project is placed in the ". Git/config" file in the directory where the Git project resides, as follows
By command: $ cat. git/confg
Version update operations
Once you have completed the above configuration, we can use the named completion file that was mentioned in the last article to commit, the specific command operation
So the file Readme.txt into Git version management control, at this time Readme.txt belongs to the tracked file and the status is not modified, as needed we will modify the Readme.txt file, then git will mark the status of this file as modified. We will put the modified files into staging area and will eventually be submitted. With this repetition, versioning is done, and in Git, the state of the file changes as shown:
The specific actions that are submitted after the revision of the version-controlled files are shown below:
1. Modify the Readme.txt file
2. Use git status to view status information
3. Add the modified file Readme.txt to staging area using git add
4. Commit using Git commit
deleting files
Delete files need to be removed from the list of tracked files, then commit git, action commands: Git rm
In addition to the basic usage, git RM can also be combined with some parameters to complete a more powerful function, the details of the parameters are as follows, you can test yourself.
File Rename
Sometimes we want to rename a file that has been tracked, Operation command: Git MV old_file new_file
View Submission Log
After we have submitted multiple updates, we sometimes need to look at the history commit record, which can be viewed through the git log command.
For example, using the git log command, by default git will display the update in descending order of submission time, which mainly includes the SHA-1 checksum, author, submission time, and submission instructions. The git log command combines parameters to accomplish more powerful functions, as shown in the following parameters:
Inquiries or technical exchanges, please join the official QQ Group: (452379712)
Jerry Education
Source:http://blog.csdn.net/jerehedu/
This article is the copyright of Yantai Jerry Education Technology Co., Ltd. and CSDN Common, welcome reprint, but without the author's consent must retain this paragraph statement, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.
Version control-git (ii)