I'm confused how this even happens. You switch to dev and then choose to keep working on your ticket, but your previous work isn't there, so how do you keep progressing? I can see this as an edge case, but it happens to you often enough that a pre commit hook is useful to stop it?
To be clear, I don't care what you do, if it works, it works, I just am having a difficult time understanding how this particular scenario happened enough that a pre commit hook was the best way to solve it.