简体   繁体   中英

How to update a forked git repo?

I have forked a git repo. Is the forked repo automatically updated if the origin has updates? Or should I perform some commands in cmd to make this forked repo updated? What are this commands?

They have very specific help on this topic on the github docs: https://help.github.com/articles/fork-a-repo

Configure remotes

When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote named upstream:

git remote add upstream https://github.com/octocat/Spoon-Knife.git
# Assigns the original repo to a remote called "upstream"

git fetch upstream
# Pulls in changes not present in your local repository, 
# without modifying your files

Pull in upstream changes

If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:

git fetch upstream
# Fetches any new changes from the original repo

git merge upstream/master
# Merges any changes fetched into your working files

When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote named upstream:

As they say in this Blog Post .

Recently, I updated my forked repo following this URL . This URL explains updating the forked repo using web UI as well as terminal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM