40ee5233eb9e9eb2afe36f702da68f6e272dbc61
[git-central.git] / client / post-checkout-rebase
1 #!/bin/bash
2
3 # The hook is given three parameters: the ref of the previous HEAD, the ref of
4 # the new HEAD (which may or may not have changed), and a flag indicating
5 # whether the checkout was a branch checkout (changing branches, flag=1) or a
6 # file checkout (retrieving a file from the index, flag=0).
7
8 branch=$(git symbolic-ref --quiet HEAD)
9 if [ $? -ne 0 ] ; then
10         exit 0
11 fi
12
13 branch=${branch/refs\/heads\//}
14 git config --list | grep "branch.${branch}.rebase" > /dev/null
15 if [ $? -ne 0 ] ; then
16         git config --add "branch.${branch}.rebase" true
17 fi
18