Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# Set up tracking when pushing a new branch: git push -u origin feature/login # -u is short for --set-upstream # Set upstream for an existing branch: git branch --set-upstream-to=origin/main main # See tracking information for all branches: git branch -vv # * main abc1234 [origin/main: ahead 2] Add login page # feature/x def5678 [origin/feature/x] Work in progress # "ahead 2" — you have 2 commits not yet pushed # "behind 3" — remote has 3 commits not yet pulled # Fetch all remotes and prune deleted remote branches: git fetch --all --prune # List remote-tracking branches: git branch -r # Check out a remote branch (creates local tracking branch): git switch -c feature/x origin/feature/x # Shortcut (Git 2.23+): git switch feature/x # automatically tracks origin/feature/x
Result
Open