How to manage a code merges on git with multiple users?

橙三吉。 提交于 2021-02-07 06:53:40

问题


Git will not let one push a branch that has a merge conflict. In our current situation, there are ~15 conflicting files, some of which are my code and some of which are other people's code. It is preferable that each person who changed code perform the merge on those particular files. How can we all work on our own files to complete the merge?

Unmerged paths:
    both modified:   foo.py        # This I should fix
    both modified:   bar.py        # This Jeff Atwood should fix
    both added:      bin/baz.py    # This Joel Spolsky should fix 
    both added:      bin/buzz.py   # This I should fix

Other than having us all sit down at the same computer, or even at the same terminal via Tmux, how can each person perform the merge on the files which are his responsibility? I know nothing about bar.py, and Jeff knows nothing about how foo.py works.


回答1:


This gist does, I believe, what you want. Basically, you merge with --no-ff --no-commit, resolve conflicts, then reset head to un-add the merged stuff, then add only the things you want.




回答2:


There is a tool here to resolve the conflicts and after resolving the conflicts you can merge that particular file. Use the command "git mergetool" to find the difference between files and choose which one to keep. Here is the documentation for this git-mergetool.

After resolving all the conflicts you can merge the branches.



来源:https://stackoverflow.com/questions/25718477/how-to-manage-a-code-merges-on-git-with-multiple-users

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!