Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 30 lines (24 sloc) 0.59 kb
#!/bin/sh
#
# Create a new, empty branch in the current repo.
#
# Verify we're actually in a git repositoriy.
git rev-parse --git-dir > /dev/null || exit 66
# Ensure we have a branch name.
if [ $# -ne 1 ]
then
echo "What do you want to call this branch?"
exit 64
fi
refname=refs/heads/$1
# Let's not clobber an existing branch.
if git rev-parse --verify -q $refname > /dev/null
then
echo "$refname already exists."
exit 65
fi
# Do the work.
git symbolic-ref -m "Creating an empty branch" HEAD $refname \
|| exit $?
rm .git/index || exit $?
git clean -df || exit $?
Jump to Line
Something went wrong with that request. Please try again.