git reflog shows how HEAD moved between commits.
git reflog
Is there a way to show only branches?
(i.e. show only one line per branch visit)
Close enough (includes also tags):
git reflog -5 --pretty='%d' | uniq