GIT update remote repository code to local method git fetch

Source: Internet
Author: User

Convenient for future reference. Thank the original blogger for sharing.

When we develop a project on more than one computer, we need to constantly modify the submission and update the latest remote code on another computer, see how to get updates from the remote code warehouse to the local, summed up the article on the Internet, using the following way is relatively simple.

Viewing remote branches

Use the following command to view the remote repository (I have a origin warehouse here)

1 2 3 $ git remote-v origin git@github.com:username/animations. Git (Fetch) Origin git@github.com:username/animations. git (push)

get the latest version from remote to local

Use the following command to create a new temp branch locally and download the master Branch code of the remote Origin warehouse to the local temp branch

1 2 3 4 5 6 7 8 $ GIT fetch origin master:temp remote:counting objects:18, done. Remote:compressing objects:100% (6/6), done. Remote:total (Delta 3), reused 0 (Delta 0) unpacking objects:100% (11/11), done. From Github.com:username/animations * [New branch] Master, temp c07bdc7. 40f902d Master--Origin/master

Compare the local warehouse with the downloaded temp branch

Use the following command to compare the differences between the local code and the code just downloaded from the remote:

1 2 3

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.