summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rwxr-xr-xgit-branch-script11
2 files changed, 13 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 03ea163..93479ae 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,8 @@ SCRIPTS=git git-apply-patch-script git-merge-one-file-script git-prune-script \
git-log-script git-shortlog git-cvsimport-script git-diff-script \
git-reset-script git-add-script git-checkout-script git-clone-script \
gitk git-cherry git-rebase-script git-relink-script git-repack-script \
- git-format-patch-script git-sh-setup-script git-push-script
+ git-format-patch-script git-sh-setup-script git-push-script \
+ git-branch-script
PROG= git-update-cache git-diff-files git-init-db git-write-tree \
git-read-tree git-commit-tree git-cat-file git-fsck-cache \
diff --git a/git-branch-script b/git-branch-script
new file mode 100755
index 0000000..ade0abf
--- /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"