简体   繁体   English

Git“镜像”仓库

[英]Git “mirror” repo

I have a remote (GitHub) library repository that I cloned and I use it as a submodule in my Android project, however I had to change a bit the gradle file so it could build properly on my project. 我有一个克隆的远程(GitHub)库存储库,并将其用作Android项目中的子模块 ,但是我必须稍微更改gradle文件,以便它可以在我的项目中正确构建。 Now, since I don't own the repository, I wish to add it into my company repo but i want to be able to merge from the origin (Gihub) repo. 现在,由于我不拥有该存储库,因此我希望将其添加到我的公司存储库中,但我希望能够从原始(Gihub)存储库中合并。

Which is the best usual approach here ? 哪种是最好的常规方法?

Basically I want to be able to do commits and push to our company repo, but from time to time merge any changes from the original repository onto our "copy" 基本上,我希望能够提交并推送到我们的公司仓库,但有时会不时将原始存储库中的所有更改合并到我们的“副本”中

Fork the repository on GitHub. 在GitHub上分叉存储库。 Clone it locally. 在本地克隆。 Make your commits. 做出您的承诺。 When it comes time to integrate changes from the original repository, add another remote and fetch + merge. 当需要集成来自原始存储库的更改时,请添加另一个远程并获取+合并。

git clone https://github.com/your_forked_repo.git
cd your_forked_repo
# hack, hack, hack. commit.
git remote add upstream https://github.com/the_repo_you_forked_from.git
git fetch upstream
git merge upstream/master

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

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