Skip to content

Instantly share code, notes, and snippets.

@yamitake
Last active May 25, 2020 01:31
Show Gist options
  • Save yamitake/4d33c12143f281fade0fc71fe231ebd4 to your computer and use it in GitHub Desktop.
Save yamitake/4d33c12143f281fade0fc71fe231ebd4 to your computer and use it in GitHub Desktop.
git wipコマンド
#!/bin/sh
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 "$2" | sed 's/^[ \t]*//')
fi
git pull --rebase origin develop
git checkout -b $branch_name
git commit --allow-empty -m "$issue_title[ci skip][init]"
git push -u origin $branch_name
pull_request_title="Fix $issue_title"
open $(echo "$pull_request_title\n\n$issue_number" | hub pull-request --draft -F -)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment