Skip to content

Instantly share code, notes, and snippets.

@mukund-murali
Created December 13, 2018 05:22
Show Gist options
  • Save mukund-murali/bc9dd3c0c3f0f0cc3b4b48ca053abcc4 to your computer and use it in GitHub Desktop.
Save mukund-murali/bc9dd3c0c3f0f0cc3b4b48ca053abcc4 to your computer and use it in GitHub Desktop.
Deletes a branch if master has it's changes
if [ -z $1 ]; then echo "Specify branch name"; exit; fi
git checkout master
git pull origin master
git checkout $1
git merge master
git checkout master
out=`git diff master $1`
if [ -z "$out" ]; then
git branch -D $1
else
echo 'Diff not empty'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment