[Part 8] - git view the B2B2C e-commerce technology summary of spring cloud live mall submitting history

User bpcufjr 2021-09-15 10:30:53

Git View the submission history
Git Two commands are commonly used to submit history :

git log
In the use of Git After submitting several updates , Or clone a project , I want to review the history of submission , We can use  git log  Command view .

For the operation of our previous chapter , Use  git log  The command lists the submission history as follows :

git log - View history submissions .
git blame <file> - View the modification history of the specified file as a list .

​
$ git log
commit d5e9fc2c811e0ca2b2d28506ef7dc14171a207d9 (HEAD -> master)
Merge: c68142b 7774248
Author: minglisoft <test@minglisoft.cn>
Date: Fri May 3 15:55:58 2019 +0800
Merge branch 'change_site'
commit c68142b562c260c3071754623b08e2657b4c6d5b
Author: minglisoft <test@minglisoft.cn>
Date: Fri May 3 15:52:12 2019 +0800
Modify the code
commit 777424832e714cf65d3be79b50a4717aea51ab69 (change_site)
Author: minglisoft <test@minglisoft.cn>
Date: Fri May 3 15:49:26 2019 +0800
changed the minglisoft.php
commit c1501a244676ff55e7cccac1ecac0e18cbf6cb00
Author: minglisoft <test@minglisoft.cn>
Date: Fri May 3 15:35:32 2019 +0800
​

We can use --oneline Option to view a concise version of the history .

​
$ git log --oneline
$ git log --oneline
d5e9fc2 (HEAD -> master) Merge branch 'change_site'
c68142b Modify the code
7774248 (change_site) changed the minglisoft.php
c1501a2 removed test.txt、add minglisoft.php
3e92c19 add test.txt
3b58100 First version submitted 

What this tells us is that , The development history of this project .

We can still use it --graph Options , See when branches appear in history 、 Merge . Here is the same order , The topology option is turned on :

​
* d5e9fc2 (HEAD -> master) Merge branch 'change_site'
|\
| * 7774248 (change_site) changed the minglisoft.php
* | c68142b Modify the code
|/
* c1501a2 removed test.txt、add minglisoft.php
* 3e92c19 add test.txt
* 3b58100 First version submitted
​

Now we can see more clearly when the work forks 、 And when to merge .

You can also use it  --reverse  Parameter to reverse all logs .

​
$ git log --reverse --oneline
3b58100 First version submitted
3e92c19 add test.txt
c1501a2 removed test.txt、add minglisoft.php
7774248 (change_site) changed the minglisoft.php
c68142b Modify the code
d5e9fc2 (HEAD -> master) Merge branch 'change_site'
​
​
$ git log --author=Linus --oneline -5
81b50f3 Move 'builtin-*' into a 'builtin/' subdirectory
3bb7256 make "index-pack" a built-in
377d027 make "git pack-redundant" a built-in
b532581 make "git unpack-file" a built-in
112dd51 make "mktag" a built-in

If you want to specify a date , Several options can be executed :--since and --before, But you can also use --until and --after.

for example , If I want to see Git All submissions in the project three weeks ago and after April 18 , I can do this ( I also used --no-merges Option to hide merge commits ):

​
$ git log --oneline --before={3.weeks.ago} --after={2010-04-18} --no-merges
5469e2d Git 1.7.1-rc2
d43427d Documentation/remote-helpers: Fix typos and improve language
272a36b Fixup: Second argument may be any arbitrary string
b6c8d2d Documentation/remote-helpers: Add invocation section
5ce4f4e Documentation/urls: Rewrite to accomodate transport::address
00b84e9 Documentation/remote-helpers: Rewrite description
03aa87e Documentation: Describe other situations where -z affects git diff
77bc694 rebase-interactive: silence warning when no commits rewritten
636db2c t3301: add tests to use --format="%N"

more git log The command can be viewed :http://git-scm.com/docs/git-log

git blame
If you want to view the modification record of the specified file, you can use git blame command , The format is as follows :

​
git blame <file>
​

git blame The command displays modification records as a list , The following example :

​
$ git blame README
^d2097aa (tianqixin 2020-08-25 14:59:25 +0800 1) # minglisoft Git test
db9315b0 (minglisoft 2020-08-25 16:00:23 +0800 2) # Novice tutorial
​
Please bring the original link to reprint ,thank
Similar articles