Pull & Push – the remote repository

GIT not only allows local repositories but also “remote repositories”.

As you can probably already guess the “remote repository” is basically the same as the local repository but with the difference, thats its on another computer (which usually is connected via a network to your computer).

With that there are separate commands to “download” the state of the remote repository to your local repository (pull) and vice versa “upload” the state of your local repository to the remote repository (push).

Here we have a nice illustration which commands do what with the specific parts of a local and/or remote repository.

One important thing here! git push as well as git pull only update your currently active branch in the CLI, not all branches you have locally already created!

When you perform a git pull you will see when “something” changed on other branches BUT these changes to all branches are NOT APPLIED to your local files.

The reason behind that is, that git pull basically calls git fetch, which “downloads” the current state of the remote repository to you local repository AND after that performs a git merge between your currently active local branch and the corresponding remote branch.

The git fetch basically just updates the “GIT structure” how changes are safed in GIT but it does NOT apply the changes directly to any branches!

Only after a git merge between local and remote branch you will see the changes in your files as well.

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.