Skip to content

Instantly share code, notes, and snippets.

@aprescott
Last active December 17, 2015 22:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aprescott/5683945 to your computer and use it in GitHub Desktop.
Save aprescott/5683945 to your computer and use it in GitHub Desktop.
An attempt at showing only git commits where a single character has been changed.
# an attempt at showing only commits where a single character has been changed.
#
# lots of false positives.
git rev-list --all --no-merges |
while read commit; do
files_changed=$(git diff $commit^ $commit --name-only | wc -l)
diffcontent="$(git diff --numstat --minimal -U0 --word-diff=porcelain --word-diff-regex=. $commit^ $commit | grep -e '^\+.$')"
if [ $files_changed -eq 1 ] && [ $(echo "$diffcontent" | wc -l) -eq 1 ] && [ ! -z "$diffcontent" ]; then
echo $commit
echo "$(git diff --minimal $commit^ $commit)"
echo -----
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment