This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Create a new, empty branch in the current repo. |
| 4 |
# |
| 5 |
|
| 6 |
# Verify we're actually in a git repositoriy. |
| 7 |
git rev-parse --git-dir > /dev/null || exit 66 |
| 8 |
|
| 9 |
# Ensure we have a branch name. |
| 10 |
if [ $# -ne 1 ] |
| 11 |
then |
| 12 |
echo "What do you want to call this branch?" |
| 13 |
exit 64 |
| 14 |
fi |
| 15 |
|
| 16 |
refname=refs/heads/$1 |
| 17 |
|
| 18 |
# Let's not clobber an existing branch. |
| 19 |
if git rev-parse --verify -q $refname > /dev/null |
| 20 |
then |
| 21 |
echo "$refname already exists." |
| 22 |
exit 65 |
| 23 |
fi |
| 24 |
|
| 25 |
# Do the work. |
| 26 |
git symbolic-ref -m "Creating an empty branch" HEAD $refname \ |
| 27 |
|| exit $? |
| 28 |
rm .git/index || exit $? |
| 29 |
git clean -df || exit $? |