[Git] Git 自學筆記 : git log | git show | git diff 顯示異動內容

  • 2374
  • 0
  • Git
  • 2019-12-23

git 顯示異動

主要指令: git log
                git show 
                git diff 

git log #顯示出每個commit版本的comment及編號

D:\git\MyDotNetCore>git log
commit b707cbca42e0f302eba37f0315afed939ce5c5f9
Author: Michael Fang <yingchih.fang@gmail.com>
Date:   Sun Dec 11 09:39:21 2016 +0800

    Modify README.md

commit 5ff5242b3ee5a047664da746c6c04c625f56ac8d
Author: Michael Fang <yingchih.fang@gmail.com>
Date:   Sun Dec 11 09:35:39 2016 +0800

    override/new test

commit 09c27f1e37014d1f63f62ea8bfc2d74f2bf09474
Author: Michael Fang <yingchih.fang@gmail.com>
Date:   Mon Dec 5 06:29:44 2016 +0800

    dotnet core

git show              #顯示最新的一版的異動
git show ae9a            #顯示commit 編號為 ae9a4a287ba6e21663e74ce8b27d74db9405ba22
git show HEAD  #顯示此版的異動
git show v1.01   #顯示tag=v1.01 的異動
git show HEAD^     #顯示前一版的異動
git show HEAD^^   #顯示前二版的異動
git show HEAD~3  #顯示前三版的異動



 git reflog #列出commit清單
3046aac (HEAD -> master, tag: V1.34.12, origin/master) HEAD@{0}: commit: 1.34.12 android
108d968 HEAD@{1}: commit: 20191205-1
173ef8b HEAD@{2}: commit: 1.32.11 android


git diff --name-status SHA1 SHA2  | findstr  "檔名關鍵字"     #列出sha1,sha2的檔案異動清單,並找出檔名包含"pages"
git diff --name-status 3046 108d  | findstr "pages"    # --name-status 108d 也可

M       src/pages/application/application.html
M       src/pages/application/application.ts
M       src/pages/applicationupload/applicationupload.html
M       src/pages/basepage/basepage.ts