0

I am trying to make a revert, and it is saying I have unresolved conflicts. This is very strange because the conflict points to a single comment line.

<<<<<<< HEAD
// END product configuration | clong
=======
// END SVG Product Configuration | clong
>>>>>>> parent of 4cd0889... prerevert, conflicts exist

I don't think I have understood how revert works. I thought revert replaced your project, with the commit you reverted it to. How can there be a conflict if nothing is being merged?

Also, as far as this particular issue is concerned, when I leave

// END product configuration | clong

and reattempt the revert, I get the same issue.

When I leave

// END SVG product configuration | clong

I get "Unable to revert commit", which is vague and unhelpful, [UPDATE: I've found that I can revert to earlier versions, but would still like to understand what causes conflicts and errors during a revert? All I want to do is go to a certain point in my project. I know I could just download a zip of the project at that point in time, but I'd like to learn the correct, Git way to resolve this.

Goose
  • 4,764
  • 5
  • 45
  • 84

1 Answers1

1

Git is committing a reversal of your code when you ask for it. It seems that there is a conflict. Just keep that one line like you have been doing and then:

git revert --continue

This is being caused because git cannot figure out which of the two lines you want. They are on the same line, so it is odd that git is seeing a conflict there.

A better way to "visit" the past point in your repository is to use

git checkout [SHA1_Hash_of_your_commit]

If you are wanting to go back in time permanently, then use this, with caution:

git reset --hard [SHA1_Hash_of_your_commit]

If you don't know how to get the [SHA1_Hash_of_your_commit] use git log

The reason it is conflicting is that on some commits it has to perform a three way merge in the background. It goes back through your commits and finds what is similar and figures most of that out. However, it is still merging this is in and wants to know which version of the line you really want.

Sam-Graham
  • 1,254
  • 12
  • 20
  • Why is there a conflict at all? Shouldn't it overwrite the current lines with the old lines. How is a revert acting like a merge? Also, to clarify, the two lines are nearly identical, but one has the word SVG in it. – Goose Mar 05 '15 at 17:45
  • Oh, sorry, by same line I meant line number. Usually git figures this out, I will correct that in my answer – Sam-Graham Mar 05 '15 at 17:48
  • If you could explain why conflicts exist instead of simply overwriting, my question will be fully answered. – Goose Mar 05 '15 at 17:50
  • also, git merge --continue save me "error: unknown option 'continue' " – Goose Mar 05 '15 at 17:52
  • 1
    @Sam-Graham I think that you mean `revert --continue`, not `merge --continue` – Edward Thomson Mar 05 '15 at 17:54
  • This answer suggests giving the command "git merge --continue", was he mistaken or do I not understand what he meant? – Goose Mar 05 '15 at 17:58
  • @Goose I was mistaken, it should be `revert --continue`, I put `merge --continue` because there is a merge going on underneath – Sam-Graham Mar 05 '15 at 18:11
  • @Sam-Graham, I'd still like to know why there is a merge going on underneath, when I'm under the impression that it should just overwrite what exists. – Goose Mar 05 '15 at 19:07
  • It's taking your old commit that you specified and reversing the changes and making a new commit, then that commit is merged into your repository – Sam-Graham Mar 05 '15 at 19:25