1#!/bin/sh
23
. git-sh-setup-script || die "Not a git archive"
45
branchname="$1"
6case "$2" in
7'')
8head=HEAD ;;
9*)
10head="$2^0" ;;
11esac
12rev=$(git-rev-parse --revs-only --verify "$head") || exit
1314
[ -z "$branchname" ] && die "git branch: I want a branch name"
15[ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists"
1617
echo $rev > "$GIT_DIR/refs/heads/$branchname"