Skip to content

Instantly share code, notes, and snippets.

@aileron
Created August 10, 2018 02:43
Show Gist options
  • Save aileron/0c2ff73e964bd8489a31d57cc5b2d3df to your computer and use it in GitHub Desktop.
Save aileron/0c2ff73e964bd8489a31d57cc5b2d3df to your computer and use it in GitHub Desktop.
git-wip
#!/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