Added to github plugin function to send pull requests from current branch. added alias and added rule to ignore idea files.

This commit is contained in:
Michael Nikitochkin 2012-09-15 18:09:58 +03:00
commit e0d4e48bda
2 changed files with 29 additions and 0 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ custom/*
*.swp
!custom/example.zshcache
cache/
.idea

View file

@ -66,5 +66,33 @@ exist_gh() { # [DIRECTORY]
git push -u origin master
}
# If your branch named like [issue_number]_some_description
gh_issue() {
local ghissue
ghissue=`echo $(current_branch) | sed -e 's/\([0-9]*\).*/\1/'`
if [ $ghissue ]; then
echo "$ghissue"
fi
}
pull_request() {
local organization
if [ $1 ]; then
organization=$1
else
organization=$( git config --get remote.origin.url | sed "s/^[^:]*:\([^\/]*\)\/.*/\1/" )
fi
if [ $(gh_issue) ]; then
issue="-i $(gh_issue)"
else
issue=""
fi
echo "hub pull-request $issue -b $organization:master -h $organization:$(current_branch)"
hub pull-request $issue -b $organization:master -h $organization:$(current_branch)
}
# End Functions #############################################################
alias gpr="pull_request"