git 查看提交记录

git 查看提交记录

查看提交的内容

-p 选项,同时在 - 后加数字限制一下数目

git log -p -2. 

commit 500eeadd71a21f1166803e12a792bfa86f4ca784 (HEAD -> master, origin/master, origin/HEAD)
Merge: 1cb2e13 13289e4
Author: Łukasz Mróz <lukasz.mroz@droidsonroids.pl>
Date:   Wed May 24 12:15:11 2017 +0200

    Merge pull request #9 from user3587412/master

    Update example to newer reducer format

commit 13289e4ead28e24320dd85e157242b45a6b720ce
Author: Edel Sah <edelsah@me.com>
Date:   Tue May 2 03:44:05 2017 -0500

    Update to newer reducer format

diff --git a/Cartfile b/Cartfile
index 16a99cf..f43b92e 100644
--- a/Cartfile
+++ b/Cartfile

查看提交的统计情况。

git log --stat. 

commit 13289e4ead28e24320dd85e157242b45a6b720ce
Author: Edel Sah <edelsah@me.com>
Date:   Tue May 2 03:44:05 2017 -0500

    Update to newer reducer format

 Cartfile                                     |  2 +-
 Cartfile.resolved                            |  2 +-
 CounterExample/AppDelegate.swift             |  2 +-
 CounterExample/Reducers/CounterReducer.swift | 29 +++++++++++------------------
 4 files changed, 14 insertions(+), 21 deletions(-)

commit 1cb2e1328208c30dd1d28bfc5e4934a9205d1ded
Merge: 7fc44d4 fcb781b
Author: Colin Eberhardt <colin.eberhardt@gmail.com>
Date:   Thu Nov 10 06:03:12 2016 +0000

    Merge pull request #6 from juegas/master

    Update Example for Xcode 8.1 Swift 3.0.1

每次提交,只有一行

git log --pretty=oneline

500eeadd71a21f1166803e12a792bfa86f4ca784 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #9 from user3587412/master
13289e4ead28e24320dd85e157242b45a6b720ce Update to newer reducer format
1cb2e1328208c30dd1d28bfc5e4934a9205d1ded Merge pull request #6 from juegas/master
fcb781bc8fc89dac367188d79a87b490b0a2a2e3 add gif

格式化提交记录。

git log --pretty=format:"%h - %an, %ar : %s"

500eead - Łukasz Mróz, 1 year, 1 month ago : Merge pull request #9 from user3587412/master
13289e4 - Edel Sah, 1 year, 1 month ago : Update to newer reducer format
1cb2e13 - Colin Eberhardt, 1 year, 7 months ago : Merge pull request #6 from juegas/master
fcb781b - Cristiam, 1 year, 7 months ago : add gif
d3637e4 - Cristiam, 1 year, 7 months ago : update
dce6b0b - Cristiam, 1 year, 7 months ago : Xcode 8.1 Swift 3.0.1

图形化展示。

--format.

git log --pretty=format:"%h %s" --graph

*   500eead Merge pull request #9 from user3587412/master
|\
| * 13289e4 Update to newer reducer format
|/
*   1cb2e13 Merge pull request #6 from juegas/master
|\
| * fcb781b add gif
| * d3637e4 update
| * dce6b0b Xcode 8.1 Swift 3.0.1
|/
*   7fc44d4 Merge pull request #1 from kuchmiyalex/master
|\
| * 73890f5 Fixed local paths, removed unused.
|/

过滤作者.

git log  --author Cristiam --pretty=format:"%an %s"

Cristiam add gif
Cristiam update
Cristiam Xcode 8.1 Swift 3.0.1

过滤提交历史的关键字

git log --grep Xcode

commit 1cb2e1328208c30dd1d28bfc5e4934a9205d1ded
Merge: 7fc44d4 fcb781b
Author: Colin Eberhardt <colin.eberhardt@gmail.com>
Date:   Thu Nov 10 06:03:12 2016 +0000

    Merge pull request #6 from juegas/master

    Update Example for Xcode 8.1 Swift 3.0.1

commit dce6b0be6b53775f8cf45a23c8ba7d8c4be97f98
Author: Cristiam <cristiamreinoso@Cristiams-MBP.home>
Date:   Tue Nov 8 21:19:26 2016 -0500

    Xcode 8.1 Swift 3.0.1

    update example

找到改变关键字的提交

git log -S AppState -p

commit 13289e4ead28e24320dd85e157242b45a6b720ce
Author: Edel Sah <edelsah@me.com>
Date:   Tue May 2 03:44:05 2017 -0500

    Update to newer reducer format

diff --git a/CounterExample/Reducers/CounterReducer.swift b/CounterExample/Reducers/CounterReducer.swift
index 966c88d..b46ea37 100644
--- a/CounterExample/Reducers/CounterReducer.swift
+++ b/CounterExample/Reducers/CounterReducer.swift
@@ -2,25 +2,18 @@ import ReSwift

 // the reducer is responsible for evolving the application state based
 // on the actions it receives
-struct CounterReducer: Reducer {
-    typealias ReducerStateType = AppState
-
+func counterReducer(action: Action, state: AppState?) -> AppState {
+    // if no state has been provided, create the default state
+    var state = state ?? AppState()

posted on 2018-06-10 13:04  花老????  阅读(306)  评论(0)  编辑  收藏

上一篇:git mgrge命令使用


下一篇:怎样用Jenkins、Docker和CI/CD构建无服务器应用程序?