Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

32
  • 122
    As your fork only exists on github, and github does not have tools for doing merges through the web interface, then the right answer is to do the upstream merge locally and push the changes back to your fork. Commented Jun 19, 2012 at 3:50
  • 66
    A quick note that rather than having to rebase your own master branch to ensure you are starting with clean state, you should probably work on a separate branch and make a pull request from that. This keeps your master clean for any future merges and it stops you from having to rewrite history with -f which messes up everyone that could have cloned your version. Commented May 29, 2013 at 23:09
  • 15
    Instead of the rebase command, i used the following: git merge --no-ff upstream/master This way your commits aren't on top anymore.
    – Jan Oelker
    Commented Oct 17, 2016 at 13:20
  • 30
    @jww: You ask why Git needs to be told about the original GitHub repository. It is because Git is a decentralized version control system and is not tied to GitHub in any way; it is probably obvious that Git was created before GitHub. When you create a forked repository on GitHub and clone it, GitHub knows that the repository is a fork; Git has no reason to, and does not. (Why doesn't the clone copy the Git remotes? Git is decentralized; different people will want different remotes; it would make no sense to do this.) See github.com/github/hub for GitHub integration in Git. Commented Jun 4, 2017 at 4:43
  • 9
    @Sinjai There is explicit support for these webservices. It's called the remote system. You specify the URL, and then push/pull. Speaking quite literally, I don't think it could possibly get any simpler without hardcoding support for some particular service. If Git were to have some kind of implicit understanding of the relationship between different repositories without you providing that information, it would require a centralized database. There's just no rational way to integrate this functionality into a distributed revision control system. Commented Feb 11, 2018 at 4:42