Skip to content

Instantly share code, notes, and snippets.

@n3bulous
Created September 19, 2009 20:16
Show Gist options
  • Save n3bulous/189564 to your computer and use it in GitHub Desktop.
Save n3bulous/189564 to your computer and use it in GitHub Desktop.
#!/bin/env bash
# git-create-branch <branch_name>
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 -b ${branch_name} origin/${branch_name}
echo "[remote \"${branch_name}-origin\"]" >> .git/config
echo " url = git@192.168.10.200:bobcat.git" >> .git/config
echo " fetch = +refs/heads/*:refs/remotes/origin/*" >> .git/config
echo " push = ${branch_name}:${branch_name}" >> .git/config
echo "" >> .git/config
echo "[branch \"${branch_name}\"]" >> .git/config
echo " remote = ${branch_name}-origin" >> .git/config
echo " merge = refs/heads/${branch_name}" >> .git/config
git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment