Skip to content

Instantly share code, notes, and snippets.

@chilversc
Created June 27, 2013 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chilversc/5876646 to your computer and use it in GitHub Desktop.
Save chilversc/5876646 to your computer and use it in GitHub Desktop.
Lists new/removed migration scripts/directories between 2 commits in git
#!/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