LoginSignup
0
1

More than 3 years have passed since last update.

Githubでプルリクエストを送るのが面倒

Posted at

CLIとGithubの画面の操作を行き来するのが面倒だったので

簡単なシェルスクリプトで自動化して

#!/usr/bin/env bash
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 | hub issue | grep $2 | xargs)
fi

git pull origin develop
git checkout -b $branch_name
git commit --allow-empty -m "[ci skip][init] $issue_number"
git push origin $branch_name
pull_request_title="[WIP] $issue_number $issue_title"
open $(echo "$pull_request_title\n\n$issue_number" | hub pull-request -F -)

とりあえず package.json を書いて

{
  "name": "@aileron/git-wip",
  "version": "1.2.0",
  "main": "git-wip",
  "repository": "https://github.com/aileron-inc/git-wip",
  "author": "Masahiko ashizawa <masa@aileron.cc> (http://aileron.cc/)",
  "license": "MIT",
  "bin": "git-wip",
  "files": [
    "git-wip"
  ]
}

( README 書いたりとか、こまごまして

npm として登録!

yarn global add @aileron/git-wip

これで、どっからで簡単なスクリプトが入れられて便利
npm で、nodejs以外のファイルを上げてみる方法は簡単だし便利

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1