Created
June 27, 2013 14:00
-
-
Save chilversc/5876646 to your computer and use it in GitHub Desktop.
Lists new/removed migration scripts/directories between 2 commits in git
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
#!/bin/sh | |
DBDIR="Database/Migrations" | |
FROM="$1" | |
TO="$2" | |
function usage() { | |
echo "Usage: $0 <from-commit> [<to-commit>]" | |
echo " <from-commit>: Optional, the earlier commit, defaults to the latest tag from the current branch" | |
echo " <to-commit> : Optional, the newer commit, defaults to HEAD" | |
exit 1 | |
} | |
if [ -z "$FROM" ]; then | |
FROM=$(git rev-list --tags --max-count=1) | |
if [ -z "$FROM" ]; then | |
echo "Error: no tag found, please specify <from-commit>" | |
usage | |
fi | |
fi | |
if [ -z "$TO" ]; then | |
TO="HEAD" | |
fi | |
git diff-tree --name-status "$FROM":"$DBDIR" "$TO":"$DBDIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment