Git:如何维护项目的两个分支并仅合并共享数据? [英] Git: How to maintain two branches of a project and merge only shared data?

查看:445
本文介绍了Git:如何维护项目的两个分支并仅合并共享数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个项目IMClient-MacOS和IMClient-Windows的两个分支,它们的代码只有一个目录main /。所有其他目录包含与系统无关的代码,并且可以互换。



有些工作人员在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屋!

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