问题描述
我需要经常在dev和master之间合并。我也有一个提交,我只需要将其应用于开发,以便在本地工作。
p>之前我只从开发人员合并到master,所以我有一个分支production_changes,它包含dev特殊提交的撤消提交。并从主人,我合并了这一点。用于正常工作。
现在,每次我从开发人员合并到主开发人员,反之亦然,我必须一次又一次地樱桃挑选并应用相同的提交:( 。哪些是UGLY。
我可以采取什么策略,以便我可以在2个分支之间无缝合并,但只保留其中一个分支的某些更改? p>
我会推荐一个 。这已被用于,或者跟踪。 )
THE OP增加:
聪明的解决方案?...
那么我可以建议(重复使用冲突合并的记录分辨率:如果合并到开发器会触发冲突,如果该冲突的解决方案是您有效取消合并,则可以按顺序记录该分辨率让它在下一次合并时自动重复。
请参阅获取更多内容这个命令。
I need to merge between dev and master frequently.
I also have a commit that I need to apply to dev only, for things to work locally.
Earlier I only merged from dev to master, so I had a branch production_changes that contained the "undo commit" of the dev special commit. and from the master, I merged this. Used to work fine.
Now each time I merge from dev to master and vice versa, I am having to cherry-pick and apply the same commit again and again :(. Which is UGLY.
What strategy can I adapt so that I can seamlessly merge between 2 branches, yet retain some of the changes only on one of those branches?
I would recommend a merge driver (scripts declared in a merge directive within a .gitattributes
file) in order to prevent certain files to be affected by a given commit.
(for instance, if certain files must not be modified, that driver would be as simple as a "keep mine" merge. That has been used to merge only specific directories by example, or to track how config files are managed per branch.)
THE OP adds:
Clever solution?...
Well I can propose git rerere
(reuse recorded resolution of conflicted merge: if you merge to dev trigger a conflict, and if the resolution of that conflict is you effectively cancelling that merge, you can record that resolution, in order to have it automatically repeated during the next merge.
See Rerere Your Boat... by Scott Chacon for more in this command.
这篇关于git策略有一组提交限于特定的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!