Hint: Push new branch to origin, not upstream [OK]
Common Mistakes:
Using upstream instead of origin for push
Pushing main branch instead of feature branch
Using incorrect remote name like fork
3. After forking a repo and pushing a branch fix-bug to your fork, what is the next step to propose your changes to the original project?
medium
A. Directly push fix-bug branch to the original repository
B. Create a pull request from your fork's fix-bug branch to the original repo
C. Merge fix-bug branch locally without pushing
D. Delete your fork and clone the original repo again
Solution
Step 1: Understand the pull request purpose
A pull request asks the original project to review and merge your changes from your fork's branch.
Step 2: Identify the correct action after pushing
After pushing your branch to your fork, you create a pull request targeting the original repository's branch.
Final Answer:
Create a pull request from your fork's fix-bug branch to the original repo -> Option B
Quick Check:
Push branch then create pull request [OK]
Hint: Push branch, then open pull request to original repo [OK]
Common Mistakes:
Trying to push directly to original repo without permission
Merging locally without sharing changes
Deleting fork before proposing changes
4. You forked a repo and created a branch update-docs. You pushed it but forgot to sync your fork with the original repo first. What problem might occur when creating a pull request?
medium
A. Merge conflicts due to outdated fork base
B. Your pull request will be automatically merged
C. Your branch will be deleted automatically
D. No changes will be visible in the pull request
Solution
Step 1: Understand syncing forks
If your fork is behind the original repo, your branch may not include recent changes from the original.
Step 2: Identify the pull request impact
This can cause merge conflicts when the original repo tries to merge your changes because the base is outdated.
Final Answer:
Merge conflicts due to outdated fork base -> Option A
Quick Check:
Outdated fork causes merge conflicts [OK]
Hint: Always sync fork before starting new branch [OK]
Common Mistakes:
Assuming pull request merges automatically
Thinking branch deletes itself
Believing changes won't show without sync
5. You forked a project and created two branches: featureA and featureB. You pushed both branches to your fork. How do you create pull requests so the original repo can review and merge these features independently?
hard
A. Create separate pull requests for each branch targeting the original repo's main branch
B. Create one pull request combining both branches
C. Push both branches to upstream and wait for automatic merge
D. Merge featureB into featureA locally, then create a single pull request
Solution
Step 1: Understand pull request scope
Each pull request represents changes from one branch to the original repo, allowing independent review.
Step 2: Apply to multiple branches
To keep features separate, create one pull request per branch targeting the original repo's main branch.
Final Answer:
Create separate pull requests for each branch targeting the original repo's main branch -> Option A
Quick Check:
One pull request per branch for independent review [OK]
Hint: Make one pull request per branch for clear reviews [OK]