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