我从A(主干)fork的,一段时间后我的fork behind于A,然后create pull request,然后在我的fork这里merge,之后我的fork就会自动ahead于A 1 个commit。。。
有没有人遇到和我一样的github问题,,,怎么办能自然同步于A
黄舟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:
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.
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
过去多啦不再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.