First, I have seen the answer to this question here before, but it is buried by so many "answers" which don't answer my question properly, that I cannot find it again.
So here it goes: How do I restore in Git to a previous version in my history, so that it becomes the new commit on top of my current history?
Basically, this is the most fundamental thing I would like to do with a version control system. Simply doing a reset doesn't work, because it throws away my history, a simple revert doesn't work either, because sometimes it gives me error messages (what I want to do should be possible without any error messages).
If I just do a git revert this error happens:
git revert HEAD~1 error: could not revert f1b44e3... Towards translating API to kernel. hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit'
git revertmeans "back out one single, specific commit", not "go back to a previous version". Mercurial's name for this operation is better:hg backout. Mercurial has anhg revertwith the meaning you expected here! Meanwhile Dai's answer is correct.