【github】Merging an upstream repository into your fork

本文介绍如何在没有写入权限的情况下,从上游仓库拉取最新的更改到自己的分支中,并解决可能出现的合并冲突问题。


If you don't have push (write) access to an upstream repository, then you can pull commits from that repository into your own fork.

  1. Open Terminal (for Mac and Linux users) or the command prompt (for Windows users).
  2. Change the current working directory to your local project.

  3. Check out the branch you wish to merge to. Usually, you will merge into master.

    git checkout master
    
  4. Pull the desired branch from the upstream repository. This method will retain the commit history without modification.

    git pull https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git BRANCH_NAME
    
  5. If there are conflicts, resolve them. For more information, see "Resolving a merge conflict from the command line".

  6. Commit the merge.
  7. Review the changes and ensure they are satisfactory.
  8. Push the merge to your GitHub repository.
    git push origin master
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值