I\'m not that experienced with Git and now I have a big problem falling into my lap.
Here\'s how my current branch look like:
feature /---F1-----F2
So to clarify, what you want is this, right?
feature /---F1-----F2
/
master -----M0-----M1-----M2
\
bugfix \--B1-----B2
Make sure that the HEADs feature and bugfix are still on F2 and B2 respectively.
Edit: if feature and bugfix are no branches, make them branches (stash your work if it is uncommited):
git checkout F2
git branch feature
git checkout B2
git branch bugfix
Edit end
Then reset the master to M2:
git checkout master
git reset M2 --hard
(reset will make you lose your local changes, stash them if you don't want that.)
M3 and M4 are not destroyed right away, but will be eventually. They should not show up in git log or gitk.
Then it's time to merge feature and make a M3' that is correct.