In git documentation says fetch doesnt merge with your working tree. So lets say I have these branches: master, jhonny and miguel. Let’s say master is for the last production code release.
--------------------------------------------master
\-----------------------miguel
\---------------------------jhonny
Miguel and I have tracking of all branches in our local repo. Lets say Miguel commit and push his brach to the github repo. I want to have the miguel push localy. If I do fetch, what will happen? Does fetch just updates the remote repo reference? Origin in this case.
Vote down if you think this is duplicated. But I couldnt find the answer Im looking for yet.
Regards.
Yes,
git fetchonly updates the local copy of the remote repo (i.e. the remote reference) – it doesn’t then merge those updates into the local branch the waygit pulldoes.In this sense,
git fetchis quite ‘safe’ as there are no merge issues and all of your local branches remain untouched. For a more detailed discussion, see: What is the difference between 'git pull' and 'git fetch'?If after a
git fetchyou do want to merge the remote changes with the local branch, you then need to run agit merge. This is in effect whatgit pulldoes.