首页 > 解决方案 > 如何重新设置分叉的本地分支?

问题描述

我分叉了一个开源项目。然后我在本地 git 中创建了那个 fork 的副本。

当我想变基时(我不知道这是否是一个好方法,但它确实有效):

git checkout main
git fetch project-name
git reset --project-name/main (This make my local like the upstream)
git push --force-with-lease (this makes my forked like the local)

现在,说我做到了:

git checkout mybranch
git commit
git push....

我将更改推送到我的 fork 并打开了上游项目的 PR。我被要求用最新的 PR 重新设置我的 PR,main因为我的分支落后了 100 多个提交,但我不知道该怎么做。

我的问题是我现在如何可以使用 rebase或者更喜欢 rebase mybranchwith 然后 rebase with ?upstream/mainmainupstream/mainmy_branchmain

标签: gitgithub

解决方案


推荐阅读