简体   繁体   English

Github提交分支和拉

[英]Github Commit Branch and Pull

Just have a quick question. 只是一个简单的问题。 I have my master and I am committing to my own branch and I had my co worker pull a fork off my master and he is committing to his own branch. 我有我的主人,我正在致力于自己的分支,我让我的同事从我的主人那里拉起叉子,他正在致力于自己的分支。

Now since I just did a final commit to my branch. 现在,由于我刚刚对分支机构进行了最后的提交。 Do I have to sync that to my master because, since my co worker forked my master and been working in his branch I need him to pull from the updates I just did on my branch 我是否必须将其同步到我的主服务器,因为自从我的同事分叉我的主服务器并在他的分支机构工作以来,我需要他从我刚刚在分支机构所做的更新中提取信息

What is the best way for him to do this? 他这样做的最好方法是什么? We are both using the GUI Github apps he is on windows I am on Mac... 我们都使用GUI Github应用程序,他在Windows上,我在Mac上...

Thanks! 谢谢! Ricky 瑞奇

I think that you can push to a seperate server branch, and then your co worker can simply pull from that branch to get your changes. 我认为您可以推送到单独的服务器分支,然后您的同事可以简单地从该分支中​​拉出以进行更改。

for example, you could do the following (done in a command window, which Mac has, and something like powerShell would work for Windows): 例如,您可以执行以下操作(在Mac拥有的命令窗口中完成,而powerShell之类的操作将在Windows中运行):

you can create a new branch and store it on the server by doing the following 您可以执行以下操作来创建一个新分支并将其存储在服务器上

git checkout -b "nameOfNewBranch"
git push origin nameOfNewBranch

then your colleague can find that branch and pull from it (using a GUI), or could run the command 那么您的同事可以找到该分支并从中拉出(使用GUI),或者可以运行命令

git pull origin nameOfNewBranch

when he/she does that, your changes will be merged to their branch. 当他/她这样做时,您的更改将合并到他们的分支中。

Hope this helps! 希望这可以帮助!

As I can't "comment", i'll answer your question here. 由于我无法“评论”,因此我将在此处回答您的问题。

No, you do not need to, if you do something like what I described above. 不,你并不需要 ,如果你做的东西像什么上述我。 In the scenario I described, you avoid pushing to master and instead push to a seperate branch which your co worker pulls from. 在我描述的场景中,您避免推送到主服务器,而是推送到您的同事从中拉出的单独分支。

However, pushing to master and having your coworker pull from that is also an acceptable option. 但是,努力掌握并让您的同事退出也是一种可接受的选择。

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

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