Challenge - 5 Problems
Branch Pushing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of pushing a new branch to remote?
You created a new branch named
feature-x locally. You run git push origin feature-x. What is the expected output?Git
git push origin feature-xAttempts:
2 left
💡 Hint
Think about what happens when you push a branch that exists locally but not yet on remote.
✗ Incorrect
When you push a new branch, git uploads the commits and creates the branch on the remote. The output shows the upload progress and confirms the new branch creation.
🧠 Conceptual
intermediate1:30remaining
Why do you need to push a new branch explicitly to remote?
You created a new branch locally but your teammate cannot see it on the remote repository. Why is pushing the new branch necessary?
Attempts:
2 left
💡 Hint
Think about the difference between local and remote repositories.
✗ Incorrect
Branches exist locally until you push them. Only then do they appear on the remote repository for others to access.
❓ Troubleshoot
advanced1:30remaining
What error occurs if you try to push a branch that does not exist locally?
You run
git push origin feature-y but you never created feature-y locally. What error will git show?Git
git push origin feature-yAttempts:
2 left
💡 Hint
Check if the branch exists locally before pushing.
✗ Incorrect
Git cannot push a branch that does not exist locally, so it reports the src refspec does not match any.
🔀 Workflow
advanced2:30remaining
What is the correct sequence to create and push a new branch to remote?
Arrange the steps in the correct order to create a new branch
feature-z and push it to remote.Attempts:
2 left
💡 Hint
You must create the branch first, then add and commit changes, then push.
✗ Incorrect
First create and switch to the branch, then stage and commit changes, finally push the new branch to remote.
✅ Best Practice
expert1:30remaining
Which command safely pushes a new branch and sets upstream tracking in one step?
You want to push your new branch
feature-new to remote and set it to track the remote branch automatically. Which command achieves this?Attempts:
2 left
💡 Hint
Look for the option that sets upstream tracking.
✗ Incorrect
The
-u or --set-upstream flag sets the local branch to track the remote branch after pushing.