search

Home  >  Q&A  >  body text

开放源代码 - github,merge后我的fork自动ahead于‘主干’1commit

我从A(主干)fork的,一段时间后我的fork behind于A,然后create pull request,然后在我的fork这里merge,之后我的fork就会自动ahead于A 1 个commit。。。

有没有人遇到和我一样的github问题,,,怎么办能自然同步于A

怪我咯怪我咯2807 days ago765

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-28 09:06:59

    As long as it is not fast-forward, it will automatically merge after the pull, and each merge will generate a commit record.

    Solution:

    1. If your repo is just later than the trunk and there are no different commits, then it is fast-forward。这时候先pull. At this time, first pull to the local computer and merge it with the local content. This situation will not generate additional commit records. Then push the local code to your remote repo.

    2. If the fast-forward条件,那么需要pull --rebase到本地,并完成rebase操作。成功后再push conditions are not met, you need to pull --rebase to the local computer and complete the rebase operation. After success, push to the remote repo.

    Attachment: A piece of information on "How to ~~rebase~~ rebase": https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-04-28 09:06:59

    So you have to use rebase...

    If you do nothing on your branch, then whether it is rebase or merge, your branch will be the same as A's head, without an extra commit.
    Of course, if you change something yourself, it will never be completely synchronized, otherwise you will have to work hard with the version control system.
    But the difference between rebase and merge is that merge will create a new change at this point, while rebase just connects your change history on this branch to the history of A, without a new changelog.

    reply
    0
  • Cancelreply