Git pull gets the image of the remote repository and refreshes and merges the local data git fetch+get merge

Source: Internet
Author: User
Tags root directory using git

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.