diff options
Diffstat (limited to 'git-branch-script')
-rwxr-xr-x | git-branch-script | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/git-branch-script b/git-branch-script new file mode 100755 index 0000000000..ade0abf069 --- /dev/null +++ b/git-branch-script @@ -0,0 +1,11 @@ +#!/bin/sh + +. git-sh-setup-script || die "Not a git archive" + +branchname="$1" +rev=$(git-rev-parse --verify --default HEAD "$2"^0) || exit + +[ -z "$branchname" ] && die "git branch: I want a branch name" +[ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists" + +echo $rev > "$GIT_DIR/refs/heads/$branchname" |