git limited file access

Please tell me how best to organize the following logic for working with the repository. I have a repository branch in which all the project files are located. Dev1 works with this branch and has full access to all files in it. I need to connect dev2 to the repository so that it has access only to files that are in several separate repository folders. To automatically combine the changes of both individual lines and the different contents of certain lines that dev1 and dev2 add to the same files during the day. For example, in the sample.html file there is a tag 

<div id="sample">
  • dev1 on its local host assigns the class “dev1”

  • dev2 on localhost assigns the class “dev2” to it
    As a result, the union of their commits should be 

Hey @alenev, to limit an individual’s access to specific files, you will want to set up Code Owners. Also, what you described below with the two dev’s working on the same line of code is commonly referred to as a merge conflict. There may be a way out there to auto-merge the conflicts together but this is usually done by dev’s manually since it requires knowledge of the code. I hope this helps!