Last active
November 23, 2017 15:42
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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