I was working off of master and made some bad commits C & D.
A --- B --- C --- D (MASTER)
So I decided to restart the work from the known good commit B because I thought it would be easier than to try and find the mistake inside the C and/or D commits. But I also wanted the option of going back to D if the new attempt didn’t work out for whatever reason. So I first created a detached HEAD pointing at B and then created a new branch (RETRY). My git repo now looks like this:
A --- B --- C --- D (MASTER)
\
\
E --- F (RETRY)
As it turns out it was easier to just restart work at B and my commit F works wonderfully. So now my question is: how do I make MASTER point to F without merging with all the work done in C and D (but still keeping the C and D commits around in case I want to refer to them in the future)? I want to end up with:
A --- B --- C --- D
\
\
E --- F (MASTER)
Will create (but not switch to) a new branch (called
old) which points to the same commit as master and then movemasterto point to the same commit asretry.