简体   繁体   English

有没有办法在Git中制作分叉,然后维护或合并原始项目?

[英]is there a way to make a Forking in Git and then maintaining or merging from original project?

I want to take an open source project (A) from GitHub, fork it to my account and then make some modifications (B). 我想从GitHub获取一个开源项目(A),将其分配到我的帐户然后进行一些修改(B)。

Then after a while, there will be changes on the original (A) repository and at the same time I did changes on my repository (B) 然后过了一会儿,原始(A)存储库会有变化,同时我对我的存储库进行了更改(B)

The question is: is there a way then to maintain or merge from repo (A) to repo (B) ? 问题是:有没有办法从回购(A)到回购(B)维持或合并?

and the other question is: is a good idea? 另一个问题是:是个好主意? I know it depends on what type of changes I make to the source code, but is this a good practice, or usually when there is forking, projects go in very different ways ? 我知道这取决于我对源代码所做的更改类型,但这是一个很好的做法,或者通常在有分支时,项目的方式会有很大不同吗?

Thanks 谢谢

You can add the repository you forked from as a remote 您可以将分叉的存储库添加为远程存储库

git remote add upstream PATH_TO_REPO

Then you can just 那你就可以了

get fetch upstream
git merge upstream/BRANCH_NAME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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