Skip to content

Instantly share code, notes, and snippets.

@tsabat
Last active March 31, 2016 20:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsabat/3eb1d2b44eccf71097bc to your computer and use it in GitHub Desktop.
Save tsabat/3eb1d2b44eccf71097bc to your computer and use it in GitHub Desktop.
function delete_current_branch () {
CURR_BRANCH=`git rev-parse --abbrev-ref HEAD`
echo $CURR_BRANCH
if [[ "$CURR_BRANCH" == 'master' ]]; then
echo 'can not delete master branch'
exit 1
fi
git checkout master
git branch -D $CURR_BRANCH
}
# http://www.devthought.com/code/create-a-github-pull-request-from-the-terminal/
function pr () {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment