How do I update a GitHub forked repository?

前端 未结 23 2812
借酒劲吻你
借酒劲吻你 2020-11-21 11:07

I recently forked a project and applied several fixes. I then created a pull request which was then accepted.

A few days later another change was made by another con

23条回答
  •  逝去的感伤
    2020-11-21 12:02

    Actually, it is possible to create a branch in your fork from any commit of the upstream in the browser:

    • Open https://github.com//commits/, where repo is your fork, and hash is full hash of commit which you can find in the upstream web interface. For example, I can open https://github.com/max630/linux/commits/0aa0313f9d576affd7747cc3f179feb097d28990, which points to linux master as time of writing.
    • Click on the "Tree: ...." button.
    • Type name of the new branch and press Enter

    You can then fetch that branch to your local clone, and you won't have to push all that data back to GitHub when you push edits on top of that commit. Or use the web interface to change something in that branch.

    How it works (it is a guess, I don't know how exactly GitHub does it): forks share object storage and use namespaces to separate users' references. So you can access all commits through your fork, even if they did not exist by the time of forking.

提交回复
热议问题