0%

git-fork

1. 同步 fork 的代码

1
2
3
4
5
6
7
8
# 指定一个上游仓库
# upstream为你自己为同步源取的别名
git remote add upstream ${git-url-fork-by}
git fetch upstream/${branch_id}
# --no-commit 防止 fast-forward 后直接 commit
git merge upstream/${branch_id} --no-commit
# 如果文件有差异, 可以checkout fork 分支上的文件
git checkout upstream/${branch_id} ${file_path}