Understand how git commit command
git commit equivalent to our virtual machine snapshot operation, each execution commit command is equivalent to a local warehouse to do a snapshot, then save the state of the repository,
git commit -m plus the "" parameter is equivalent to the snapshot make a remark, what this remark operation.
At the command line, how to see a snapshot of what?
Use git log command
View historical submit git log
When we do a lot in the warehouse after submission, submission inevitably need to look back at the record, take a look at the changes of their own before.
There are two Git commands can help us see the records,
git log is the most direct view command history submitted, git log can be directly used with parameters, commonly used are
the following categories:
Standard View: git log,
// Show All History to submit standard information, including information submitted by each SHA number, author, time, and notes the title [root @ CI- node1 git_test] # git log 8982c79e30d7ad590aa9e728e875bfbbfe75d64e commit // string after the hash calculation // is commit uniquely identifies Author: Wendong <wendong866 @ 163 .com> // Author commit filed a Date: Tue Jul 31 23 : 02 : 49 2018 + 0800 // time of submission b the commit // Remarks commit 1f5fb041fe61e5cf57ee836177a3a961bf854cf1 Author: wendong <wendong866@163.com> Date: Tue Jul 31 21:53:20 2018 +0800 commit a // After a string hash calculation: to ensure that each commit identity is not the same, commit the unique identification
We can see through the git log git commit history
Compact View git log - oneline
// Show All History streamline information submitted, only one line each submit information, including information SHA number and title Remarks [root @ CI-node1 git_test] # git log - oneline af5856a modify a 52e8981 rename a.txt to a cc8bd80 rename a to a.txt 73d7230 commit a
git log --oneline --decorate
This command is used to view the branch command, view the current branch in which
[root@ci-node1 git_test]# git log --oneline --decorate af5856a (HEAD -> master) modify a 52e8981 rename a.txt to a cc8bd80 rename a to a.txt 73d7230 commit a
View complete git log -p
The complete information submitted commit print, including changes in content will be printed
// Show All History to submit complete information than the standard view more specific information documents submitted changes. [root @ CI -node1 git_test] # git log - the p- commit af5856a1ebc7f2242ea0ec2a130ee90047a13531 Author: wendong <wendong866@163.com> Date: Mon Aug 26 21:12:31 2019 +0800 modify a diff --git a/a b/a index e69de29..9daeafb 100644 --- a/a +++ b/a @@ -0,0 +1 @@ +test commit 52e89813dff7c9e1261a6bdc94f284705cb8b4fb Author: wendong <wendong866@163.com> Date: Mon Aug 26 17:55:44 2019 +0800 rename a.txt to a diff --git a/a.txt b/a similarity index 100% rename from a.txt rename to a commit cc8bd8044be923aae7d44641fb99d25f574db8a5 Author: wendong <wendong866@163.com> Date: Mon Aug 26 17:49:50 2019 +0800 rename a to a.txt diff --git a/a b/a.txt similarity index 100% rename from a rename to a.txt commit 73d723093b88edda997936aa1fa7cc5ff1175e98 Author: wendong <wendong866@163.com> Date: Mon Aug 26 17:13:33 2019 +0800