存在两个分支: 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

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐