Hacker News new | comments | show | ask | jobs | submit login

This is what I use with django+south to prevent forgetting to commit migrations:

  MIGRATIONS_DIRECTORIES="$(find -type d -iname migrations)"
  UNTRACKED_MIGRATIONS="$(git ls-files --exclude-standard --others -- $MIGRATIONS_DIRECTORIES | egrep '(.*)[.]py$')"
  
  if test -z "$UNTRACKED_MIGRATIONS"; then
      # If there are no untracked .py files in the migrations directory, do nothing, allow commit.
      true;
  else
      # If there are untracked files in the migrations directory print a warning message.
      echo "Warning -- Untracked files in the migrations directory"
      echo 'The commit may be forced with "git commit --no-verify"'
      echo 
      echo "$UNTRACKED_MIGRATIONS"
      exit 1
  fi



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: