Just do what @DrTrills suggested, run this command on your erpnext directory, i.e /frappe-bench/apps/erpnext
git config remote.upstream.fetch "+refs/heads/*:refs/remotes/upstream/*"
and then
bench switch-to-branch version-12 --upgrade
bench update --patch