#!/bin/sh # $1 = previous hash # $2 = new hash (could be the same) # $3 = flag (0=retreiving from index, 1=new checkout) branch=$(git symbolic-ref --quiet HEAD) if [[ $? -ne 0 ]] ; then exit 0 fi branch=${branch/refs\/heads\//} rebase=$(git config "branch.${branch}.rebase") if [ $? -ne 0 ] ; then git config "branch.${branch}.rebase" "true" fi merge=$(git config "branch.${branch}.merge") remote=$(git config "branch.${branch}.remote") if [ "$branch" != "stable" -a "$remote" == "origin" -a "$merge" == "refs/heads/stable" ] ; then git config "branch.${branch}.merge" "refs/heads/${branch}" fi exit 0