Friday, August 27, 2010

How to branch Git code and push to origin

#!/bin/bash
# git-create-branch
# git
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 branch_name
exit 127
fi

branch_name=$1
git push origin origin:refs/heads/${branch_name}
git fetch origin
git checkout --track -b ${branch_name} origin/${branch_name}
git pull

============================================================
Usage :

./branching.sh branch_name_desired

No comments: