1 min read

git blame ignore

Table of Contents

看到同事 push 了一個檔案,檔名叫作 .git-blame-ignore-revs,內容只有 commit hash 而已,像是這樣:

# changed tabs to space
a926bba49c89a5b882cd298be3af2570b1e6252c

查了一下原來可以忽略某些 commit 的 blame 資訊,通常使用在單純改變 coding style,或是單純 format 檔案格式的 commit 上,上面這個檔案設定好之後,還要記得設定 .git/config 才會生效:

[blame]
    ignoreRevsFile = .git-blame-ignore-revs

如果檔名使用 .git-blame-ignore-rev 時,在 GitHub 也有支援

參考資料