I'm merging one branch with another and I always have a conflict:
bicou@mba ~/AndroidStudioProjects/xxx (master) $ git status
On branch master
Your branch is ahead of 'origin/master' by 30 commits.
(use "git push" to publish your local commits)
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
modified: alpha.sh
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: app/src/main/res/values-fr/strings.xml
So apparently strings.xml
can't be merged automatically. However there are no differences: the only thing that is not merged is at the bottom of the file:
bicou@mba ~/AndroidStudioProjects/xxx (master) $ tail -5 app/src/main/res/values-fr/strings.xml
<<<<<<< HEAD
</resources>
=======
</resources>
>>>>>>> develop
Let's review both lines in hexa (whitespace, etc):
bicou@mba ~/AndroidStudioProjects/xxx (master) $ tail -5 app/src/main/res/values-fr/strings.xml | tail -2 | head -1 | xxd
00000000: 3c2f 7265 736f 7572 6365 733e 0a </resources>.
and
bicou@mba ~/AndroidStudioProjects/xxx (master) $ tail -5 app/src/main/res/values-fr/strings.xml | head -2 | tail -1 | xxd
00000000: 3c2f 7265 736f 7572 6365 733e 0a </resources>.
No difference. Why isn't git merging this automatically?
Edit: it appears it is a whitespace issue nonetheless, however I don't understand why it isn't stated in the merged file and only when manually diffing the files:
bicou@mba ~/AndroidStudioProjects/xxx (master) $ git diff develop -- app/src/main/res/values-fr/strings.xml
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 5804034..2097f87 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -96,4 +96,4 @@
<string name="fragment_min_max_set_button">Valider</string>
<string name="fragment_min_max_clear_button">Effacer</string>
<string name="drawer_name_no_account">Invité</string>
-</resources>
\ No newline at end of file
+</resources>
Note: this is not a Windows/Unix end of line issue. I don't use Windows at all, only LF. The issue may come from my editor which didn't add a new line character at the end of the file. That was the root issue.