I work on an android project with my colleague where we have a strings.xml file for a strings in our app. So every time when we put new strings at the end of the file together we run into conflict while merging. I though it was supposed that git can automatically distinguish if those were new lines or changes. How can i resolve this? For note that we are using Ubuntu
答案 0 :(得分:1)
I've encountered same thing in my project also. It's very logical for git to give a conflict on such scenarios as there are non empty lines present after the concerned change set. One thing that we follow for all such files is that we try to add a method/function or a tag somewhere in between the file and not at the end of it. Then the change line becomes different and conflict doesn't come.
答案 1 :(得分:0)
It sounds like you're working on a project with 1 other person (or at least on a small team). If you're just adding to an XML file, the order wouldn't matter so you could maybe by convention that you add new XML lines at the top and have them add their new lines at the bottom.
The merge conflict is the correct outcome because you're trying to add new data at the same lines with different values, but if you're adding your new data at a different place, then there wouldn't be a conflict and it would automatically add both of your lines.