Perche blame
Blame risponde a "chi ha scritto questa riga e perche?".
Le basi
git blame src/checkout.js
git blame -L 40,60 src/checkout.js
Seguire codice spostato
git blame -M src/checkout.js
git blame -C src/checkout.js
git blame -CCC src/checkout.js
Ignorare commit di rumore
# .git-blame-ignore-revs
abc1234567890 # Apply prettier across codebase
def4567890123 # Apply black to all Python
git blame --ignore-revs-file=.git-blame-ignore-revs src/checkout.js
git config blame.ignoreRevsFile .git-blame-ignore-revs
Blame per contenuto
git log -S 'EMAIL_REGEX' -- src/
git log -G 'email.*regex' --pickaxe-regex -- src/
Cacciare una regressione
git blame -L 40,60 src/checkout.js
git show <sha>
git log --follow -p src/checkout.js
git bisect start
git bisect bad HEAD
git bisect good <earlier-sha>
Viste annotate negli editor
GitLens di VS Code, l'annotate integrato di JetBrains e fugitive.vim.
Reverse blame
git log --reverse --follow -p -L 40,60:src/checkout.js
Blame senza storia
git blame --line-porcelain src/checkout.js | \
sed -n 's/^author //p' | sort | uniq -c | sort -rn
Etichetta
Blame e per capire, non per puntare il dito.