简体   繁体   English

Git从原点合并分支

[英]Git merge branch from origin

I have a bunch of remote (tracking) branches that I have created local branches from (so I can write, commit and push) eg. 我有一堆远程(跟踪)分支,这些分支是从(例如,我可以编写,提交和推送)本地分支创建的。 origin/myfeature . 来源/特征 Now I would like to merge origin/myfeature into master . 现在,我想将origin / myfeature合并为master

I could do (assuming that I am currently on master): 我可以做(假设我目前是硕士):

git merge origin/myfeature

but is this guaranteed to pull latest changes (or be identical to what is in the central "truth") before performing merging? 但这是否可以保证在执行合并之前提取最新的更改(或与中央“真相”中的内容相同)?

As I understand locale remote tracking branches are not necessarily pointing to the latest remote changes on the branch. 据我了解,区域设置远程跟踪分支不一定指向分支上的最新远程更改。

You do a fetch , that gets a snapshot of the origin. 您执行fetch ,获取源的快照。 Then merge that snapshot. 然后merge该快照。 Certainly on origin it could gain some more stuff. 当然从原产地来看,它可能会得到更多的东西。

If you're concerned about that race, you can do another fetch before pushing your changes to see if it moved. 如果您担心该比赛,则可以在推送更改以查看其是否移动之前进行另一次提取。 But still someone could add another commit before or during the time you push. 但是仍然有人可以在您推送之前或期间添加另一个提交。

But before getting too excited about that, suppose you won the race. 但是在对此感到兴奋之前,假设您赢得了比赛。 But someone added a patch just after your merge. 但是有人您合并添加了补丁。 Is that different in any practical way? 在实际操作上有什么不同吗?

In DVCS it's normal that additions happen, if they do, you do another merge to pick up the new stuff. 在DVCS中,通常会发生添加,如果添加,则进行另一次合并以拾取新内容。 And races are not so interesting. 种族并不是那么有趣。

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

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