how to checkout a branch in git code example
Example 1: how to check in which brach we are in git
git branch -a
git branch --show-current
Example 2: git checkout new branch
git checkout -b new_branch
Example 3: canging branch in git
$ git checkout <existing_branch>
$ git checkout -b <new_branch>
Example 4: git branch and checkout at the same time
$ git checkout -b <branch_name>
Example 5: git checkout to remote branch
$ git checkout --track origin/newsletter
Branch newsletter set up to track remote branch newsletter from origin.
Switched to a new branch 'newsletter'
Example 6: git checkout commit
git checkout <commit>