0

When forking on bitbucket/github, you sometimes need to add the original repository as a remote repository so that you can pull more recent changes into your fork. I've seen, in other posts (e.g. How do I update a GitHub forked repository?), the original referred to as upstream.

Why "upstream" for the original and "origin" for the github/bitbucket-hosted fork? Are there other conventions out there we should be aware of?

I imagine this might be useful to visualize as "it is hard to swim upstream" so it's even harder to push upstream... but, well, that's an inadequate analogy.

Community
  • 1
  • 1
keflavich
  • 18,278
  • 20
  • 86
  • 118
  • I think this is because the main goal - is to collect developed and debugged code in the repository that is original for the team. So the major thing you do - is push. Just an idea... – Serge Sep 22 '12 at 22:06

2 Answers2

1

Upstream is a common term in software development (especially open source projects) to refer to the original project you depend on.

This terminology is used to express the idea of the code changes "flowing" in one direction; in the case of a project fork, from the original project to your forked copy.

As an example, Linux distributions package software for their users, sometimes applying small patches to the code. When a user finds a defect in one of those packages and reports it to the distribution's bug tracker, if the issue is too broad or it cannot be solved by the packagers, it may be marked as "upstream" to convey the idea that it should be forwarded to the original author of the software to be solved. Or, if a small correction can be applied by the distribution, it is good practice to "forward it to upstream", so that other users of the same software product may benefit from it.

Marco Leogrande
  • 8,050
  • 4
  • 30
  • 48
0

The analogy refers to the fact that the impacts of a change carry downstream, but you can't make a change propogate upstream.

There is an answer here to a similar question.

Community
  • 1
  • 1
Chogg
  • 389
  • 2
  • 19
  • Except that you can and often do get a change originally written downstream into the upstream repository. –  Sep 22 '12 at 22:09
  • @delnan ..except if there are [too many] forks in the river ;-) –  Sep 22 '12 at 22:20
  • @delnan Well, isn't that the point, that you have to make the change upstream? – Chogg Sep 22 '12 at 22:20
  • No, you don't have to do the change again. You just have to get upstream maintainers to pull it, as you probably don't have write permissions upstream. Or you simply push, if you have the permission to do so. In both case it's one of primitive operations of a DVCS, nothing special, and most importantly folliwing the DRY principle. You can get a thousand line change upstream at the click of a button. –  Sep 22 '12 at 22:56