How do you undo changes in the working directory that haven’t been committed yet?
a)
git revertb)
git reset --hardc)
git checkout -- filed)
git deleteAnswer:
c)
git checkout -- fileExplanation:
The command git checkout -- file is used to undo changes in the working directory for a specific file, reverting it to the state from the last commit. It does not affect staged changes, only changes in the working directory.
For example, if you’ve made changes to file.txt but haven’t committed them yet, running git checkout -- file.txt will discard the modifications.
This is useful when you want to revert uncommitted changes and reset the file to its previous state.