Push and Configure Upstream Tracking
Publish a named branch
In Bob, create a feature branch after integrating the incoming main via a fast-forward. Add a committed file. Push transfers required objects and requests an update to a remote ref; uncommitted edits are not sent. Use the explicit branch and remote names.
git merge --ff-only origin/maingit switch -c featureprintf "Rice\n" > rice.txtgit add rice.txtgit commit -m "Add rice"git push -u origin featureThe remote feature branch now exists and the local feature tracks origin/feature; remote main is not changed.
Inspect upstream
Upstream is configuration linking a local branch to another branch, typically a remote-tracking ref. Ahead and behind compare locally known tips; fetch before trusting them. Push defaults depend on configuration.
git branch -vvgit rev-parse --abbrev-ref --symbolic-full-name @{upstream}git switch mainThe upstream query on feature prints origin/feature. Switching back does not delete feature.
Practice and check
Use the Chapter 10 lab guide. Before each command predict which local or remote reference changes, then compare the observed result. Publish a branch to local remote and configure upstream.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Push and Configure Upstream Tracking — knowledge check
Check understanding of remote repository behavior.
What does push -u configure?
What is sent by a normal branch push?
Which command shows upstream and branch summary?
Does pushing feature necessarily update main?
Ahead/behind counts use what?