Now I'm in a merging state. I want to discard all changes, to back to the state that before the merging, and when I do the merge again, it says "Already up-to-date". Is there a nice way to do it?
git reset --hard head
From what I understood you want to do a merge but, for every conflict, fallback to the version in the original branch instead of the one you are merging with.
If that's the case, tou can try using
git merge -Xours <name of your other branch>
There's also the option of falling back to the other branch's conflicted changes with
For more reference, check git's advanced merging docs