Skip to content

Instantly share code, notes, and snippets.

@renra
Created September 29, 2016 08:40
Show Gist options
  • Save renra/b853f65761504e88a4e2bbb900282616 to your computer and use it in GitHub Desktop.
Save renra/b853f65761504e88a4e2bbb900282616 to your computer and use it in GitHub Desktop.
#! /bin/bash
git=/usr/local/bin/git
current_branch=`git name-rev --name-only HEAD`
if [ -z "$1" ]; then
branch=$current_branch
else
branch=$1
fi
if [ $current_branch = $branch ]; then
$git checkout master
fi
$git branch -D $branch
$git push origin :$branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment