Created
March 9, 2016 23:52
-
-
Save divmain/144e9c18d3e5bfadd1e4 to your computer and use it in GitHub Desktop.
Find commits where `package.json` version was bumped.
This file contains 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
filename="package.json" | |
pattern=' "version": "([0-9]+\.[0-9]+\.[0-9]+).*' | |
git log --pretty="format:%H" -- package.json | { | |
while read current_hash; do | |
if [ -n "$previous_hash" ]; then | |
new_version=`git diff $previous_hash $current_hash -- $filename | sed -n -E -e "s/^\-$pattern/\1/p"` | |
if [ -n "$new_version" ]; then | |
echo version bumped to $new_version with $previous_hash | |
fi | |
fi | |
previous_hash="$current_hash" | |
done | |
new_version=`git diff $previous_hash $current_hash -- $filename | sed -n -E -e "s/^\-$pattern/\1/p"` | |
echo version bumped to $new_version with $previous_hash | |
original_version=`git show $current_hash:$filename | sed -n -E -e "s/^$pattern/\1/p"` | |
if [ -n "$original_version" ]; then | |
echo "original version was $original_version" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment