Problem
When developing experimental code, I sometimes commit changes which lead to a dead end. Then I'd like to rollback to some previous revision, to start over. But I don't know how to do it best.
Example - Problem
Lets say we have the following Structure in branch A
: r1 -> r2 -> r3 -> r4 -> r5
Then I recognize, it's a dead end and want to start over from r3
.
Example - Approach
It seems to me that the following final repository structure would be ideal, but correct me if I'm wrong:
Branch A: r1 -> r2 -> r3 -> r4_new -> ...
\
Branch A_dead_end: `-> r4 -> r5
Question
What are the best practices to handle thos dead end rollbacks? Please do also correct my wording, since I didn't know what terms to search for. I'm interested in the Solution for Git and SVN.