简体   繁体   English

分叉的项目+ Git分支同步问题

[英]Forked project + Git branches syncing issues

I'm working on an open source project on GitHub and I have some issues. 我正在GitHub上的一个开源项目上工作,但遇到了一些问题。 My origin/branch is up to date with the project and when I make pull requests from it, it compares with the good branch of the project. 我的起源/分支与该项目是最新的,当我从它发出请求请求时,它与该项目的良好分支进行了比较。 That part works wonders. 这部分工作奇迹。 Where it gets confusing is here: I have created numerous branches from the same point where I started working on my remote origin project. 令人困惑的地方是:从开始从事远程源项目的那一刻起,我就创建了许多分支。 Then I made some changes and wanted to make a pull request. 然后,我进行了一些更改,并希望发出请求。

The thing is: the new branches I created are too old to be compared with the project, GitHub tells me there's over 250 commits in the pull request I'm making. 关键是:我创建的新分支太旧了,无法与该项目进行比较。GitHub告诉我,我正在执行的拉取请求中有250多个提交。 What I don't understand, since the branches (5) that I created come from the same point in time like the remote origin/branch that I'm working on, why are my branches too old ? 我不了解,因为我创建的分支(5)来自同一时间点,例如我正在处理的远程起源/分支,所以为什么我的分支太旧了?

I'm working with someone who would like(and I concur) create pull requests for only a single feature. 我正在与某人(我同意)仅针对单个功能创建拉取请求一起工作。 The idea behind the my many branches was to have the feedback as quickly as possible instead of opening one and waiting. 我的许多分支机构的想法是尽快获得反馈,而不是打开一个反馈并等待。

I tried updating my forked project using this : How to update GitHub forked repository? 我尝试使用以下方法更新分支的项目: 如何更新GitHub分支的存储库? but I haven't yet found the proper solution for my branches and how to make sure this situation does not happen to me in the future. 但是我还没有找到适合我的分支机构的正确解决方案,以及如何确保将来不会发生这种情况。

You will need rebase forked copy. 您将需要对分叉的副本进行重新设置。 This happens when your fork is out of sync with remote upstream. 当您的fork与远程上游不同步时,就会发生这种情况。 Following helped me. 以下帮助了我。

  • git checkout master git checkout主
  • git fetch upstream git上游获取
  • git checkout git checkout
  • git rebase master git rebase master
  • git log master (check if commits from remote master are appearing) git log master(检查是否显示来自远程主站的提交)
  • git push -u origin -f (You need to do force push) git push -u origin -f(您需要强制执行)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM