如何维护一个流行项目的Github分支 [英] How to maintain a Github fork of a popular project

查看:122
本文介绍了如何维护一个流行项目的Github分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我分出了一个流行的github项目,对我的需求做了一些小的调整。但是,我想保持我的叉与主回购日期最新。我最初做的是通过github UI进行分叉,然后将我的更改直接从我的开发环境推送到此分支。我并不完全相信我应该这样做,因为我认为它使得从主repo更新变得困难。

什么是以这种方式维护分叉的推荐方法和我有什么需要改变我的当前设置?

解决方案

您可以配置到远程存储库以在git中使用。在从fork中克隆的项目中,输入以下命令: git remote add name url 其中name是表示主repo的url的别名。



为此,要从主库回收新的更新,只需输入: git pull name master 。发送更改到你的fork repo: git push origin master


I forked a popular github project to make certain minor adjustments for my needs. However I want to keep my fork up to date with the master repo. What I did initially was fork via the github ui, then pushed my changes directly to this fork from my dev env. I'm not entirely convinced I should have done this as I think it makes pulling updates from the master repo difficult.

What's the recommended method for maintaining a fork in this fashion and what do I have to change about my current setup?

解决方案

You can configure to remote repositories to use in git. In the project cloned from your fork, type the following comand: git remote add name url where name is a alias to a url that represents the master repo.

With that, to bring the new updates from the master repo, just type: git pull name master. To send the changes to your fork repo: git push origin master.

这篇关于如何维护一个流行项目的Github分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆