#!/usr/bin/env bash

# Based on scripts from git-utils:
# * https://github.com/ddollar/git-utils/blob/master/git-unwip

# Check if the last commit is a 'WIP' commit
LAST_COMMIT=`git log -1 --pretty=%B | tr -d '[:space:]'`

if [ 'WIP' != $LAST_COMMIT ]; then
  echo 'Last commit is not a WIP commit, so it will not be unWIP-ed.'
  exit 1
fi

git undo --soft
