Git:如何维护项目的两个分支并仅合并共享数据? [英] Git: How to maintain two branches of a project and merge only shared data?
问题描述
有些工作人员在Windows版本上工作,有些工作在MacOS版本上。他们如何防止覆盖改写到main /目录,当他们从其对手的分支合并?有没有办法在Git中合并,总是忽略依赖于操作系统的目录?
解决方案 git
,但如果将系统相关的代码放入不同的目录中并处理跨平台依赖关系,则您的生活将变得非常简单构建系统(Makefiles或任何你使用的)。或者是否有一些很好的理由让我忽略了让不同系统的代码共享一个目录?
Suppose I have two branches of a project IMClient-MacOS and IMClient-Windows, and their code only differs by (let's say) one directory main/. All the other directories contain system-independent code and are interchangeable.
Some workers work on the Windows version, and some work on the MacOS version. How do they prevent overwriting changing into the main/ directory when they merge from their counterparts' branch? Is there a way to merge in Git that will always ignore the OS-dependent directory?
You can probably solve your problem with git
, but your life will be vastly simpler if you put the system-dependent code in different directories and deal with the cross-platform dependencies in the build system (Makefiles or whatever you use). Or is there some good reason I've overlooked to have code from different systems share one directory?
这篇关于Git:如何维护项目的两个分支并仅合并共享数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!