Git/suuid/: New commits
[sunny256-utils.git] / git-eb
blob232b4e1020a474ad22aa61d97e72e8fa8bd84a3b
1 #!/bin/sh
3 # git-eb
4 # File ID: 45c7afa2-434a-11df-8880-90e6ba3022ac
6 # Create new and unconnected branch
7 # usage: git eb <newbranch>
9 logmsg="Initial empty commit"
10 test -z "$2" || logmsg="$2"
11 [ -z "$1" ] && { echo "usage: git eb <newbranch>" >&2; exit 1; }
12 [ -d ".git/." ] || { echo "git-eb: has to be executed from the top level of the tree" >&2; exit 1; }
13 [ -e ".git/refs/heads/$1" ] && { echo "git-eb: ref \"$1\" already exists" >&2; exit 1; }
14 git symbolic-ref HEAD refs/heads/"$1"
15 rm -f .git/index
16 git commit --allow-empty -m "$logmsg`echo; echo; suuid -t commit,git-eb -c "$logmsg"`"