[英]How can I compare the most recent commit with the previous commit?
如何將我最近的提交與先前的提交進行比較? 我想知道83a853349d91c855442c
與35ad2211a1cc7d0dbd49
之間的83a853349d91c855442c
(無需指定實際的提交sha)
$ git log
commit 83a853349d91c855442c
Author: Jagat<myemail@email.com>
Date: Thu Aug 22 11:44:27 2019 -0700
Most recent commit
commit 35ad2211a1cc7d0dbd49
Author: Jagat<myemail@email.com>
Date: Thu Aug 22 09:35:12 2019 -0700
fix compilation
您可以將裸git show
用於最近的提交。 從文檔 :
對於提交,它將顯示日志消息和文本差異。 它還以git diff-tree --cc產生的特殊格式顯示合並提交。
git diff HEAD~1 HEAD
HEAD〜1是倒數第二個提交(索引是1),而HEAD表示最近的提交狀態。
您需要兩件事:
HEAD
指向。 在您的示例中,為83a853349d91c855442c
。 <rev>^
(如果有多個父提交,請使用<rev>^<n>
指向第n
個父提交)。 在您的示例中, HEAD^
指向35ad2211a1cc7d0dbd49
。 因此:
git diff HEAD^ HEAD
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.