-1

So I made some changes to some translation files in a directory (note that those changes aren't done manually, they are made by a command that updates the translation files based on a project's source code). I then stashed those changes and switched to another branch where I did a git stash pop and tried to commit those changes but got this error message:

error: Committing is not possible because you have unmerged files. I got the same output when I tried git merge

So I did a git add, which worked. I then committed and pushed the changes.

Everything is fine except some of my files now have chunks of code framed by

<<<<<<< Updated upstream
    [code]
======= 
    [code]
>>>>>>> Stashed changes

The first [code] block seems to be the state of that part of the file before the git stash pop and the second one, the state after the git stash pop.

Those lines are an issue because my files have a xml format and aren't recognised as valid by a parser with those lines in them.

I have tried git merge and git pull but both give

Already up-to-date.

as an output. How can I get safely git rid of those lines?

aydaymay
  • 1
  • 1

1 Answers1

2

So I did a git add, which worked. I then committed and pushed the changes.

This is where the error lies. git stash pop produced merge conflicts, but you resolved those by just adding the files that needed merging, along with the conflict markers in the files. Don't do that in the future - use i.e. git mergetool to fix conflicts.

You state in the question that the files are generated automatically by a script, so easiest way to remedy the situation is probably to just regenerate them & commit.

1615903
  • 32,635
  • 12
  • 70
  • 99
  • Thanks a lot! Reverting the commit then switching to the branch before updating the translation files worked for me – aydaymay Jul 12 '22 at 13:24