4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

テンプレートを使って指定したbranchに向けてコマンドラインからPull Requestを出す

Last updated at Posted at 2016-03-11

1. hubコマンドをインストール

$ brew install hub

2. templateを作成

リポジトリのrootディレクトリに置く

PULL_REQUEST_TEMPLATE.md
### Release Note

### Changes

### How to confirm

### Remarks

3. .git/configにaliasを追加

.git/config
[alias]
    pr = "!f () {\
              branch_name=$1;\
              template_path=$(git rev-parse --show-toplevel)/PULL_REQUEST_TEMPLATE.md;\ 
              if [ -z ${branch_name} ]; then\
                  branch_name='master';\
              fi;\
              hub browse -- compare/${branch_name}'...'$(git symbolic-ref --short HEAD)'?'expand=1'&'body=$(cat ${template_path} | perl -pe 'encode_utf8' | perl -pe 's/([^ 0-9a-zA-Z])/\"%\".uc(unpack(\"H2\",$1))/eg' | perl -pe 's/ /+/g');\
          };f"

4. Pull Requestを出す

$ git pr      #masterブランチに向けてpull requestを出す
$ git pr hoge #hogeブランチに向けてpull requestを出す

参考

4
6
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
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?