GitHub keeps saying “This branch is X commits ahead, Y commits behind”

前端 未结 3 1618
死守一世寂寞
死守一世寂寞 2020-12-12 10:22

I know there are several similar questions, but I think my situation is a little bit different.

Let\'s say there is a GitHub repository which I want to contribute to

3条回答
  •  青春惊慌失措
    2020-12-12 11:15

    Before working on an issue, I first want to synchronize my fork with the 'original' repository. I go to my account fork, click on New Pull request [...]

    If you want to update/syncronize github forks, you should not use a Pull Request.

    Pull Requests introduce merge commits, which are the source of your error message. (Pull Requests are not fast-forward by default). The merge commits exist in your fork, but not in the source repo.

    You don't want to merge their branch with your branch... you want to update your branch to point to the same commit as their branch. You want the branches between forks to be the same.

    You can do this in various ways, best explained in other answers:

    • pull/push from multiple remote locations
    • How do I update a GitHub forked repository?

提交回复
热议问题