我想獲取包含字串的最新提交。例如
String = TAG_2021_09_0051
我試過git log --grep "TAG_2021_09_0051"這給了我下面的輸出,因為字串存在于兩次提交中。但我想要最新的提交,我想從中獲取提交 ID。
commit 12345678
Author: none
Date: Fri Oct 15 21:39:56 2016 0000
@: 1234 - TAG_2021_09_0051
commit 45678965
Author: none
Date: Fri Oct 14 21:39:56 2016 0000
@: 1234 - TAG_2021_09_0051
有沒有辦法獲得包含特定字串的最新 git 提交,即使字串存在于多個提交中?
實際輸出應低于提交
commit 12345678
Author: none
Date: Fri Oct 15 21:39:56 2016 0000
@: 1234 - TAG_2021_09_0051
uj5u.com熱心網友回復:
從 git log 檔案中您需要該-n選項(https://git-scm.com/docs/git-log):
git log --grep "TAG_2021_09_0051" -n1
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/375727.html
標籤:混帐 github git提交 git-log git-rev-list
