Skip to content

Instantly share code, notes, and snippets.

@alex-zige
Last active December 22, 2015 08:29
Show Gist options
  • Save alex-zige/6445334 to your computer and use it in GitHub Desktop.
Save alex-zige/6445334 to your computer and use it in GitHub Desktop.
put it into your ~/.bash_profile. Allow you to create Pull Request faster.
function pr () {
local repo=`git remote -v | grep "origin" | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... pushing current branch \"$branch\" in \"$repo\" to github" &&
$(git push origin $branch) &&
echo "... push succeed" &&
target_branch=$1
echo "... creating pull request for branch \"$branch\" in \"$repo\"" &&
if [[ ! -z $target_branch ]]; then
open https://github.com/$repo/pull/new/$target_branch...$branch
else
open https://github.com/$repo/pull/new/$branch
fi
}
1
export -f pr
@alex-zige
Copy link
Author

so you could do pr in your current branch

in your terminal
pr
create PR against master

pr staging
create PR against staging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment