小编Mie*_*ena的帖子

Github 如何更新分叉的仓库,与新分叉的完全一样

很多天前,我分叉了 Airflow 存储库,并进行了一些修改,然后提交了 PR。

但今天,我想提交另一个 PR,所以我需要重新 fork 最新的 Airflow 源代码,并放弃我的存储库中的所有更改。

一个笨拙的方法是删除我的存储库,然后再次分叉官方存储库。其实搜索完之后,就不用删除和fork了。

我尝试过的:

$ git remote add upstream <original-repo-url>
$ git fetch upstream                 # update local with upstream

$ git diff HEAD..upstream/master     # see diffs between local and upstream/master (if there is no diff then both are in sync)

$ git pull upstream master           # pull upstream's master into local branch
$ git push origin HEAD               # push to your forked repo's remote branch

Run Code Online (Sandbox Code Playgroud)

然而,通过这种方式,我必须git commitbefore git push origin …

git

5
推荐指数
1
解决办法
3757
查看次数

标签 统计

git ×1