check remote tracking branch git code example

Example 1: how to check upstream git

$ git branch -vv
  main   aaf02f0 [main/master: ahead 25] Some other commit
* master add0a03 [jdsumsion/master] Some commit

Example 2: git track remote branch

$ git checkout --track origin/dev
Branch dev set up to track remote branch dev from origin.
Switched to a new branch 'dev'

Example 3: git track remote branch

# Set upstream when pushing to remote
git push -u origin topic

# Set upstream without pushing it
# with option -u / --set-upstream-to
git branch -u origin/topic
git branch --set-upstream-to=origin/topic

Example 4: check upstream branch git

git status -sb

Tags:

C Example