Going from one branch to another consists of using the checkout command ; alternatively you can use the switch command.
Considering this timeline and that you are on main branch :
A -- B -- C -- D (feature-X)
\
(main)HEADdoing :
git checkout feature-Xdoes the following :
A -- B -- C -- D (feature-X)HEAD
\
(main)