0

I have a fairly simple test example using revert in my repo. I created a file and five commits, adding a single new line of text to my file with each commit. I'd like to revert back to (as an example) 3rd of the five commits.

I get conflict markers in my file that I don't fully understand however, nor is it clear how I resolve those conflicts.

After calling my revert my file looks like this:

Version 1
<<<<<<< HEAD
Version 2
Version 3
Version 4
Version 5
=======
Version 2
>>>>>>> parent of 021e824... Version 3 Added

How do I interpret this?

Edit - I understand questions about this have been asked before but none of them have described how to interpret the markers. In my example above I'm trying to revert to 021e824 yet the line reading "HEAD" is two commits prior to that. Why has "Version 2" been singled out if the point I'm reverting to is after that line was added and committed?

Ben Finkel
  • 4,753
  • 7
  • 34
  • 49
  • Also here: https://stackoverflow.com/questions/7901864/git-conflict-markers – Maroun Oct 22 '19 at 15:23
  • I don't think that post actually solves your question. First, I think you should consider using merge.conflictStyle set to diff3 so that you can see the other part of a conflict.... and then let me try to explain what you see once you set it up. In the middle section you have the code as it is on the revision you want to revert and on the bottom section you have the code the way it looks before the revision you want to revert (what you see at the bottom if you choose not to use diff3). You need to see what changed **from the middle section to the bottom** and bring that change to `HEAD` – eftshift0 Oct 22 '19 at 17:46
  • Just in case: `HEAD` looks the way it is on your current revision, where you are working (that's why it's called HEAD) – eftshift0 Oct 22 '19 at 17:50

0 Answers0