Bird
0
0

If you run git stash push -p -- app.js and select only some hunks, what will be stashed?

medium📝 Command Output Q5 of 15
Git - Stashing
If you run git stash push -p -- app.js and select only some hunks, what will be stashed?
AAll changes in the repository are stashed
BAll changes in app.js are stashed regardless of selection
COnly the selected hunks from app.js are stashed
DNo changes are stashed because -p conflicts with --
Step-by-Step Solution
Solution:
  1. Step 1: Understand combined use of -p and --

    The -p option allows interactive selection of hunks. The -- app.js limits stashing to that file.
  2. Step 2: Result of command

    Only the hunks you select from app.js will be stashed; other changes remain.
  3. Final Answer:

    Only the selected hunks from app.js are stashed -> Option C
  4. Quick Check:

    -p with -- stashes selected hunks of specified files = D [OK]
Quick Trick: Combine -p and -- to stash selected hunks of specific files [OK]
Common Mistakes:
  • Thinking -p and -- cannot be combined
  • Assuming all changes in app.js stash regardless of selection
  • Believing command stashes all repo changes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes