It was bound to happen eventually; I just had a major problem as a result of a simple git mistake. I was developing add-ons to an application in one branch, and continuing bug fixing and minor improvements to the master branch. Every now and then I would merge changes from the master into the development branch, copying over the bug fixes. However at some point I must have been in the wrong branch when I merged (or I don't quite understand merging) because suddenly these new features (incomplete ones) appeared in the production version, and had removed an existing feautre. What makes it worse is that one of the bug fixes had gone live, taking with it the incomplete new functions, removing the working function and causing complaints from the client.
On realising the mistake I found that somehow my regular merges had made my repo a tangled web, and none of the commits would let me revert. After panicking, checking out, and trying to remerge about 5 different branches I eventually discovered the option to cherry-pick commits, reverted to the last master commit before the branch had been made and then went through each commit carefully to make sure I cherry-picked the right ones. So now I have a totally screwed master branch, a development branch that's going to need some checking over and a "save-my-ass" branch that seems to be the bug-fixed version of the master without any new additions.
So a) be really careful with git merging on development; some times it seemed the merge just pulled in changes, but at least once it actually combined the two branches. B) if you know git, what actions should I take now to turn the "save-my-ass" branch into my master branch, with the same history of the working commits, and ditch the corrupted master branch to avoid accidentally using it at some point?