Skip to content

Instantly share code, notes, and snippets.

@rabellamy
Forked from ianmariano/git-close-branch
Created January 11, 2014 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rabellamy/8375280 to your computer and use it in GitHub Desktop.
Save rabellamy/8375280 to your computer and use it in GitHub Desktop.
#!/bin/bash
usage() {
echo "Usage $0 branchname"
exit 1
}
if [ -z "$1" ]; then
usage
fi
if ! git diff --quiet; then
echo "You have uncommitted changes."
exit 1
fi
git checkout master
git push origin :$1
git branch -D $1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment