Recall & Review
beginner
What command do you use to push a new local branch to a remote repository?
Use
git push -u origin <branch-name> to push a new local branch to the remote repository and set it to track the remote branch.Click to reveal answer
beginner
What does the
-u flag do when pushing a new branch?The
-u flag sets the upstream (tracking) reference, so future git push and git pull commands know which remote branch to interact with by default.Click to reveal answer
intermediate
How can you check which remote branches your local branches are tracking?
Run
git branch -vv to see local branches with their tracking remote branches and last commit info.Click to reveal answer
beginner
If you create a new branch locally but forget to push it, what happens when you run
git push?Git will not push the new branch because it has no upstream set. You must push it explicitly with
git push -u origin <branch-name> the first time.Click to reveal answer
beginner
Why is it important to push new branches to the remote repository?
Pushing new branches shares your work with others and backs up your changes. It also allows collaboration and code review on that branch.
Click to reveal answer
Which command pushes a new branch named 'feature' to the remote and sets it to track?
✗ Incorrect
The correct syntax is
git push -u origin feature to push and set upstream tracking.What does 'origin' usually refer to in git commands?
✗ Incorrect
'origin' is the default name git gives to the remote repository you cloned from.
If you run
git push without -u on a new branch, what happens?✗ Incorrect
Without upstream set, git does not know where to push the new branch, so push fails.
How do you see which remote branch your local branch is tracking?
✗ Incorrect
git branch -vv shows local branches with their tracking remote branches.Why might you want to push a new branch to remote early?
✗ Incorrect
Pushing early shares your work and allows teammates to review or contribute.
Explain the steps and command to push a new local branch to a remote repository and set it to track the remote branch.
Think about how to share your new work with others using git.
You got /3 concepts.
Describe what happens if you try to push a new branch without setting upstream tracking and how to fix it.
Remember the role of the -u flag.
You got /3 concepts.