

Then the remote branch is called the Upstream Branch for the Tracking Branch on our local repository.Ĭonsider a scenario where we have a remote repository with three commits. We also have a Tracking Branch that tracks this Remote-Tracking Branch. Now consider that we have a Remote-Tracking branch that tracks a remote branch.In most cases, the Tracking Branch tracks the Remote-Tracking Branch. A Tracking Branch is a branch that tracks another branch.Whenever we clone a repository a remote-tracking branch is created which helps us to fetch changes from the remote repository. A Remote-Tracking Branch is a branch that tracks changes to a remote repository branch.To understand the upstream branch we first need to learn about Remote-Tracking Branches and Tracking Branches.In most cases, the upstream is a remote repository and all local repositories of the developers who are collaborating on that project are downstream.It's all relative to what the other repository is doing. Both of these terms are relative, which means there is no central upstream or downstream repository.In Git terminology, any repository that you clone from, pull from, or push to is Upstream to your repository and your local repository is Downstream to that repository.Setting Upstream Branches makes it very easy for us to connect with the remote repositories. Pushing, and pulling between these two repositories is very common. When using Git we will often have a remote repository to which people push commits and we also have our own local copy on which we are working. If happy, push the new master upstream to origin/master.Branching is an important feature of Version Control Systems like Git.If necessary, rebase the foo branch onto the updated master.

Pull any upstream changes to origin/master into the local master branch.Once the feature is ready to be merged into and pushed to origin/master.This is one of the nice benefits of having both an upstream and a pushRemote, and is the other reason why you might choose not to use origin/master as the feature branch upstream: You may not wish to be bothered by seeing newer upstream additions until it's time to merge, and origin/master would be updated if you do a general fetch from origin, whereas local master won't be updated unless you tell it to. At all times the status buffer shows me what I've added to foo since it was cut from master (being foo's upstream).My WIP on this feature is very regularly pushed to origin/foo (partly for backup purposes), using P p.Local feature branch foo has pushRemote of origin and upstream of local master (an upstream of origin/master is more dangerous if you accidentally push to upstream 1).Local master has upstream of origin/master.If you use u to specify the 'upstream' then you are defining both a remote ( branch.remote) and a branch ( rge) so there you could enter, say, origin/bar as an upstream for local branch foo.

P p on a local branch foo with a pushRemote of origin pushes it to origin/foo). Note that the remote branch for your pushRemote has the same name as the local branch, and so you are not prompted for that. If you wish to add new remotes, use the Remotes popup bound to M. It's quite common for there to only be origin, in which case that is the only valid value. When you use p to set the value of branch.pushRemote "the value has to be the name of an existing remote", and so you can only enter one of those.
