I have resolved the conflict on my branch in the wrong way. Now I would like to go back to the commit where it was showing a conflict. I tried reverting but it is asking me to resolve the conflict.
2 Answers
The command git revert will make a new commit with the reverse content. So each line you have added will be removed on this new commit, and vice-versa.
If you wanna drop some commits of your history, you need to use the command "reset". It will delete your revert commit, and turn your repository back to the same status before.
Use "git log", to see the commit id before the revert (when your repository was ok):
git log
Use "git reset" to delete all the commits after your selected commit id
git reset --hard
Git reset will not remove new files. If you have it, will be necessary delete them manualy.
Comments
You didn't explain what you did that generated this conflict. Let's say, though, that it was a merge. Then you need to use git log to find out the SHA number of the commit before the merge commit that was created by that merge. Then you say git reset --hard <SHA> with that SHA number.
This will undo everything, including the merge, to the point before you did the merge.
Now ask for the merge again, and this time, when the conflict happens, resolve it correctly.
Note, however, that you just follow those instructions, you will lose everything you have done since the merge, and you will lose it forever. If that is not acceptable, then you need to take more elaborate action.
git revertdoes:git revertmeans to back out some specific (possibly historical) commit. Think of it as meaning "back out" or "undo". To revert to a commit, there are several possibilities (as in answers so far).