How does git merge updates from other remote databases?

Source: Internet
Author: User

In fork projects on GitHub, we often encounter updates to the main project. How can we merge the updates to our fork version? Today, someone suddenly asked me this question. I will write it here.
The following uses Ruby-China  For example, if I am a user @ tualatrix,
And I have a ruby-China fork version in Here  At this time, my local version is Tualatrix/ruby-China  This

 # Let me get the tualatrix fork version locally ~ /Work $ git clone git: // github.com/tualatrix/ruby-china.git ~ /Work $ CD ruby-China ~ /Work/ruby-China 
  
    $ git remoteorigin # Add huacnlee (that is, the remote address of the main project )~ /Work/ruby-China 
   
     $ git remote add huacnlee git: // github.com/huacnlee/ruby-china.git# use the FETCH Command to obtain all the branches of huacnlee ~ /Work/ruby-China 
    
      $ git fetch huacnleeremote: counting objects: 499, done. remote: compressing objects: 100% (143/143), done. remote: Total 315 (delta 211), reused 253 (delta 172) Processing ing objects: 100% (315/315), 190.17 kib | 92 kib/s, done. resolving deltas: 100% (211/211), completed with 72 local objects. from git: // github.com/huacnlee/ruby-china * [new branch] Master-> huacnlee/master # Set H The changes to the master branch of uacnlee are merged ~ /Work/ruby-China 
     
       $ git merge huacnlee/Master 
     
    
   
  

git remote update updates all remote repositories to ensure consistency. For example, there are two remote repositories: Origin and Korg. After git remote update, the two are consistent and all branches are consistent.

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.