GitHub Pull Latest Code Implementation method _ Server other

Source: Internet
Author: User
Tags using git

GitHub is now used frequently, but he often encounters the following problems

For example, a branch B was fork from a project A, and there was a change in branch B. After a few days, the code in project A should have a lot of people commit changes and now want to pull the latest code to branch B. How do I do it? Buttons that do not see the response on the GitHub interface

Solution steps:

Suppose you fork the original address of the project is Urlrep, your own is urlyou

$ git remote add upstream Urlrep
# Your local origin should be with your remote, and the current local branch is master.
$ git fetch upstream
$ git merge Upstream/master #merge可能会有冲突, hand-resolved and commit
$ git push # push on your own fork

Then submit a pull request to the original project. I don't know if you want this ... I am now updating it in this way, directly using Git's bash;

Another, git fetch upstream's role:

git fetch: Branch from remote download. git fetch upstream

A:B, download a branch under the remote warehouse upstream to local, called B-branch. If you do not take the a:b parameter, the download may be called upstream/a (if Remote is a branch), and the remote branch will pass through Git

Branch-r view. The general practice is to git fetch upstream first

Master:tmp (Downloads the remote master to the local TMP branch first, and then Git diff

TMP look at the difference between local master and TMP, no problem then git the merge tmp. This is more secure than the direct git pull upstream.

The above is GitHub pull the latest code data collation, follow-up continue to supplement the relevant information, thank you for your support of this site!

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.