Skip to content

Instantly share code, notes, and snippets.

@miry
Created September 15, 2012 10:50
Show Gist options
  • Save miry/3727331 to your computer and use it in GitHub Desktop.
Save miry/3727331 to your computer and use it in GitHub Desktop.
Zsh function to get issue number
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"
@miry
Copy link
Author

miry commented Sep 15, 2012

than I use to send pull request to github: hub pull-request -i $(gitissue) -b bigbinary:master -h bigbinary:$(gitbranch)

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