Hook fixes and much faster commitbranch
[socialgit.git] / bin / newbranch
blob2ab35573409db665a64f6f2b3fb465cbf3f16559
1 #!/bin/sh
2 # newbranch
4 if ( git branch|grep "[^ ]$1$" ); then
5 echo "This branch already exists locally."
6 exit -1
7 fi
9 if ( git branch -r |grep "[^ ]origin/$1$" ); then
10 echo "This branch already exists remotely."
11 exit -1
14 # Change to master, stashing any dirty working copy files
15 changebranch master
17 # Create the new branch, pull in any existing commits for it from the central server
18 git branch $1
19 changebranch $1
21 # Look for hooks
22 HOOK_POST_CREATE_BRANCH=./`git rev-parse --show-cdup`.socialgit/hooks/post-create-branch
23 $(ls $HOOK_POST_CREATE_BRANCH 2>/dev/null) && $HOOK_POST_CREATE_BRANCH
25 commitbranch