简体   繁体   English

在不同分支中两次竞争性承诺

[英]Git two competitive commits in different branches

I've got the situation: 我有这种情况:

  1. I was preparing fix for an issue. 我正在准备解决问题​​。
  2. I did pull request to upstream remote. 我确实将请求拉到上游遥控器。
  3. Another person was preparing fix for an issue. 另一个人正在准备解决问题​​。
  4. Another person is doing a better fix; 另一个人做得更好。 their pull request has been accepted. 他们的请求请求已被接受。
  5. My pull request is rejected. 我的请求请求被拒绝。

What is the best thing I can do now to get back my origin into remote head? 现在,我能做的最好的事情是使我的祖国回到遥远的地方?

You simply need to fetch origin, and rebase your current branch on top of it. 您只需要获取原点,然后在其顶部重新构建当前分支。
This could be enough. 这样就足够了。

git pull --rebase upstream

You might want to checkout another branch than the one you were using for your fix, though, since it doesn't make sense to reapply commits for a fix which has already been accepted (with different commits from a different pull request). 但是,您可能想签出另一个分支,而不是用于修复的分支,因为对于已经接受的修复重新提交提交没有意义(使用来自不同请求请求的不同提交)。

This assumes you have a remote repo address declared in your local repo named 'upstream', refering to the original repo you have forked. 假定您在本地存储库中声明了一个名为“上游”的远程存储库地址,该地址是指您分叉的原始存储库。
Once you have rebased your work in progress on top of the updated upstream, you can push back to origin (your fork). 在更新的上游基础上重新进行工作后,可以将其推回原点(您的叉子)。

在GitHub上分叉

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

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