LoginSignup
5
5

More than 5 years have passed since last update.

githubのプルリクエストをローカルリポジトリへ

Last updated at Posted at 2013-11-01

originがgithubのリポジトリだとすると、
git config --add remote.origin.fetch +refs/pull/*/head:refs/remotes/origin/pr/*
でOK.
ただ、これでgit fetch --pruneとかするとすぐ削除してしまう.
これを解決するためには.git/configを弄る。
多分、以下のような部分を

[remote "origin"]
        url = hogehoge
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

以下のように

[remote "origin"]
        url = hogehoge
        fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
        fetch = +refs/heads/*:refs/remotes/origin/*

変更すれば、OK.
具体的にはfetchのheadsより前にpullを置けばいい。

以上を勝手にやってくれるshell scriptを書いてる人がいた!!
shell script

当然ながら、これもoriginがgithub repositoryであることを前提としてる。

5
5
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
5
5