How to avoid git conflicts in a team?

前端 未结 8 2238
情歌与酒
情歌与酒 2020-12-12 13:17

We are some developers who work on same project and we use git for the project. If two or more of us happen to work on same file, we receive git conflicts which are hard to

8条回答
  •  无人及你
    2020-12-12 14:10

    There is only one way to avoid conflicts: don't have different people edit the same file at the same time. Essentially each file has an owner who is responsible for all edits and who can pass ownership to another. Ownership for a file can be passed around based on a particular feature/branch or day-to-day as long as the ownership is clear.

    If you find that you can't give one owner to each file then:

    • you need to split your files into smaller files that can be assigned to one owner
    • absolutely require that GIT conflicts get resolved (with all editors sitting together to resolve the individual conflicts).
    • Use a good multi-merge tool to visualize and then resolve the conflicts.

提交回复
热议问题