Q: 7
A developer is working in a branch to develop a new feature named ‘newfeat404880077’. A file named ‘devcoreg13642911.jpg’ has accidentally been staged. This needs to be removed so that the commit is performed and branches merged. Which git command must be used to unstage the file?
Options
Discussion
Yeah, it's definitely C here.
D imo
C , D is a classic trap since revert is about commits not staged files.
Official git docs and practice labs both back C.
Definitely C here. git reset HEAD devcoreg13642911.jpg takes the file back out of the staging area but doesn't delete it, so it's still in your working directory. That's how you keep your work without including it in the next commit. Pretty standard process in git, let me know if anyone's seen another method for just unstaging.
C here.
git reset HEAD [file] is the only real way to unstage without deleting anything, just like in recent exam versions. D is a trap, it's for undoing commits, not unstaging. Open to corrections if I'm missing something.Nah, I don't think it's D-revert is for undoing commits, not unstaging files. The safest pick for just removing from staging is C. Reset HEAD leaves your working file intact, which is what they want here.
Yeah pretty sure it's C for unstaging, but open to other ideas if anyone's used another git command in this scenario.
C , had something like this in a mock-
git reset HEAD [file] is the exact way to unstage without touching the actual file. Other options either don’t exist or do something else. Pretty sure it’s what they want here, but open to other takes.C official git docs and practice labs always point to git reset for unstaging. Anyone see differently on real exams?
Be respectful. No spam.