0

When rebasing my branch, merge conflicts insert themselves like this in my code occasionally. Does anyone know where this issue might be coming from? I was thinking it could be potentially that I accidentally committed some Merge conflict decorators but wasn't sure.

Usually what I do is select use incoming changes but it's not presented at these lines.

enter image description here

pythonNovice
  • 1,130
  • 1
  • 14
  • 36

1 Answers1

2

You probably have trailing whitespace. Here is an example of the conflict in Atom editor, but it shows the whitespace.

enter image description here

In the first conflict, HEAD added ~~~~ and feature added spaces.

In the second conflict, HEAD added horizontal tabs and feature added spaces. It's also possible one has Unix style newlines and one has Windows style.

I'd recommend these changes to avoid this problem in the future.

  1. Configure VSCode to show invisible characters.
  2. Configure VSCode to strip trailing whitespace.
  3. Add an EditorConfig. When working on your project all supported editors are automatically configured to strip trailing whitespace, and use the same indentation method, newlines, and character encoding.
Schwern
  • 153,029
  • 25
  • 195
  • 336