. Fetch and pull in git

Source: Internet
Author: User

there are two commands in git to obtain the latest version from the remote branch to the local:
1. git fetch: equivalent to obtaining the latest version from a remote computer to a local computer, without automatic merge
git fetch origin master
git log-P master .. ORIGIN/Master
git merge origin/Master
meaning of the preceding commands:
first download the latest version from the master branch of the remote origin to the origin/Master branch
then compare the differences between the local master Branch and the origin/Master branch
final merge
the above process can be implemented in the following clearer ways:
git fetch origin master: TMP
git diff TMP
git merge TMP
obtain the latest version remotely to the local test branch.
comparison and merge
2. git pull: this is equivalent to obtaining the latest version from a remote machine and merge to the local machine
git pull origin master
the above command is actually equivalent to git fetch and git merge
in actual use, git fetch is safer
because we can check the update status before merge, and then decide whether to merge it

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.