Created
August 10, 2018 02:43
-
-
Save aileron/0c2ff73e964bd8489a31d57cc5b2d3df to your computer and use it in GitHub Desktop.
git-wip
This file contains hidden or 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
#!/usr/bin/env zsh | |
if [ $# -eq 0 ]; then | |
echo "Usage:" | |
echo "git wip (branch-name) (issue-number)" | |
exit 2 | |
fi | |
issue_number='' | |
issue_title='' | |
branch_name=$1 | |
if [ $# -eq 2 ]; then | |
branch_name="$2_$1" | |
issue_number="#$2" | |
issue_title=$(hub issue | grep "$issue_number" | sed -e 's/^[ ]*//g') | |
else | |
issue_title="$branch_name" | |
fi | |
hub_payload_test=$(echo -e "[WIP]$issue_title\n\n$issue_number") | |
echo $hub_payload_test | |
git checkout -b $branch_name | |
git commit --allow-empty -m "[ci skip][init] $issue_number" | |
git push origin $branch_name | |
open $(echo $hub_payload_test | hub pull-request -F -) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment