有时候review社区改动较大的PR时,在github上看不太方便,需要把相应的pr,apply到本地,记录下常用的方式
方式一
如果相差不远,或者和master没有冲突,直接
git remote add ${upstream_name} https://github.com/xxx/flink.git
git pull ${upstream_name}
# range pick ^.. 表示包含start commit
git cherry-pick start^..end
# 删除remote
git remote remove ${upstream_name}
方式二
生成patch文件 apply
E.g., from:
https://github.com/php/php-src/pull/296
To:
https://github.com/php/php-src/pull/296.patch
curl https://patch-diff.githubusercontent.com/raw/apache/flink/pull/12345.patch -o 12345.patch
git apply 12345.patch