Skip to content

Instantly share code, notes, and snippets.

@ludder
Last active December 27, 2015 12:29

Revisions

  1. ludder renamed this gist Nov 5, 2013. 1 changed file with 0 additions and 0 deletions.
  2. ludder created this gist Nov 5, 2013.
    25 changes: 25 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    echo "Start Git pre commit hook"

    #!/bin/sh
    # stash unstaged changes, run release task, stage release updates and restore stashed files

    NAME=$(git branch | grep '*' | sed 's/* //')

    # don't run on rebase
    if [ $NAME != '(no branch)' ]
    then
    git stash -q --keep-index
    # grunt release
    php codecept.phar run

    RETVAL=$?

    if [ $RETVAL -ne 0 ]
    then
    exit 1
    fi

    git add .
    git stash pop -q
    fi