]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-branch.sh
Merge branch 'maint'
[git.git] / git-branch.sh
index e0501ec23f5c40134af0e6211cf1ba28e69e1d5b..4f31903d63662db7d49d3d257e328004ca2958f7 100755 (executable)
@@ -112,6 +112,16 @@ rev=$(git-rev-parse --verify "$head") || exit
 git-check-ref-format "heads/$branchname" ||
        die "we do not like '$branchname' as a branch name."
 
+if [ -d "$GIT_DIR/refs/heads/$branchname" ]
+then
+       for refdir in `cd "$GIT_DIR" && \
+               find "refs/heads/$branchname" -type d | sort -r`
+       do
+               rmdir "$GIT_DIR/$refdir" || \
+                   die "Could not delete '$refdir', there may still be a ref there."
+       done
+fi
+
 if [ -e "$GIT_DIR/refs/heads/$branchname" ]
 then
        if test '' = "$force"