Git:如何保持永久并行分支 [英] Git: how to maintain permanent parallel branches

查看:219
本文介绍了Git:如何保持永久并行分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有项目(PHP应用程序),但每个客户端的安装有所不同,有时很少,有时甚至更多。尽管如此,源代码的很大一部分是很常见的。我们将特定安装作为并行分支管理到主分支,我们需要将更改从主分支转移到其他分支。相同的情况在 Git:如何维持(大部分)并行分支只有几个区别?最受赞赏的解决方案是通过这种方式在分支之间传输更改:

  git pull 
git checkout local
git rebase master

正如解决方案中提到的那样,它会在重新绑定后创建非快进按钮,非常不愉快的并发症。我的问题是 - 为什么不这样做:

  git pull 
git checkout local
git merge master


解决方案

这真的取决于您想要做什么科。是的,如果你在本地进行重组,它会在重新绑定后创建非快进。另一方面,你会保持一系列明显的变化,你的分支上的变化将会是一系列变化,如果他们已经变成了最新的掌门人。



将主人合并到地方,相反,将保持当地人与主人及时向前行进,并将记录发生的历史记录。如果你需要能够重建过去的本地状态,那么你会想做到这一点。历史将永远不会改变。但是,你会有更复杂的历史来处理。


We have project (PHP application), but instalation for each client vary, sometimes very little, sometimes more. Still, big part of source code is common. We manage specific installations as parallel branches to master branch and we need to transfer changes from master to other branches. Same situation was solved in Git: how maintain (mostly) parallel branches with only a few difference? The most voted solution was to transfer changes between braches this way:

git pull
git checkout local
git rebase master

As mentioned in the solution it creates non-fast-forward pushes after rebasing which I find very unpleasant complication. My QUESTION is - why not to do instead:

git pull
git checkout local
git merge master

解决方案

It really depends on what you want to do with the branch. Yes, if you rebase local, it'll create non-fast-forward pushes after rebasing. On the other hand, you'll be maintaining a set of distinct changes going forward and what's on your branch will be a set of changes AS IF THEY HAD BEEN MADE TO THE NEWEST HEAD OF MASTER.

Merging the master to local, instead, will keep local marching forward in time with master, and will record the history as it happened. If you need to be able to reconstruct the state of local in the past, then you'll want to do this. The history will never change. But, you'll have a more complicated history to deal with.

这篇关于Git:如何保持永久并行分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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