Ignoring Codeowners

My team’s repo consists of a Master, UAT, and several release branches based from master.  CODEOWNERS would differ for {master, uat} and the release branches.  After creating a release branch, codeowners is modified to the correct users and commited.  Now, when a pull request is made to merge with master, a merge conflict occurs with that file because of the modified owners list.  How can I avoid this?

I want to maintain distinct levels of code ownership.  The first will apply to the master and UAT branch.  The second would apply to all release branches.

I thought I could include a reference to CODEOWNERS in .gitignore and add the file.  That doesn’t solve the problem.  It looks like adding CODEOWNERS to the branch places the file under version control, but I liken it to a configuration or metadata file.  

Thanks,

Orlanzo

1 Like

@orlanzo wrote:

My team’s repo consists of a Master, UAT, and several release branches based from master.  CODEOWNERS would differ for {master, uat} and the release branches.  After creating a release branch, codeowners is modified to the correct users and commited.  Now, when a pull request is made to merge with master, a merge conflict occurs with that file because of the modified owners list.  How can I avoid this?

@orlanzo - That’s a really interesting question! Before jumping to any conclusions, I have some more questions that would help me get a better understanding of your report.

  • For that example pull request, could you confirm that master is the base branch and that release branch containing the updated CODEOWNERS file is the head branch?
  • Is the intent to update master's code owners whenever a new release branch wants to introduce new changes there?
  • Could you share more details around what that particular “merge conflict” looks like in this context? Are you unable to merge the release branch into master via the GitHub.com user interface such that merging is blocked, or did you mean something else? An example pull request in a public repository would help us get a better idea of what kind of conflict you’re seeing.

In general, each CODEOWNERS file assigns the code owners for a single branch in the repository (GitHub Help: About code owners) .

Given the example repository with three branches––master, UAT, and release–– the respective code owner per branch’s specified files would need to explicitly approve the changes in the pull request before any changes can be committed to that branch.

Hello,
We have different branches like Dev, uat, prod and we have put the code owners file in all the branches with different code owners for each branch. When we tried to update the code owners for a particular branch because the code owner has left the project. We tried to update the code owner through pull request in github.com repo. We are getting the merge conflict on the codeonwers file github. Could you please suggest what can we do to fix this?

Thanks