Last active
October 13, 2015 11:27
-
-
Save miry/4188341 to your computer and use it in GitHub Desktop.
Custom Zsh plugins
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
# Git | |
alias g="git" | |
# If your branch named like [issue_number]_some_description | |
gh_issue() { | |
ghissue=`echo $(current_branch) | sed -e 's/\([0-9]*\).*/\1/'` | |
if [ $ghissue ]; then | |
echo "$ghissue" | |
fi | |
} | |
# Get the orgonization from orginal url and build the hub params to send the PR | |
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 | |
branch=$(current_branch) | |
issue=$(echo $issue) | |
current_remote_with_branch=`git rev-parse --abbrev-ref --symbolic-full-name @{u}` | |
cmd="hub pull-request ${issue} -b ${organization}:master -h ${current_remote_with_branch}" | |
echo "$fg_bold[green]${cmd}$reset_color" | |
eval $cmd | |
} | |
#Pull request | |
alias gpr="pull_request" |
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
alias pp_json='ruby -e "require \"json\"; require \"yaml\"; puts JSON.parse(STDIN.read).to_yaml"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment