Skip to content

Instantly share code, notes, and snippets.

@ur92
Last active November 23, 2017 15:42
Show Gist options
  • Save ur92/ab133057755b439a19a4c82ee7327dd8 to your computer and use it in GitHub Desktop.
Save ur92/ab133057755b439a19a4c82ee7327dd8 to your computer and use it in GitHub Desktop.
GIT: find files with odd number of revert commits (used to validate that all merge reverts get reverted back)
#!/bin/bash
FILES="$(git ls-tree -r --name-only HEAD .)"
COUNT=0
IFS="$(printf "\n\b")"
for f in $FILES; do
NUMBER_OF_LINES=$(git log --oneline --grep=revert $f | wc -l)
let IS_ODD=$NUMBER_OF_LINES%2
if [ $IS_ODD -gt 0 ];
then
echo "$f -- $IS_ODD"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment