Last active
May 25, 2020 01:31
-
-
Save yamitake/4d33c12143f281fade0fc71fe231ebd4 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
#!/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