本篇內容主要講解“git log中有哪些format”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“git log中有哪些format”吧!
默認git log 出來的格式并不是特別直觀,很多時候想要更簡便的輸出更多或者更少的信息,這里列出幾個git log的format。 可以根據自己的需要定制。
git log命令可一接受一個--pretty選項,來確定輸出的格式.
比如 :
如果我們只想輸出hash.
git log --pretty=format:"%h"
詳細 命令 :
'%H': commit hash
'%h': abbreviated commit hash
'%T': tree hash
'%t': abbreviated tree hash
'%P': parent hashes
'%p': abbreviated parent hashes
'%an': author name
'%aN': author name (respecting .mailmap, see git-shortlog or git-blame)
'%ae': author email
'%aE': author email (respecting .mailmap, see git-shortlog or git-blame)
'%ad': author date (format respects --date= option)
'%aD': author date, RFC2822 style
'%ar': author date, relative
'%at': author date, UNIX timestamp
'%ai': author date, ISO 8601-like format
'%aI': author date, strict ISO 8601 format
'%cn': committer name
'%cN': committer name (respecting .mailmap, see git-shortlog or git-blame)
'%ce': committer email
'%cE': committer email (respecting .mailmap, see git-shortlog or git-blame)
'%cd': committer date (format respects --date= option)
'%cD': committer date, RFC2822 style
'%cr': committer date, relative
'%ct': committer date, UNIX timestamp
'%ci': committer date, ISO 8601-like format
'%cI': committer date, strict ISO 8601 format
'%d': ref names, like the --decorate option of git-log
'%D': ref names without the " (", ")" wrapping.
'%e': encoding
'%s': subject
'%f': sanitized subject line, suitable for a filename
'%b': body
'%B': raw body (unwrapped subject and body)
'%N': commit notes
'%GG': raw verification message from GPG for a signed commit
到此,相信大家對“git log中有哪些format”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。