Tracking Branches
A local branch can track a remote branch. This relationship allows commands such as git pull and git push to infer the upstream branch. You can configure it explicitly with git push -u origin feature/login.
Tracking information is metadata about branch relationships; it does not copy commits by itself.
Set an Upstream Branch
git switch -c feature/login
git push -u origin feature/login
git branch -vvThe -u option establishes the remote branch as the upstream for the local branch. git branch -vv displays tracking relationships.
Key Takeaways
Upstream configuration connects a local branch with a remote-tracking branch.
git push -ucommonly establishes the relationship during the first push.
Knowledge Check
What does git push -u origin feature/login commonly configure?