存在两个分支: dev和dev_xxx, dev_xxx上有些文件是和用户有关的不想更改, 但是dev分支这块已经更改了, 在merge过程中如何保证这些文件保持不变.

step 1. git config --global merge.ours.driver true

git config --global -l

user.name=xxx
user.email=xxx
core.editor=vim
core.filemode=false
core.whitespace=cr-at-eol
merge.ours.driver=true

git config -l  # 显示所有config配置

step2. 在repo根目录下, 新建.gitattributes文件:

.gitlab-ci.yml merge=ours

#这样merge过程中, 就始终保持当前branch的.gitlab-ci.yml

step3. 做merge操作

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐