When you run “git pull”, you actually put the changes into your repository. When you run “git fetch”, the reference of the changes on the remote come down to you local repository. The pull command is used to take any changes that have occurred on the remote repository, and move them into you local repository. The next command will be used to get those changes into your local repository. The main take away for the “fetch” command is to remember that you have the references of the changes from the remote branch, “origin/foo-bar” in the example, but they are not in your local repository yet. Your branch and 'origin/foo-bar' have diverged, and have 3 and 1 different commits each, respectively. In that case, you’d see a message similar to the following. You may have some commits in your local repository on the same branch that you have not yet pushed to the remote repository. The changes will come down, and you will get a message similar to the following Your branch is behind 'origin/foo-bar' by 1 commit, and can be fast-forwarded. He then tells you about the changes, and you run the command, “git fetch”. The other person working on the branch commits some changes and pushes them to the remote. You have also pushed this branch to the remote, and a friend/co-worker is also working on the branch. Let’s say you are working on a project and you are on branch “foo-bar”, which is on you local machine. This means the you will bring those changes down from the remote server, and the local repository will be aware of the changes that have occurred, but the changes will not be made to the local repository branches.
![git add remote of zip download git add remote of zip download](http://lh5.ggpht.com/-5tHr6msfZUE/TxfsjyrKHsI/AAAAAAAAAm4/Y3Xd7g_eNws/find_xdebug_binary_thumb%25255B2%25255D.png)
GIT ADD REMOTE OF ZIP DOWNLOAD UPDATE
The fetch command is used to update any references to remote branches or tags. Removing an old branch from the remote sever 4. Below is an example where the “old-branch” branch is deleted from the server that is called “origin”.
![git add remote of zip download git add remote of zip download](https://phoenixnap.com/kb/wp-content/uploads/2021/04/output-from-git-remote-v.png)
Similar to the upstream command, to delete a branch, you indicate the name of the server followed by the name of the branch. This is used to cleanup old branches on the remote that are not longer needed. The other push option you should know is the “-delete” option. When that command was run in the example, it was setting the current local branch, which was “master”, to a branch on the remote server that we set up, “origin”, to a branch we called “master”. That flag is actually short hand for “-setup-upstream”, which sets up you local branch to an associate branch on an indicated remote server. In the example above, the “-u” flag was used. There are a few options to know when using “git push”.
![git add remote of zip download git add remote of zip download](https://i.stack.imgur.com/wc6M1.png)
We used it to move a new repository to the server. The git push command will take any of your local commits, and move them to the remote repository.