From c3e61e2851ca1c332f932874fe9c21b21e60b736 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Wed, 17 Apr 2019 02:56:58 -0400 Subject: [PATCH] branch --- branch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 branch diff --git a/branch b/branch new file mode 100755 index 0000000..d908108 --- /dev/null +++ b/branch @@ -0,0 +1,13 @@ +#!/bin/bash -e + +if [[ $# -eq 0 ]]; then + headref=$(./symbolic-ref HEAD | sed -e 's|^refs/heads/||') + echo "*$headref" + cd .zit/refs/heads + ls | grep -vxF $headref +else + branchname=$1 + startpoint=${2-HEAD} + rev=$(./rev-parse $startpoint) + ./update-ref refs/heads/$branchname $rev +fi