Bird
0
0

You want to collaborate on a project with a teammate who has a remote named upstream. How do you get their latest changes into your local main branch?

hard📝 Workflow Q8 of 15
Git - Remote Repositories
You want to collaborate on a project with a teammate who has a remote named upstream. How do you get their latest changes into your local main branch?
Agit clone upstream main
Bgit push upstream main
Cgit fetch upstream && git merge upstream/main
Dgit remote add upstream && git pull origin main
Step-by-Step Solution
Solution:
  1. Step 1: Fetch changes from the teammate's remote

    Use 'git fetch upstream' to download their latest commits without merging.
  2. Step 2: Merge the fetched changes into your local main branch

    Run 'git merge upstream/main' to combine their changes with yours.
  3. Final Answer:

    git fetch upstream && git merge upstream/main -> Option C
  4. Quick Check:

    Fetch then merge upstream changes [OK]
Quick Trick: Fetch then merge teammate's remote branch to update local [OK]
Common Mistakes:
  • Pushing instead of pulling teammate's changes
  • Adding remote without URL
  • Using clone instead of fetch and merge

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes