Bird
0
0

You execute the following commands on your feature branch:

medium📝 Command Output Q4 of 15
Git - Collaboration Workflows
You execute the following commands on your feature branch:
git add app.js
git commit -m 'Add new feature'
git push origin feature-branch

What is the effect of these commands?
AThe new commit is added locally and pushed to update the remote feature branch
BThe commit is created but not pushed to the remote repository
CThe push will fail because the branch is not up to date
DThe changes are staged but not committed
Step-by-Step Solution
Solution:
  1. Step 1: git add app.js

    This stages the changes in app.js for commit.
  2. Step 2: git commit -m 'Add new feature'

    This creates a new commit with the staged changes.
  3. Step 3: git push origin feature-branch

    This pushes the new commit to the remote feature branch, updating the PR.
  4. Final Answer:

    The new commit is added locally and pushed to update the remote feature branch -> Option A
  5. Quick Check:

    Stage, commit, then push updates [OK]
Quick Trick: Push after commit to update remote branch [OK]
Common Mistakes:
  • Assuming push happens automatically after commit
  • Not staging files before commit
  • Expecting push to fail without pull

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes