(欺骗声明)与pull/push from multiple remote locations无关;我不需要多个位置,只需要在内部和公共github之间进行交互。 (尾注)
我正在寻找工作流程:
git incantations将执行这三种互动?
答案 0 :(得分:3)
两台Git服务器之间的大多数管理都将在它们之间管理单独的remote
。
如果您明确了解push
和pull
,则可以定义一个非常合理的工作流程。
从公共克隆到内部github
# this will be a one-time setup
# first clone the public repo
cd /dir/where/you/want/your/repo
git clone <public github url> myRepo
cd myRepo
# create a remote to your internal Git server
git remote add internal <internal repo url>
# push to your internal repo
# (assuming you are working on the master branch)
git push internal master
# now you have effectively "cloned" the public repo
# to your internal server
将更改从公共内容拉到内部github
# assuming you are on master branch
# and _not_ taking tracking branches
# into account (since IMO they complicate matters)
git checkout master
# pull from github
git pull origin master
# push to internal
git push internal master
将更改从内部推送到公共github
git checkout master
git pull internal master
git push origin master