-
-
Save miry/3727331 to your computer and use it in GitHub Desktop.
Zsh function to get issue number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current_branch() { | |
git_branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` | |
if [ $git_branch ]; then | |
echo "$git_branch" | |
fi | |
} | |
gitissue() { | |
github_issue=`echo $(current_branch) | sed -e 's/\([0-9]*\).*/\1/'` | |
if [ $github_issue ]; then | |
echo "$github_issue" | |
fi | |
} | |
pull_request() { | |
local organization | |
if [ ! $1 ]; then | |
organization=`git config --get remote.origin.url | sed "s/^[^:]*:\([^\/]*\)\/.*/\1/"` | |
else | |
organization=$1 | |
fi | |
echo "hub pull-request -i $(gitissue) -b $organization:master -h $organization:$(current_branch)" | |
`hub pull-request -i $(gitissue) -b $organization:master -h $organization:$(current_branch)` | |
} | |
alias pr="pull_request" | |
alias prj="pull_request jetthoughts" | |
alias prbb="pull_request bigbinnary" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
than I use to send pull request to github:
hub pull-request -i $(gitissue) -b bigbinary:master -h bigbinary:$(gitbranch)