Prevent rename / delete conflict while merging


I have a problem where I need to merge from master to a branch. The branch however can

  1. ignore certain files from master while merging and keep its own copy always and not in case of conflict alone)
  2. For certain files, in case of conflict master file should be taken
  3. for certain files we can ignore any rename/delete conflict.


  1. I have a partial solution that works in case of a conflict by using .gitattributes as descibed here
  2. while using .gitattributes file, with merge as ours, the 2nd problem is not solved. where i want to keep files from master. I see that in case of conflict, git resolves autoatically assuimg ours (branch) version as one to resolve conflict. Is there a way to specify ours and theirs merge driver together like below with git using the .gitattributes to resolve?
git config --global merge.ours.driver true
git config --global merge.theirs.driver true
  1. for ignoring rename/delete conflict, I could only find the generic form where all delete / rename conflicts are ignored using git command while in branch. 

    git merge -s recursive -X no-rename

Is there a way perhaps to use .gtattributes to explictly specify the files for which rename/delete can be ignored?

Sorry for asking too many questions in one go but need some direction urgently for my project.

Thanks in advance


Thanks for reaching out. We’ve asked around and can’t come up with a solution built into Git for the problems you raise. Everyone that I’ve talked to uses code review for the kinds of problems you’re still running into. I’m still asking around but I didn’t want to keep you hanging waiting thinking that nobody was looking at this.

1 Like