Summary: When you use GIT for project development, you need to communicate with the remote server. One of the most frequently used places is getting stored objects from a remote repository. We know that git pull equals the result of git fetch and git merge. So where is the object that git fetch gets? Where does git fetch get objects from? Why does the obtained object and the file under the current directory have no conflicts like overwrite? What is the workflow of git merge? This article is mainly for you to answer these questions.
This article source: Git pull get the remote repository of the image and refresh, merge local data git fetch+get merge
http://blog.csdn.net/trochiluses/article/details/14522383
one, git getch
1. Introduction to Commands
Git-fetch-download objects and refs from another repository
2. Commands use Syntax
git fetch [<options>] [<repository> [<refspec> ...]
git fetch [<options>] <group>
git fetch--multiple [<options>] [(<repository> | <group>) ...]
git fetch--all [<options>]
3. Command Description
The fetch location is stored in the git root directory. Git/fetch_head, of course, when we use commands such as GIT fetch origin, these fetch locations can be found in. git/config. In general, after we use git fetch, we need to merge this content with our original changes using git merge.
second, git pull
Let's say that when we use git pull, the branches on the local branch and the server are as follows:
A---B---C master on Origin
/
D---E---F---G master
Then, using GIT pull will fetch the part of the remote server and then merge with the local to create the following scenario:
A---B---C remotes/origin/master
/ \
D---E---F---G---H master