jmou/zit
git clone https://github.com/jmou/zit.git
git clone git@github.com:jmou/zit.git
Loading…
(top)/branch
language: Shell
326 Bytes / 12 lines / 11 loc
History
View raw
#!/bin/bash -e

if [[ $# -eq 0 ]]; then # for displaying all branches
    headref=$(symbolic-ref HEAD | sed -e 's|^refs/heads/||') # get current branch
    echo "*$headref"
    cd .zit/refs/heads
    ls | grep -vxF $headref
elif [[ $1 == -d ]]; then
    rm -f .zit/refs/heads/$2
else
    update-ref refs/heads/$1 ${2-HEAD}
fi