github上fork repo的问题
天蓬老师
天蓬老师 2017-04-21 10:57:17
0
2
586

github上fork了一个repo,这个repo是复制了一份到我的账号里
如果原始项目的某个分支update了,我fork过来的repo会自动更新吗?

很多同学没理解我意思,是这样,fork一个project之后
git remote add upstream git_url
此时git branch -a假设输出:
master
origin/master
origin/dev
upstream/master
upstream/dev

如果运行git fetch upstream则upstream的各个分支被更新了,但我fork的分支
origin/master
origin/dev
却并没有更新,是不是更新所有origin分支都需要merge之后手动push?
如果project的branch很多,岂不非常麻烦?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
PHPzhong

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
小葫芦

First, specify the original warehouse as upstream:

git remote add upstream https://github.com/被fork的仓库.git

Execute the command mentioned above again:

git fetch upstream
    git merge upstream/master
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!