I have a requirement to create a file in git, which should automatically assign the separate code reviewers based on the branch.
- I tried by adding separate codeowners file to each branch (dev,master,uat and release). So that when i open a pull request, codeowners file will automatically assign the reviewers based on the mentioned code owner in the Branch. ex: for Dev branch i want code owner to be “@A”
- Master ------> “@B”,
- uat----------> “@C” and
- release------> “@D”
It is actually working, But When i open a pull request and merge from Dev–> Master it is overriding the codeowner with “A” in the Master Branch
I’ve tried keeping codeowners file in the .gitignore file. In this case it is not recognizing the codeowner file itself.
I’ve also tried one of stackoverflow answer .gitattributes , But it is still overwriting the file in other branch.
How can we achieve this in GIT?
Is there any other option like where we can create a single file in git and differentiate the codeowner based on the branches, so that it will automatically assign reviewers when we open the pull request?? Anything helps.