0
0

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.

githubのPRのブランチを取得する

Posted at

githubのPRのブランチを取得する

何がしたいの

  • githubのupstream(fork元)のブランチではなくPRされたブランチを取得したい
    • 以下だとupstreamのブランチ一覧が取れてしまう。それではない

    • リモート登録

      git remote add upstream git@github.com:docker/docker-ce.git
      git remote add pr git@github.com:docker/docker-ce.git
      
    • こうやってPR一覧が取りたい

      git pull pr
      git branch -vv -r | sort -V | grep ' pr\/' | tail -n5
      
      pr/610/head            28ef26b589 bump ver 18.09.7-rc1
      pr/611/head            f53f261a1d bump ver 18.09.7
      pr/612/head            704d67880e bump ver 19.03.0
      pr/613/head            6c4ac5b4bf bump ver 18.09.8
      pr/614/head            64c32a4ada added entry to changelog
      
    • でも実際にはupstreamと同じでブランチが取れるだけ

      git pull pr
      git branch -vv -r | sort -V | grep ' pr\/' | tail -n5
      
      pr/18.05         f150324782 Merge pull request #527 from andrewhsu/g
      pr/18.06         a464a87eb6 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging 18.06
      pr/18.09         0dd43dd87f Merge pull request #613 from andrewhsu/1809ga
      pr/19.03         aeac9490dc Merge pull request #614 from andrewhsu/1903cl
      pr/master        93c825c44e Merge component 'engine' from git@github.com:docker/engine master
      

やり方

  • リモート登録

    • 登録
    git remote add pr git@github.com:docker/docker-ce.git
    vi ./.git/config
    
    • .git/config の変更
    [remote "pr"]
            url = git@github.com:docker/docker-ce.git
    #        fetch = +refs/heads/*:refs/remotes/pr/*
            fetch = +refs/pull/*:refs/remotes/pr/*
    
  • PRの一覧が取れるようになった

    git pull pr
    git branch -vv -r | sort -V | grep ' pr\/' | tail -n5
    
    pr/610/head            28ef26b589 bump ver 18.09.7-rc1
    pr/611/head            f53f261a1d bump ver 18.09.7
    pr/612/head            704d67880e bump ver 19.03.0
    pr/613/head            6c4ac5b4bf bump ver 18.09.8
    pr/614/head            64c32a4ada added entry to changelog
    
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?