When you execute git checkout 12345, you will not have a branch state. Do not do that. This is intended to test validation, not work in it.
, reset , , , git reset 12345 ( --hard). , git checkout -b <name> <sha1> .
, , , git checkout master
, 56789, 56789, :
git reset <commit_over_56789>