我在 github 上有一个公开的存储库,在那里我有一个正在开发的开源应用程序,用于制作产品目录和小型 cms 内容。
我还有一个私有存储库(未托管在 github 中),它是在 github 中托管的开源应用程序下开发的应用程序。
由于我目前正在开发这两个应用程序,因此在开源应用程序中添加了功能,并在私有应用程序中进行了更改,例如更改模板以及从开源应用程序中提取代码。
我想知道是否有任何方法可以从开源中提取新内容,同时将新应用程序的代码推送到另一个存储库。
I have one repo in github which is public, there I have an Open source application i'm working on that is for making product catalogs, and small cms content.
I also have a private repository (not hosted in github) which is an application developed under the open source application hosted in github.
Since I'm currently working on both applications, adding features in the open source one and also making changes in the private one like changing the template and also pulling the code from the open source one.
I was wondering if there is any way in which I could pull the new stuff from the open source one but also pushing the code of the new application to the other repo.
发布评论
评论(3)
设置与拉取 URL 不同的远程推送 URL:
这会更改
remote.name.pushurl
配置设置。然后git pull
将从原始克隆 URL 拉取,但git Push
将从原始克隆 URL 推送到另一个。在旧的 Git 版本中,
git remote set-url
没有--push
开关。如果没有它,您必须通过手动更改配置设置来完成此操作:Set a push URL for the remote that is different from the pull URL:
This changes the
remote.name.pushurl
configuration setting. Thengit pull
will pull from the original clone URL butgit push
will push to the other.In old Git versions,
git remote set-url
did not have the--push
switch. Without it, you have to do this by changing the configuration setting manually:git pull private master
和git push github master
从您的私有存储库中拉取(假设它是这样命名的)并推送到 github(也可能称为origin)。这不是 SVN ;-)
git pull private master
andgit push github master
pulls from your private repo (given it's named like that) and pushes to github (might also be calledorigin
). It's not SVN ;-)当然!
只需进入 .git 文件夹并打开配置文件,然后对其进行编辑,如下所示:
之后,您可以根据需要运行以下命令:
of course!
Just get in .git folder and open config file, then edit it, as bellow:
after this, you can run the following commands as you wish: