问题描述
我为 github.com/checkstyle/checkstyle/issues/4365rel =nofollow noreferrer>这个问题,过了一段时间后,主存储库更新了新的可接受的PR,而我的fork位于主存储库后面。
因此,现在我尝试我的Forked Repositoy,但这不是问题的终结,我必须同步我的或登录主存储库。
如何将我的分叉存储库时间线/日志与主存储库同步。
这是预期的,因为你已经拉(取+ > merge )
我建议你在本地删除合并提交,并在<$ c $之上重新绑定(即重放提交) c>上游/主账户(使用 code>。
请确保您没有进行任何本地工作。
cd / path / to / local / repo
git remote add upstream< Repository URL>
检查 git remote -v :您应该看到上游和原点,原点引用您的分支。
git log#确保master HEAD在正确的地方提交
git fetch upstream
git rebase upstream / master
#test if if everything仍在工作
git push --force
I created a PR for this issue, after a while the main repository is updated with new accepted PRs and my fork is behind the main repository.
So now I tried to synchronize my Forked Repositoy, but that's not the end of the problem I have to sync my commits or log with the main repository.
How do I synchronize my forked repository time-line/logs with the main repository.
That is expected, since you have pulled (fetch+merge)
I would advise you to locally remove to remove that merge commit, and rebase (ie replay your commits) on top of upstream/master (with upstream being the remote name for the original repo)
Plus, I would have isolated those changes in a dedicated branch, but since you have started the PR from master, let's stay on master.
Make sure you don't have any local work in progress.
cd /path/to/local/repo git remote add upstream <Repository URL>
Check the output of git remote -v: you should see upstream and origin, with origin referencing your fork.
git log # make sure master HEAD is at the right commit git fetch upstream git rebase upstream/master # test if everything is still working git push --force
这篇关于如何在不创建新提交的情况下同步分叉的存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!