Sunday 4 October 2015

What is “upstream” and “downstream”

Question

I've started playing with Git and have come across the terms "upstream" and "downstream". I've seen these before but never understand them fully. What do these terms mean in the context of SCMs and source code?

Answer (Simple)

In terms of source control, you're "downstream" when you copy (clone, checkout, etc) from a repository. Information flowed "downstream" to you.

When you make changes, you usually want to send them back "upstream" so they make it into that repository so that everyone pulling from the same source is working with all the same changes. This is mostly a social issue of how everyone can coordinate their work rather than a technical requirement of source control. You want to get your changes into the main project so you're not tracking divergent lines of development.

Answer (Git)

There are two different contexts for upstream/downstream in git: remotes, and time/history. Upstream/downstream with respect to remotes is, the downstream repo will be pulling from the upstream repo (changes will flow downstream naturally). Upstream/downstream with respect to time/history can be confusing, because upstream in time means downstream in history, and vice-versa (genealogy terminology works much better here - parent/ancestor/child/descendant).

No comments:

Post a Comment