Create a gist now

Instantly share code, notes, and snippets.

Post Commit hook to automatically push to origin/branch
# A hook script that is called after a successful
# commit is made.
# Place this file in .git/hooks and chmod +x
BRANCH=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
git push origin $BRANCH

Rather, try

BRANCH=$(git rev-parse --symbolic --abbrev-ref $(git symbolic-ref HEAD))


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment